Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# chart show all labels

Tags:

c#

Working on a C# web app, my issue is that only some of the values are appearing on the report (This is the X Axis I'm talking about, it only shows every other value). Its simply showing every other one. How can I show all of them?

Thanks

enter image description here

enter image description here

My Code:

<asp:Chart ID="Chart6" runat="server" DataSourceID="SqlDataSource13" 
                Palette="Chocolate" Width="800px">
                <Series>
                    <asp:Series Name="Series1" CustomProperties="DrawingStyle=Cylinder" 
                        IsValueShownAsLabel="True" LabelFormat="{C2}" Palette="Chocolate" 
                        XValueMember="StartItem" YValueMembers="STDCOST2">
                    </asp:Series>
                </Series>
                <ChartAreas>
                    <asp:ChartArea Name="ChartArea1">
                        <AxisY IsLabelAutoFit="False" TextOrientation="Rotated90" 
                            TitleFont="Verdana, 7pt">
                            <LabelStyle Font="Microsoft Sans Serif, 6.75pt" Format="{C2}" />
                        </AxisY>
                        <AxisX IsLabelAutoFit="False" LabelAutoFitMaxFontSize="8" 
                            LabelAutoFitMinFontSize="7" LabelAutoFitStyle="None">
                            <LabelStyle Angle="90" Font="Microsoft Sans Serif, 6pt" Interval="Auto" 
                                IsEndLabelVisible="False" />
                            <ScaleBreakStyle BreakLineStyle="None" />
                        </AxisX>
                        <AxisX2 IsLabelAutoFit="False" LabelAutoFitMaxFontSize="8" 
                            LabelAutoFitStyle="None">
                            <LabelStyle Angle="45" />
                        </AxisX2>
                        <Area3DStyle Enable3D="True" />
                    </asp:ChartArea>
                </ChartAreas>
            </asp:Chart>
like image 223
GabrielVa Avatar asked Sep 27 '11 20:09

GabrielVa


1 Answers

I think some are confusing values with labels. The original question refers to labels, which are being skipped.

This is a repeat question of MS Chart with ASP.NET chart type “column” not showing axis x label if there are more than 9 bar in the chart

The answer is

Chart6.ChartAreas["ChartArea1"].AxisX.Interval = 1; 
like image 87
nycdan Avatar answered Oct 28 '22 15:10

nycdan