我有一堆产品的图表,总共 35 个。他们放大了 X 轴。该图表绘制得很好,但只有 5 个产品名称显示,我需要它们全部显示。我已将 MinorTickMark 启用为 true,因此所有刻度线都显示,但我如何让它们各自的标签可见?
我无法发布图片,所以这里是 aspx 标记和背后的代码。.aspx 标记;
<asp:Chart ID="MonthinYearchart" Width="350px" Height="420px" runat="server">
<Series>
<asp:Series ChartType="Bar" ChartArea="MainChartArea" Name="PnL">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="MainChartArea">
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
这是将示例数据放入图表中的代码。
Private Sub AllCommodforMonthChart()
Dim cht As Chart = MonthinYearchart
'create the arraylist of data
'this is hardcoded to get chart to work, you will have to
'set up the code to retrieve it from database
Dim list As List(Of String) = GetList("Futures Data")
Const val As Integer = 65
'create all the data points
For i As Integer = 0 To list.Count - 1
cht.Series("PnL").Points.AddXY(list(i), val * i)
Next
cht.Series("PnL").ChartType = SeriesChartType.Bar
cht.ChartAreas("MainChartArea").AxisX.MinorTickMark.Enabled = True
End Sub