首页 新闻 赞助 找找看

关于chart 柱形图 x轴信息显示不全

0
悬赏园豆:10 [已解决问题] 解决于 2013-05-06 12:59

信息表:

     编号    head       quantity

      1 wef 1      
      2 sf 1      
      大大大大      
      地地道道的      
      嗯嗯额      
      多打点      
      任溶溶      
      对对对      
      哒哒哒      
      10  达到 1      
 

现在的柱形图:

x轴的没有显示字段head中的全部信息,缺少“嗯嗯额”等

表的记录条数是九个的时候,显示正常,但有10或10以上的记录的话就会出现上图所示的情况。

html代码:

<asp:Chart ID="Chart2" runat="server" BackImageAlignment="Center" Height="310px"
            Width="390px">
            <Legends>
                <asp:Legend Enabled="False" IsTextAutoFit="False" Name="Default" BackColor="Transparent"
                    Font="Trebuchet MS, 8.25pt, style=Bold">
                </asp:Legend>
            </Legends>
            <BorderSkin SkinStyle="Emboss"></BorderSkin>
            <Series>
                <asp:Series Name="Series1" BorderColor="180, 26, 59, 105" XValueMember="head" YValueMembers="quantity"
                    YValueType="Int32">
                </asp:Series>
            </Series>
            <ChartAreas>
                <asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid"
                    BackSecondaryColor="White" BackColor="64, 165, 191, 228" ShadowColor="Transparent"
                    BackGradientStyle="TopBottom">
                    <AxisY2 IsLabelAutoFit="False">
                    </AxisY2>
                    <AxisX2 IsLabelAutoFit="False">
                    </AxisX2>
                    <Area3DStyle Rotation="15" Perspective="15" Inclination="15" IsRightAngleAxes="False"
                        WallWidth="0" IsClustered="False"></Area3DStyle>
                    <AxisY LineColor="64, 64, 64, 64" IsLabelAutoFit="False">
                        <LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
                        <MajorGrid LineColor="64, 64, 64, 64" />
                    </AxisY>
                    <AxisX LineColor="64, 64, 64, 64" IsLabelAutoFit="False">
                        <LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
                        <MajorGrid LineColor="64, 64, 64, 64" />
                    </AxisX>
                </asp:ChartArea>
            </ChartAreas>
        </asp:Chart>

后台代码:

 Chart2.Titles.Add(“”);
                Chart2.DataSource = ds;
                Chart2.DataBind();

谁能帮忙解决下

 

 

偶不是大叔的主页 偶不是大叔 | 初学一级 | 园豆:140
提问于:2013-05-06 12:13
< >
分享
最佳答案
0

设置x轴偏移

前端设置<axisx>添加2个属性就可以了Interval 和IntervalOffset

 

后台

控件.ChartAreas[0].AxisX.Interval = 1;
控件.ChartAreas[0].AxisX.IntervalOffset = 1;

收获园豆:10
truename | 初学一级 |园豆:168 | 2013-05-06 12:50
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册