1

Using System.Web.UI.DataVisualization.Charting, I've got data I want to represent as a Bar chart with the first item at the series displaying at the top of the chart, rather than the bottom. E.g. for a series with labels {"A", "B", "C"}, the bar for C will display at the top, while I would want A to be the top bar. This ordering makes sense for numerical data, but in some cases less sense for categorical data. Is there any property or something I can set, or do I need to reverse the order of the data?

saveenr
  • 8,439
  • 3
  • 19
  • 20
lgaud
  • 2,430
  • 20
  • 30

2 Answers2

2

You might try something like this after you've bound the data (but before the chart is rendered):

Chart1.Series["Series1"].Sort(PointSortOrder.Ascending, "X");

This will sort Series1 by its X-axis value.

Scott Mitchell has a post about Sorting and Filtering data in the Chart control here.

Peter
  • 12,541
  • 3
  • 34
  • 39
0

I had the same problem i tried the following:

Chart1.ChartAreas[0].AxisX.Minimum = 0;
Chart1.ChartAreas[0].AxisX.Maximum = 7;
Chart1.ChartAreas[0].AxisX.IsReversed = true;

Provide the Minimum and Maximum values for the bar chart and then reverse it.

Let me know if that works in your case.