.net - MS Chart with ASP.NET chart type "column"如果图表中有超过 9 个条形,则不显示 x 轴标签

标签 .net asp.net vb.net data-visualization mschart

我的 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/

相关文章:

c# - 如何通过 c# 从 asp.net 中的 excel 文件加载 gridview?

javascript - VB.NET TCP 客户端与 NODE-RED TCP 监听器进行双向通信

C# View 模型到模型

c# - 是否有用于从 .NET 搜索 Amazon CloudSearch 的库?

javascript - 如何简化这个 jquery 脚本?

VB.NET 2010 - IDE - 缺少运行/暂停/停止按钮

vb.net - 使用包含 Excel VBA 内的 DataContract 的 wcf 服务

c# - 我应该在 Windows Phone 8 中将异步调用转换为同步吗?

c# - 是否有通过网络同步数据列表的模式?

javascript - 使用 javascript 检查 RadioButtonList