0

I am trying to put two variables of a datatable in a bar chart (available and unavailable) in percentage (y axis) and Date in x axis for each service (color in the plotly to differentiate the services). This is my datatable with respective variables. enter image description here

And I am trying to combine these two variables in a single graph taking into account each service (Serie). At this moment I only got this: enter image description here

Liliana
  • 1
  • 2
  • 2
    Welcome! Please provide the reproducible sample. Refer https://stackoverflow.com/help/minimal-reproducible-example on how to generate the reproducible sample. – Mohanasundaram Apr 20 '20 at 13:01

1 Answers1

0

I tried to do this using plotly in R

barstack<-plot_ly(Servicelevel, x=Servicelevel$Date, y=Servicelevel$Available,
                             color=Servicelevel$Series,type = "bar")
    barstack <- barstack %>% add_trace(y = Servicelevel$Unavailable)
    barstack<-barstack %>% 
      layout(title = "Percentage of Availability over time",
             yaxis = list(title = 'Availability (%)',
                          tickformat = ".2%"),
             xaxis=list(title='Date'), barmode = 'stack')

And result is this: result

Liliana
  • 1
  • 2