图表控件,固定x轴字符串间隔? [英] Chart control, fixing x-axis string interval ?
本文介绍了图表控件,固定x轴字符串间隔?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我在VS 2010中使用Chart控件.我想在y轴上绘制日期,并在x轴上绘制等级("a","b","c","d").使用阶梯线
我可以将STRING值固定在x轴上吗?
即这就是即时通讯
Hi Guys,
I am using Chart control in VS 2010. I want to plot date on the y-axis and grade( "a","b","c","d") on the x-axis. using a step line
Is it possible for me to fix the STRING values on the x-axis?
i.e This is what im getting
date8 - ------
date7 - ------|
date6 - |
date5 - ------
date4 - |
date3 - ------
date2 - |
date1 - -------
--------------------------------------------------
A A A B C C D
这就是我想要的:
很抱歉提供了错误的插图:)
this is what i would prefer:
sorry for the bad illustration :)
date8 - |------
date7 - ------|
date6 - |
date5 - |
date4 - |
date3 - |
date2 - |
date1 - -------
--------------------------------------------------
A B C D
我正在从数据库中获取数据.
Im getting the data from a database.
Thanks.
推荐答案
DateTime[] yValues = { date[0],date[1],date[2] };
string[] xValues = { "A","B","C","D" };
Chart1.Series["Default"].Points.DataBindXY(xValues, yValues);
这篇关于图表控件,固定x轴字符串间隔?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文