Asp:Chart 的 X 轴缺失值

Missing values of X Axis for Asp:Chart

您好,我刚刚完成了 X 轴和 Y 轴 asp 条形图的数据绑定,但我遇到了一个奇怪的问题..

我实际上将 X 轴设置为一月、二月、三月...十月、十一月和十二月。但只有偶数月份出现(二月、四月、...十月、十二月)

我正在使用的代码,

        String username = Session["ConsumerSelected"].ToString();

        AuditNLoggingDAO al = new AuditNLoggingDAO();

        String[] month = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
        "Jul", "Aug", "Sept", "Oct", "Nov", "Dec" };

        int[] monthLogin = { al.janLogin(username), al.febLogin(username), al.marLogin(username), al.aprLogin(username), al.mayLogin(username),
        al.junLogin(username), al.julyLogin(username), al.augLogin(username), al.septLogin(username), al.octLogin(username), al.novLogin(username), al.decLogin(username) };

        int[] monthLogout = { al.janLogout(username), al.febLogout(username), al.marLogout(username), al.aprLogout(username), al.mayLogout(username),
        al.junLogout(username), al.julyLogout(username), al.augLogout(username), al.septLogout(username), al.octLogout(username), al.novLogout(username), al.decLogout(username) };

        int[] monthFailure = { al.janFailure(username), al.febFailure(username), al.marFailure(username), al.aprFailure(username), al.mayFailure(username),
        al.junFailure(username), al.julyFailure(username), al.augFailure(username), al.septFailure(username), al.octFailure(username), al.novFailure(username), al.decFailure(username) };

        int[] monthPW = { al.janPW(username), al.febPW(username), al.marPW(username), al.aprPW(username), al.mayPW(username), al.junPW(username), al.julyPW(username), al.augPW(username), al.septPW(username),
         al.octPW(username), al.novPW(username), al.decPW(username) };

        Series seriesLogin = ChartMonth.Series.Add("SeriesLogin");
        seriesLogin.Color = ColorTranslator.FromHtml("#5cb85c");
        seriesLogin.LegendText = "Number of Login Executes";
        seriesLogin.IsValueShownAsLabel = true;
        seriesLogin.Font = new Font("Microsoft Sans Serif", 11);
        seriesLogin.SmartLabelStyle.Enabled = false;

        ChartMonth.Series["SeriesLogin"].Points.DataBindXY(month, monthLogin);

        Series seriesLogout = ChartMonth.Series.Add("SeriesLogout");
        seriesLogout.Color = ColorTranslator.FromHtml("#f0ad4e");
        seriesLogout.LegendText = "Number of Logout Executes";
        seriesLogout.IsValueShownAsLabel = true;
        seriesLogout.Font = new Font("Microsoft Sans Serif", 11);
        seriesLogout.SmartLabelStyle.Enabled = false;

        ChartMonth.Series["SeriesLogout"].Points.DataBindXY(month, monthLogout);

        Series seriesFailure = ChartMonth.Series.Add("SeriesFailure");
        seriesFailure.Color = ColorTranslator.FromHtml("#d9534f");
        seriesFailure.LegendText = "Number of Login Failures";
        seriesFailure.IsValueShownAsLabel = true;
        seriesFailure.Font = new Font("Microsoft Sans Serif", 11);
        seriesFailure.SmartLabelStyle.Enabled = false;

        ChartMonth.Series["SeriesFailure"].Points.DataBindXY(month, monthFailure);

        Series seriesPW = ChartMonth.Series.Add("SeriesChangePW");
        seriesPW.Color = ColorTranslator.FromHtml("#5bc0de");
        seriesPW.LegendText = "Number of Password Changes";
        seriesPW.IsValueShownAsLabel = true;
        seriesPW.Font = new Font("Microsoft Sans Serif", 11);
        seriesPW.SmartLabelStyle.Enabled = false;

        ChartMonth.Series["SeriesChangePW"].Points.DataBindXY(month, monthPW);

结果,

为什么所有月份都没有显示..? 感谢任何帮助,谢谢!

我通过在客户端的 Axis X 标签中添加 Axis X Interval = 1 来修复它

                                    <asp:Chart runat="server" ID="ChartMonth" Width="1100px" Height="538px">
                                        <ChartAreas>
                                            <asp:ChartArea Name="ChartAreaMonth">
                                                <AxisX Title="Month of Year" Interval="1">
                                                    <MajorGrid Enabled="false" />
                                                </AxisX>
                                                <AxisY Title="Number of Executes">
                                                    <MajorGrid Enabled="true" />
                                                </AxisY>
                                            </asp:ChartArea>     
                                        </ChartAreas>
                                        <Legends>
                                            <asp:Legend Docking="Bottom" Name="LegendMonth"></asp:Legend>
                                        </Legends>
                                        <Titles>
                                            <asp:Title Name="TitleChart" Font="Microsoft Sans Serif, 13pt" Text="Monthly Statistics" Alignment="TopCenter"></asp:Title>
                                        </Titles>
                                    </asp:Chart>

我其实还是想知道为什么我的系列中的所有 X 轴都没有显示。请随时给出答案。谢谢