如何使x轴忽略的x值的顺序? [英] How to make the x-axis to ignore the order of the x values?

查看:476
本文介绍了如何使x轴忽略的x值的顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我很抱歉,如果我的英语不是很好......

First, I'm sorry if my English isn't that good...

我有4个阵列(第2是系列#1),并且我想将它们绑定到我的图:

I have 4 arrays (the first 2 are for series #1), and I want to bind them to my chart:

double[] yValues1 = { 65.62, 75.54, 60.45, 55.73, 70.42, 200 };
string[] xValues1 = { "France", "Canada", "UK", "USA", "Italy", "India" };
chart.Series["Series1"].Points.DataBindXY(xValues1, yValues1);

double[] yValues2 = { 65.62, 75.54, 60.45, 55.73, 200, 70.42 };
string[] xValues2 = { "France", "Canada", "UK", "USA", "India", "Italy"};
chart.Series["Series2"].Points.DataBindXY(xValues2, yValues2);

和结果(注意:该值和意大利和印度的顺序):

and the result is (Observe: the values and the order of Italy and India):

正如你所看到的,印度应该是与200两个系列,但第二个系列的200提到意大利(即第五位第一辑),因为如果这样下去,按照第一个系列。简言之,我想在两个系列要显示的xValues​​不管顺序,而是根据自己的字符串值。

As you can see, India supposed to be with 200 in both series, but the 200 of the second series referred to Italy (that is fifth in the first series), as if it goes according the first series. In brief, I want the two series to be shown regardless the order of the xValues, but according to their strings values.

顺便说一句,我怎么能限制列的数量,即使我绑定图表与数组的长度更大然后该限制?

And by the way, How can I to limit the number of columns and that even though I binded the chart with array with bigger length then that limit?

推荐答案

要实现这一目标增加一个调用AlignDataPointsByAxisLabel:

To accomplish this add a call to AlignDataPointsByAxisLabel:

Chart.AlignDataPointsByAxisLabel();

这将调整所有的数据点与同一轴上的标签,不管什么样的顺序,他们必然的。

This will align all data points with the same axis label, regardless of what order they are bound.

这篇关于如何使x轴忽略的x值的顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆