开发者

.Net Charting - switching display order of bar charts

Using System.Web.UI.DataVisualization.Charting, I've开发者_Go百科 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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜