数据点标签未显示在使用MS Chart的条形图的第一个条形图上

时间:2013-05-14 20:09:03

标签: asp.net charts mschart

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

1 个答案:

答案 0 :(得分: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>

我的猜测仍然是你在低于轴的位置开始你的系列,因此它不会渲染第一个小节。