I have this bar chart control on my web page, I am adding at least 10 values to x-axis and y-axis, but the chart only shows 2 values on x and 3 values on y axis. Below is my code
我在我的网页上有这个条形图控件,我在x轴和y轴上添加了至少10个值,但是这个图表只显示了x上的2个值和y轴上的3个值。下面是我的代码
<asp:Chart ID="ChartTest" runat="server" Height="296px" Width="600px" ImageType="Png"
BackColor="#D3DFF0" Palette="BrightPastel" BorderlineDashStyle="Solid" BackSecondaryColor="White"
BackGradientStyle="TopBottom" BorderWidth="2" BorderColor="26, 59, 105">
<Titles>
<asp:Title ShadowColor="32, 0, 0, 0" Font="Trebuchet MS, 14.25pt, style=Bold" ShadowOffset="3"
Text=" Bar Chart" Name="Title1" ForeColor="26, 59, 105">
</asp:Title>
</Titles>
<Legends>
<asp:Legend Enabled="False" IsTextAutoFit="False" Name="Default" BackColor="Transparent"
Font="Trebuchet MS, 8.25pt, style=Bold">
</asp:Legend>
</Legends>
<BorderSkin SkinStyle="FrameThin1"></BorderSkin>
<ChartAreas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid"
BackSecondaryColor="White" BackColor="64, 165, 191, 228" ShadowColor="Transparent"
BackGradientStyle="TopBottom">
<Area3DStyle Rotation="9" Perspective="10" Enable3D="True" LightStyle="Realistic"
Inclination="38" PointDepth="200" IsRightAngleAxes="False" WallWidth="0" IsClustered="False" />
<Position Y="10" Height="94" Width="94" X="10" ></Position>
<AxisY LineColor="64, 64, 64, 64">
<LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</AxisY>
<AxisX LineColor="64, 64, 64, 64">
<LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</AxisX>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
and the code behind is below
后面的代码如下
var series = ChartTest.Series.Add("series1");
series.ChartType = SeriesChartType.Column;
series.XValueType = ChartValueType.Auto;
Chart_MRDBHull.Titles[0].Text = "chart 1";
foreach (DataRow dr in ds.Tables[0].Rows)
{
//if(dr.Table.Columns.Contains(
var xValue = dr["class1"].ToString();
var yValue = dr["Total"].ToString();
series.Points.AddXY(xValue, yValue);
}
any help will be appreciated.
如有任何帮助,我们将不胜感激。
2 个解决方案
#1
1
this may help. Set the Interval Value.
这可能有帮助。设置区间值。
http://social.msdn.microsoft.com/forums/en us/mswinwebchart/thread/e83917a2 - 2 f06 - 433 - 8 ccc - 6 - f1bc329617b/
#2
0
Set the Interval values on both the XAxis and YAxis. If you want tickmarks for each label, set the Interval on the MajorTickMark property of each axis as well.
在XAxis和YAxis上设置Interval值。如果您希望为每个标签设置标记,那么也要在每个轴的主要标记属性上设置间隔。
#1
1
this may help. Set the Interval Value.
这可能有帮助。设置区间值。
http://social.msdn.microsoft.com/forums/en us/mswinwebchart/thread/e83917a2 - 2 f06 - 433 - 8 ccc - 6 - f1bc329617b/
#2
0
Set the Interval values on both the XAxis and YAxis. If you want tickmarks for each label, set the Interval on the MajorTickMark property of each axis as well.
在XAxis和YAxis上设置Interval值。如果您希望为每个标签设置标记,那么也要在每个轴的主要标记属性上设置间隔。