我有一堆產品的圖表,總共有35個。他們擴大了X軸。圖表很好,但只有5個產品名稱顯示,我需要它們全部顯示。我已啓用MinorTickMark爲true,以便所有刻度線都顯示,但我如何獲得它們各自的標籤可見?顯示圖表控制中的所有值Xaxis
我無法獲取圖片發佈,所以這裏是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
謝謝您的回答! – karthik
@dinotom你可以回答你自己的問題 – Drake
Interval = 1解決了我的問題。 –