zoukankan      html  css  js  c++  java
  • msChart控件 柱状图 Y主轴Y副轴

    经常遇见数据统计图,要求有Y副轴,统计图如下:

    MSCHART源代码

    MSCHART源代码
     1  <asp:Chart ID="Chart1" runat="server" Width="700px" Height="300px">
     2             <Series>
     3                 <asp:Series Name="Series1" ChartType="Column" BorderWidth="1" ShadowOffset="1" IsValueShownAsLabel="true"
     4                     IsVisibleInLegend="true" MarkerStyle="Circle">
     5                 </asp:Series>
     6                 <asp:Series Name="Series2" ChartType="Column" BorderWidth="1" ShadowOffset="1" IsValueShownAsLabel="true"
     7                     IsVisibleInLegend="false">
     8                 </asp:Series>
     9             </Series>
    10             <ChartAreas>
    11                 <asp:ChartArea Name="ChartArea1">
    12                     <AxisY LineColor="64,64,64,64" IsLabelAutoFit="false">
    13                         <LabelStyle />
    14                         <MajorGrid LineColor="64,64,64,64" />
    15                     </AxisY>
    16                     <AxisY2 LineColor="64,64,64,64" IsLabelAutoFit="false">
    17                         <LabelStyle />
    18                         <MajorGrid LineColor="64,64,64,64" />
    19                     </AxisY2>
    20                 </asp:ChartArea>
    21             </ChartAreas>
    22         </asp:Chart>

    后台代码:

    后台代码
     1  this.Chart1.DataSource = dt;
     2         this.Chart1.Series[0].YAxisType = System.Web.UI.DataVisualization.Charting.AxisType.Primary;
     3         this.Chart1.Series[0].XAxisType = System.Web.UI.DataVisualization.Charting.AxisType.Primary;
     4         this.Chart1.Series[0].XValueMember = "supplyname";
     5         this.Chart1.Series[0].YValueMembers = "cgsumprice";
     6         this.Chart1.Series[0]["PointWidth"] = "0.2";
     7         this.Chart1.Series[1]["PointWidth"] = "0.2";
     8         this.Chart1.Series[0]["DrawingStyle"] = "Cylinder";
     9         this.Chart1.Series[1]["DrawingStyle"] = "Cylinder";
    10         this.Chart1.ChartAreas[0].AxisY.Title = "采购金额(元)";
    11         this.Chart1.ChartAreas[0].AxisY2.Title = "交易次数(次)";
    12         this.Chart1.Series[1].XAxisType = System.Web.UI.DataVisualization.Charting.AxisType.Primary;
    13         this.Chart1.Series[1].YAxisType = System.Web.UI.DataVisualization.Charting.AxisType.Secondary;
    14         this.Chart1.Series[1].YValueMembers = "jylcount";
    15         this.Chart1.DataBind();
  • 相关阅读:
    新家开始了
    FreeMarker过时的方法 new Configuration()
    基于Spring封装的Javamail实现邮件发送
    Spring中PropertiesLoaderUtils应用
    SpringBoot基于数据库的定时任务统一管理
    ActiveMQ点对点模式
    springboot整合swagger2
    dubbo简单示例
    SpringCLoud之搭建Zuul网关集群
    微服务项目框架搭建
  • 原文地址:https://www.cnblogs.com/hfliyi/p/2821200.html
Copyright © 2011-2022 走看看