amCharts Blog

DataViz Tip #1: Sort your bar charts by value

Every week we will post a data visualization tip to help you create better visualizations and provide a way to take advantage of the concept using amCharts (where applicable). Subscribe to our newsletter to get notified about new tips and more.

Your data may come in some order or no particular order at all. Whenever the data is not date-based, you want to display it in your bar/column chart sorted by value. This makes it much easier for the person analyzing the visual to perceive the data in comparison and helps you convey your message.

Should you order your chart in ascending or descending order? The answer, as always, is “it depends.” When you want to, say, compare your numbers to your competitors, you should probably go highest to lowest. On the other hand, if you wish to lead the viewers focus to demonstrate some growth – lowest to highest is your choice.

Consider this example:

From this chart, we can clearly see that Amazon is at the top. And if, say, what we care about the most is Apple, we can clearly see where it stands compared to others. Consider what would this chart look like if it was ordered by company name. Comparing Apple to Target or Uber would require way more work and concentration from the viewer.

But my data comes from an API that I don’t control. Is there a way to reorder the data with amCharts?

Glad you asked! There’s definitely a way to do that, and we have a knowledge base article demonstrating just that. Check out “Automatically order columns by their value.”

See the Pen Automatically order columns by their value by amCharts (@amcharts) on CodePen.24419

Subscribe to our monthly newsletter and get more data visualization tips.