我的 MS 图表图表类型列有问题。如果图表中的条形超过 9 个,x 轴标签将无法正确显示,其中一些会消失。
这是我对图表的标记:
<asp:Chart ID="chtNBAChampionships" runat="server">
<Series>
<asp:Series Name="Championships" YValueType="Int32" Palette="Berry" ChartType="Column" ChartArea="MainChartArea" IsValueShownAsLabel="true">
<Points>
<asp:DataPoint AxisLabel="Celtics" YValues="17" />
<asp:DataPoint AxisLabel="Lakers" YValues="15" />
<asp:DataPoint AxisLabel="Bulls" YValues="6" />
<asp:DataPoint AxisLabel="Spurs" YValues="4" />
<asp:DataPoint AxisLabel="76ers" YValues="3" />
<asp:DataPoint AxisLabel="Pistons" YValues="3" />
<asp:DataPoint AxisLabel="Warriors" YValues="3" />
<asp:DataPoint AxisLabel="Mara" YValues="4" />
<asp:DataPoint AxisLabel="Saza" YValues="9" />
<asp:DataPoint AxisLabel="Buha" YValues="6" />
</Points>
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="MainChartArea">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
只有 9 条它可以工作,但我不知道为什么它会在超过 9 条时失败。有什么办法可以使图表正常工作吗?另外,如果可能,如何使每个条具有不同的颜色?
最佳答案
我有同样的问题,但我在页面加载时使用 c#。
我通过添加这个解决了它
Chart2.ChartAreas["ChartArea1"].AxisX.Interval = 1;
关于.net - MS Chart with ASP.NET chart type "column"如果图表中有超过 9 个条形,则不显示 x 轴标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2435540/