MS Chart with ASP.NET chart type "column" not showing axis x label if there are more than 9 bar in the chart

29,700

Solution 1

I had the same problem, but i'm using c# on page load.

I solved it by adding this

    Chart2.ChartAreas["ChartArea1"].AxisX.Interval = 1;

Solution 2

Chart2.ChartAreas["ChartArea1"].AxisX.Interval = 1;

Solution 3

<ChartAreas>
<asp:ChartArea Name="ChartArea1" >
<AxisY Title="Progress->">
</AxisY>
<AxisX Interval="1" Title="Activity->">
</AxisX>
</asp:ChartArea>
Share:
29,700
Tola
Author by

Tola

A regular guy who writes code to solve the business problems now and then. A Guitarist wannabe.

Updated on July 13, 2022

Comments

  • Tola
    Tola almost 2 years

    I have a problem with an MS Chart chart type column. If there are more than 9 bars in the chart, the axis-x labels won't show up properly, some of them just disappear.

    Here's my mark-up for the chart:

    <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>
    

    With only 9 bars it works, but I don't know why it fails with more than 9 bars. Is there any way to make the chart work properly? Also, if possible, how to make each bar have different color?