ASP.NET 차트에서 레이블이 사라지는 이유는 무엇입니까?
문제
Chart1에는 모든 레이블이 표시되지만 10 번째 항목을 추가하면 레이블의 절반이 사라집니다.
먼저 마크 업 :
<asp:Chart ID="Chart1" runat="server" Width="700" Height="600">
<series>
<asp:Series Name="Series1" ChartType="Bar" />
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1" />
</chartareas>
</asp:Chart>
<asp:Chart ID="Chart2" runat="server" Width="700" Height="600">
<series>
<asp:Series Name="Series1" ChartType="Bar" />
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1"/>
</chartareas>
</asp:Chart>
그리고 우리는 몇 가지 데이터를 추가합니다 ...
Dim labels As New System.Collections.Generic.Dictionary(Of String, Integer)
labels.Add("1 thing", 24655)
labels.Add("2 thing", 11355)
labels.Add("3 thing", 6890)
labels.Add("4 thing", 5815)
labels.Add("5 thing", 5155)
labels.Add("6 thing", 4160)
labels.Add("7 thing", 2430)
labels.Add("8 thing", 2055)
labels.Add("9 thing", 1545)
Chart1.Series("Series1").Points.DataBindXY(labels, "Key", labels, "Value")
Chart1.DataBind()
labels.Add("10 thing", 1530)
Chart2.Series("Series1").Points.DataBindXY(labels, "Key", labels, "Value")
Chart2.DataBind()
해결책
방금 축의 간격을 설정해야했습니다.
Chart2.ChartAreas("ChartArea1").AxisX.Interval = 1
제휴하지 않습니다 StackOverflow