如何在asp.net c#中的图表控件中将X轴的起始值设为最大值 [英] How can I make the start value of X axis to maximum in Chart Control in asp.net c#
本文介绍了如何在asp.net c#中的图表控件中将X轴的起始值设为最大值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请找到我的以下代码,
Hi,
Kindly find my following code,
protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
{
BindChart();
}
}
protected void BindChart()
{
string[] counteries = { "India", "Sri Lanka", "England", "South Africa"};
int[] ODIpoints = {60,40,50,30};
Chart1.Series[0].Points.DataBindXY(counteries,ODIpoints);
Chart1.Series[0].ChartType = SeriesChartType.Column;
Chart1.ChartAreas[0].AxisX.Maximum = 120;
Chart1.ChartAreas[0].AxisX.Minimum = 20;
Chart1.ChartAreas[0].AxisX.ScaleBreakStyle.Enabled = true;
Chart1.ChartAreas[0].AxisX.ScaleBreakStyle.StartFromZero = StartFromZero.No;
Chart1.ChartAreas[0].AxisY.IsReversed = true;
Chart1.Series[0].XAxisType = AxisType.Secondary;
Chart1.Series[0].YAxisType = AxisType.Primary;
}
这产生的输出反转了Y轴值,但我的列呈现为向上所以我想将列向下显示,
喜欢,应该从Y轴的最大值开始,
请帮助我。
this produced the output which reversed the Y-Axis values but my column rendered as up side down So I want to show the column down side up,
like, should started from maximum value of Y-Axis ,
please help me.
推荐答案
未经测试的解决方案。将交叉属性添加到Y轴以将X轴移动到顶部:
Untested solution. Add Crossing property to the Y-Axis to move the X-Axis to the top:
Chart1.ChartAreas[0].AxisY.Crossing = Double.Minimum;
这篇关于如何在asp.net c#中的图表控件中将X轴的起始值设为最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文