MsChart 柱状图前台代码整理

本文详细介绍了使用ASP.NET创建图表的具体配置方法,包括图表样式、图例设置、系列数据展示及轴线配置等内容。通过这些配置可以实现丰富的图表效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<asp:Chart ID="ctUtilizationBySM" runat="server" BackImageAlignment="TopRight"
                               PaletteCustomColors="IndianRed; DarkSeaGreen; 0, 192, 192; 128, 128, 255; CornflowerBlue; Gold"
                                Width="700px" BackColor="PapayaWhip"    //the width of chart,the backcolor of chart
                                BackGradientStyle="TopBottom" BackImageTransparentColor="White" 
                                BorderlineColor="Black">
                                <Legends>
                                
                                    <asp:Legend BackColor="Transparent" Name="Legend2"  //legend means a tag,this tag is used notfiy column chart
                                        DockedToChartArea="ChartArea1" Alignment="Far" Docking="Top" 
                                        IsDockedInsideChartArea="False"  >
                                         <Position Height="8.026756" Width="15.4154158" X="83.5" Y="3" /> //legend's position
                                        
                                    </asp:Legend>
                                    <asp:Legend BackColor="Transparent" Name="Legend1" 
                                        DockedToChartArea="ChartArea1" Alignment="Far" Docking="Top" 
                                        IsDockedInsideChartArea="False">
                                     
                                        <Position Height="8.026756" Width="15.4154158" X="72.5" Y="3" />
                                     
                                    </asp:Legend>
                                </Legends>
                                <BorderSkin SkinStyle="Emboss" />  //add emboss effect,backgroud effect
                                <Series>// histogram  series                           
		<asp:Series Name="Series1" Color="49,130,239" Legend="Legend1" LegendText="Pre Utl%"
                                        IsValueShownAsLabel="True" Font="Microsoft Sans Serif, 6.5pt" 
                                        ChartArea="ChartArea1"
                                        CustomProperties="DrawingStyle=Cylinder"> //histogrtam's style
                                    </asp:Series>
                                    <asp:Series Name="Series2" Color="255,174,49" Legend="Legend2" LegendText="Utl%" 
                                        IsValueShownAsLabel="True" ChartArea="ChartArea1" 
                                        Font="Microsoft Sans Serif, 6.5pt"
                                        CustomProperties="DrawingStyle=Cylinder">
                                      
                                    </asp:Series>
                                </Series>
                                   
                                <ChartAreas> //inner chart
                                     <asp:ChartArea Name="ChartArea1" BackColor="OldLace"  //inner chart's color
                                        BorderColor="64, 64, 64, 64" ShadowColor="Transparent" 
                                        BackGradientStyle="TopBottom" BackSecondaryColor="White">
                                        <AxisY IsLabelAutoFit="True" LineColor="64, 64, 64, 64">
                                            <MajorGrid LineColor="64, 64, 64, 64" />
                                            <LabelStyle Font="Verdana, 10pt" />
                                            <ScaleBreakStyle LineColor="Transparent" />
                                        </AxisY>// axis y
                                        <AxisX IsLabelAutoFit="False" LabelAutoFitMaxFontSize="8" 
                                            LabelAutoFitMinFontSize="5" LineColor="64, 64, 64, 64">
                                            
                                            <MajorGrid LineColor="64, 64, 64, 64" />
                                            <LabelStyle Font="Verdana, 8pt"  Interval="1" 
                                                IntervalOffset="Auto" IntervalOffsetType="Auto" IntervalType="Number" 
                                                IsStaggered="True"/>
                                            <ScaleBreakStyle LineColor="Transparent" />
                                        </AxisX> // axis x
                                        <AxisX2 IsLabelAutoFit="False">
                                            <MajorGrid Enabled="False" />
                                            <MajorTickMark Enabled="False" /> // cursor
                                            <LabelStyle Font="Microsoft Sans Serif, 5pt" />
                                        </AxisX2>
                                        <Position Height="77.16558" Width="89.43796" X="4.82481766" Y="16.0208549" /> //chart position
                                        <InnerPlotPosition Height="86.9832" Width="90.5838" X="7.0000" Y="1.40178" /> //chart inner position
                                        <Area3DStyle LightStyle="Realistic" WallWidth="2" />
                                    </asp:ChartArea>
                                </ChartAreas>
                            </asp:Chart>  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值