读书人

ASP.NET MSCHART Label使用

发布时间: 2012-08-08 14:32:45 作者: rapoo

ASP.NET MSCHART Label使用求助!
本来用MSCHART得心应手,今天客户一需求解决不了。。求大伙帮忙 T_T

需求建立在多组柱状图上:

HTML code
<asp:chart id="Chart1" runat="server" Height="296px" Width="412px" ImageLocation="~/TempImages/ChartPic_#SEQ(300,3)" ImageType="Png" Palette="Pastel" BackColor="#F3DFC1" BorderDashStyle="Solid" BackGradientStyle="TopBottom" BorderWidth="2" BorderColor="181, 64, 1">                            <titles>                                <asp:Title ShadowColor="32, 0, 0, 0" Font="Trebuchet MS, 14.25pt, style=Bold" ShadowOffset="3" Text="Chart for .NET Framework" Alignment="TopLeft" ForeColor="26, 59, 105">                                    <position y="4" height="8.738057" width="65" x="4"></position>                                </asp:Title>                            </titles>                            <legends>                                <asp:Legend LegendStyle="Row" Enabled="False" Name="Default" BackColor="Transparent">                                    <position y="85" height="5" width="40" x="5"></position>                                </asp:Legend>                            </legends>                            <borderskin skinstyle="Emboss"></borderskin>                            <series>                                <asp:Series ChartArea="ChartArea1" XValueType="Double" Name="Series2" CustomProperties="DrawingStyle=Cylinder" ShadowColor="Transparent" BorderColor="180, 26, 59, 105" Color="65, 140, 240" Font="Trebuchet MS, 8.25pt, style=Bold" Legend="Legend2" YValueType="Double">                                    <points>                                        <asp:DataPoint XValue="1" YValues="70"  />                                        <asp:DataPoint XValue="2" YValues="80" />                                        <asp:DataPoint XValue="3" YValues="70" />                                        <asp:DataPoint XValue="4" YValues="85" />                                    </points>                                </asp:Series>                                <asp:Series ChartArea="ChartArea1" Name="Series1" CustomProperties="DrawingStyle=Cylinder" BorderColor="64, 0, 0, 0" Color="252, 180, 65" Font="Trebuchet MS, 8.25pt, style=Bold">                                    <points>                                        <asp:DataPoint BorderColor="64, 0, 0, 0" XValue="1" YValues="65" />                                        <asp:DataPoint XValue="2" YValues="70" />                                        <asp:DataPoint BorderWidth="2" BorderColor="220, 26, 59, 105" XValue="3" YValues="82,25" />                                        <asp:DataPoint XValue="4" YValues="75" />                                    </points>                                </asp:Series>                                <asp:Series ChartArea="ChartArea1" Name="Series3" CustomProperties="DrawingStyle=Cylinder" BorderColor="64, 0, 0, 0" Color="224, 64, 10" Font="Trebuchet MS, 8.25pt, style=Bold">                                    <points>                                        <asp:DataPoint XValue="1" YValues="50" />                                        <asp:DataPoint XValue="2" YValues="55" />                                        <asp:DataPoint XValue="3" YValues="40" />                                        <asp:DataPoint XValue="4" YValues="70" />                                    </points>                                </asp:Series>                            </series>                            <chartareas>                                <asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BackSecondaryColor="White" BackColor="OldLace" ShadowColor="Transparent" BackGradientStyle="TopBottom">                                    <area3dstyle pointgapdepth="0" Rotation="5" perspective="10" Inclination="15" IsRightAngleAxes="False" wallwidth="0" IsClustered="False"></area3dstyle>                                    <position y="13" height="75" width="90" x="2"></position>                                    <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" interval="1">                                        <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" />                                        <majorgrid linecolor="64, 64, 64, 64" />                                    </axisx>                                </asp:ChartArea>                            </chartareas>                        </asp:chart> 



生成后的柱图:

红黄蓝3个柱子为一组,图中一共4组数据
这里想在纵坐标LABEL上显示每根柱子的数据,并且要显示每根柱子占一组数据总和的百分比,保留1位小数。。。
蛋疼啊,#PERCENT统计的是一根柱子占所有相同颜色柱子的百分比。。。求大神赐教!!路过的进来看看哈,会的帮忙,不会的帮顶,小弟拜谢=。=

[解决办法]
友情 置顶! 会的 朋友帮帮忙呀!!!!!!!
[解决办法]
删除胸,我怕不来你会打我。。。
[解决办法]
try using series.points[i].label in your code

读书人网 >C#

热点推荐