0

我在 asp.net 中使用微软图表,我有一个带有点标签的简单柱形图,但是,第一个数据点没有显示最接近 Y 轴的条形图。我在柱形图中有五年的数据点,但始终显示 Y 轴上最接近的数据点,而其余的则显示。我不确定我需要设置什么属性才能显示所有数据点。谢谢。这是图表的代码

<asp:chart id="Chart1" runat="server" BackColor="#D3DFF0" Palette="Chocolate" 
                            ImageType="Png" ImageUrl="~/TempImages/ChartPic_#SEQ(300,3)" Width="861px" 
                            Height="296px" borderlinestyle="Solid" backgradientendcolor="White" 
                            backgradienttype="TopBottom" borderlinewidth="2" 
                            borderlinecolor="26, 59, 105" BackGradientStyle="TopBottom">
                            <titles>
                                <asp:Title ShadowColor="32, 0, 0, 0" Font="Trebuchet MS, 14.25pt, style=Bold" ShadowOffset="3" Text="Closed Months" Alignment="TopCenter" ForeColor="Yellow"></asp:Title>
                            </titles>
                            <legends>
                                <asp:Legend Enabled="False" Name="Default" BackColor="Transparent" Font="Trebuchet MS, 8.25pt, style=Bold">
                                    <position y="21" height="22" width="18" x="73"></position>
                                </asp:Legend>
                            </legends>
                            <borderskin skinstyle="FrameTitle8"></borderskin>
                            <series>
                                <asp:Series Name="TotalCount" BorderColor="180, 26, 59, 105" 
                                    IsValueShownAsLabel="True" BackGradientStyle="VerticalCenter" 
                                    YValuesPerPoint="2"></asp:Series>
                            </series>
                            <chartareas>
                                <asp:ChartArea Name="Default" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" BackSecondaryColor="White" BackColor="64, 165, 191, 228" ShadowColor="Transparent" BackGradientStyle="TopBottom">
                                    <axisy linecolor="64, 64, 64, 64" IsLabelAutoFit="False">
                                        <labelstyle font="Trebuchet MS, 8.25pt, style=Bold"></labelstyle>
                                        <majorgrid linecolor="64, 64, 64, 64"></majorgrid>
                                    </axisy>
                                    <axisx linecolor="64, 64, 64, 64" isLabelAutofit="False">
                                        <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" Interval="Auto"></labelstyle>
                                        <majorgrid linecolor="64, 64, 64, 64"></majorgrid>
                                    </axisx>
                                </asp:ChartArea>
                            </chartareas>
                        </asp:chart>
4

1 回答 1

0

没有代码很难分辨,但请确保数据点在图表区域的限制范围内。

chart.ChartAreas[index].AxisY.Minimum = something_lower_than_lowest_Y_value_in_your_data_points

此外,检查 X 轴是否相同,根据经验,MScharts 倾向于将两者混合。

编辑:

我只在 c# 上处理过 MSCharts,所以请原谅我缺乏有用的输入。不过,从我从您的代码中收集到的信息来看,它似乎主要是外观。我认为您在 ChartArea 标记中需要这样的东西:

 <AxisX Minimum="-1">        
</AxisX>

我的猜测仍然是你在低于轴的点开始你的系列,所以它不会渲染第一个栏。

于 2013-05-16T15:26:42.440 回答