Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Sort Order of Histogram Chart to Show Max to Min Count

Hi Guy, I have just started using plotly and R for that matter. I have been designing an app for department dashboard. Using alarm data from out systems database I would like a histogram of this information to show the most frequent alarms over the past 24 hours

. I Have the data imported from our system into the app in appropriate data frame. From this data frame I have created a subset of data for the alarm histogram. The histogram will plot the count of each unique alarm and show it accordingly. What I would like to do is rearrange this data going from Max count to min. I know this can be done in R.

below is the code:

x<- list(
title= “Alarm”,
showticklabels=FALSE

)

y<- list(
  title="Number of Alarms"
)

plot_ly(x = Alarmsfiltered$ALRMTXT, type = "histogram")
layout(showlegend =FALSE,xaxis=x,yaxis=y)

})

But for simplicity is there any way of rearranging it using plotly?

Basically using the plotly function to summarise the alarm labels into a total count for each unique label.

Maybe I am doing this the wrong way completely so I apologize but I am new to all this.

Cheers,
Jonny.