protected void SearchChart()
{
Chart1.ChartAreas.Clear();
Chart1.Series.Clear(); ChartArea _ChartArea = null;
Series _SeriesJRATE = null;
Series _SeriesDRATE = null;
Series _SeriesDCL = null; #region 循环添加 ChartArea
_ChartArea = new ChartArea();
//主X轴样式设置
_ChartArea.AxisX.MajorGrid.LineColor = System.Drawing.Color.FromArgb(, , ); //主X轴主网格线颜色
_ChartArea.AxisX.MajorGrid.LineDashStyle = ChartDashStyle.Dash;//主X轴主网格线虚线
_ChartArea.Position.Auto = true;
_ChartArea.Name = "ChartName";//设定ChartName
_ChartArea.AxisX.Title = "";//主X轴坐标标题
_ChartArea.AxisX.TitleAlignment = StringAlignment.Far;//主X轴坐标标题位置
_ChartArea.AxisX.Interval = ;//间隔
_ChartArea.AxisX.IntervalType = DateTimeIntervalType.Number;//间隔类型指定
//_ChartArea.AxisX.LabelStyle
//主Y轴样式设置
_ChartArea.AxisY.Title = "Commit";
_ChartArea.AxisY.TitleAlignment = StringAlignment.Far;
_ChartArea.AxisY.MajorGrid.LineColor = System.Drawing.Color.FromArgb(, , );
_ChartArea.AxisY.MajorGrid.LineDashStyle = ChartDashStyle.Dash;
//副Y轴样式设置
_ChartArea.AxisY2.Title = "达成率";
_ChartArea.AxisY2.TitleAlignment = StringAlignment.Near;
_ChartArea.AxisY2.MajorGrid.LineColor = System.Drawing.Color.FromArgb(, , );
_ChartArea.AxisY2.MajorGrid.LineDashStyle = ChartDashStyle.Dash; //_ChartArea.AxisX.LabelStyle.Interval = 1; //X文本间隔
//_ChartArea.AxisX.LabelStyle.Font = new System.Drawing.Font("隶书", 12);
//_ChartArea.AxisX.MajorGrid.Interval = 1; //X主要辅助线间隔
//_ChartArea.AxisX.MinorGrid.Interval = 1;//X次要辅助线间隔
//_ChartArea.AxisX.MinorTickMark.Interval = 1;//X次要刻度线间隔
//_ChartArea.AxisX.MajorTickMark.Interval = 1;//X主要刻度线间隔
//_ChartArea.AxisY.MinorGrid.Interval = 1;//Y次要辅助线间隔
//_ChartArea.AxisY.MajorGrid.Interval = 5;//Y主要辅助线间隔
//_ChartArea.AxisY.LabelStyle.Interval = 0.5;
Chart1.ChartAreas.Add(_ChartArea); System.Drawing.Font F=new Font("宋体",);
Title title = new Title("过程总体统计", Docking.Top,F,Color.Black);
Chart1.Titles.Add(title);
title.DockedToChartArea = _ChartArea.Name;
title.IsDockedInsideChartArea = false;
title.Alignment = ContentAlignment.TopCenter; _SeriesJRATE = new Series();
_SeriesJRATE.ChartType = SeriesChartType.Column;
_SeriesJRATE.Name = "Commit";
_SeriesJRATE.ChartArea = _ChartArea.Name;
//_SeriesJRATE.BorderColor = System.Drawing.Color.Blue;
_SeriesJRATE.Color = Color.Blue;
_SeriesJRATE.BorderWidth = ;
_SeriesJRATE.ShadowOffset = ;
_SeriesJRATE.IsValueShownAsLabel = true;
_SeriesJRATE.MarkerStyle = MarkerStyle.Triangle;
_SeriesJRATE.LegendText = "Commit";
_SeriesJRATE.YAxisType = AxisType.Primary;//设为主Y轴
Chart1.Series.Add(_SeriesJRATE); //加入Series _SeriesDRATE = new Series();
_SeriesDRATE.ChartType = SeriesChartType.Column;
_SeriesDRATE.Name = "AvgDate";
_SeriesDRATE.ChartArea = _ChartArea.Name;
//_SeriesDRATE.BorderColor = System.Drawing.Color.Green;
_SeriesDRATE.Color = Color.Green;
_SeriesDRATE.BorderWidth = ;
_SeriesDRATE.ShadowOffset = ;
_SeriesDRATE.IsValueShownAsLabel = true;
_SeriesDRATE.MarkerStyle = MarkerStyle.Square;
_SeriesDRATE.LegendText = "平均工作日";
_SeriesDRATE.XAxisType = AxisType.Primary;//设为主X轴
Chart1.Series.Add(_SeriesDRATE); //加入Series _SeriesDCL = new Series();
_SeriesDCL.ChartType = SeriesChartType.Spline;
_SeriesDCL.Name = "Rate";
_SeriesDCL.ChartArea = _ChartArea.Name;
//_SeriesDRATE.BorderColor = System.Drawing.Color.Green;
_SeriesDCL.Color = Color.Yellow;
_SeriesDCL.BorderWidth = ;
_SeriesDCL.ShadowOffset = ;
_SeriesDCL.IsValueShownAsLabel = true;
_SeriesDCL.MarkerStyle = MarkerStyle.Square;
_SeriesDCL.LegendText = "达成率";
_SeriesDCL.YAxisType = AxisType.Secondary;//设为副Y轴
Chart1.Series.Add(_SeriesDCL); //加入Series
#endregion Chart1.Legends[].Docking = Docking.Top;
Chart1.Legends[].DockedToChartArea = "ChartName";
Chart1.Legends[].Alignment = StringAlignment.Center;
Chart1.Legends[].IsDockedInsideChartArea = false; //1 序号,'一月' 月份,15.00 Commit,9.69 平均工作日,92.98 达成率
DataTable dtChart = this.Getdt();
if (dtChart != null && dtChart.Rows.Count > )
{
for (int j = ; j < dtChart.Rows.Count; j++)
{
string YF = dtChart.Rows[j]["月份"].ToString();
double dC = double.Parse(dtChart.Rows[j]["Commit"].ToString());
double dA = double.Parse(dtChart.Rows[j]["平均工作日"].ToString());
double dD = double.Parse(dtChart.Rows[j]["达成率"].ToString()); Chart1.Series["Commit"].Points.AddXY(YF, dC);
Chart1.Series["AvgDate"].Points.AddXY(YF, dA);
Chart1.Series["Rate"].Points.AddXY(YF, dD);
}
}
} protected DataTable Getdt()
{
StringBuilder sb = new StringBuilder();
sb.Append(@"select 1 序号,'一月' 月份,15.00 Commit,9.69 平均工作日,92.98 达成率 from dual
union
select 2 序号,'二月' 月份,15.00 Commit,11.69 平均工作日,86.62 达成率 from dual
union
select 3 序号,'三月' 月份,15.00 Commit,9.77 平均工作日,95.71 达成率 from dual
union
select 4 序号,'四月' 月份,15.00 Commit,10.53 平均工作日,90.06 达成率 from dual
union
select 5 序号,'五月' 月份,15.00 Commit,12.17 平均工作日,90.06 达成率 from dual
union
select 6 序号,'六月' 月份,15.00 Commit,10.14 平均工作日,100.00 达成率 from dual
union
select 7 序号,'七月' 月份,15.00 Commit,0.00 平均工作日,0.00 达成率 from dual
union
select 8 序号,'八月' 月份,15.00 Commit,0.00 平均工作日,0.00 达成率 from dual
union
select 9 序号,'九月' 月份,15.00 Commit,0.00 平均工作日,0.00 达成率 from dual
union
select 10 序号,'十月' 月份,15.00 Commit,0.00 平均工作日,0.00 达成率 from dual
union
select 11 序号,'十一月' 月份,15.00 Commit,0.00 平均工作日,0.00 达成率 from dual
union
select 12 序号,'十二月' 月份,15.00 Commit,0.00 平均工作日,0.00 达成率 from dual
union
select 13 序号,'平均值' 月份,15.00 Commit,9.14 平均工作日,93.85 达成率 from dual ");
DataSet ds = OraHelper.GetDateDS(sb.ToString()); if (ds != null && ds.Tables.Count > )
{
DataTable dtChart = ds.Tables[];
return dtChart;
}
else return null;
}

MSChart使用之双Y轴使用:效果如图:

MSChart使用之双Y轴使用的更多相关文章

  1. highchart 设置双Y轴坐标 双x轴坐标方法

    我们的图表一旦引入了两种不同单位或者数量级相差很大的数据以后,这时候需要两种坐标对其进行计量. 下面以设置双Y轴为例, y轴坐标的参数设置成: yAxis: [{ title: { text: '坐标 ...

  2. 绘制复数图形和双y轴图形

    clearclct=0:0.1:2*pi;x=sin(t);y=cos(t);z=x+i*y;subplot(1,3,1)plot(t,z,'r') %注:这种方式下,不论参数t,z哪个是复数,都将忽 ...

  3. Jqplot使用总结之二(双Y轴)

    最近需要用Jqplot做双Y轴的Chart图,首先我找到了文档上的例子并对数据做了一些调整: 1.例子展示: var s1 = [["2002-01-01", 112000], [ ...

  4. echarts使用笔记四:双Y轴

    1.双Y轴显示数量和占比 app.title = '坐标轴刻度与标签对齐'; option = { title : { //标题 x : 'center', y : 5, text : '数量和占比图 ...

  5. Python科学计算技巧积累四——双y轴图像绘制

    双y轴图像具有单y轴图像没有的对比效果,在MATLAB中有plotyy函数可以实现,Python的实现方式没有MATLAB那样方便,不过实现效果却也不见得差. 以往我常用的绘图命令是import ma ...

  6. 【Python】matplotlib 双y轴绘制及合并图例

    1.双y轴绘制 关键函数:twinx() 问题在于此时图例会有两个. # -*- coding: utf-8 -*- import numpy as np import matplotlib.pypl ...

  7. matlab画二维直方图以及双y轴坐标如何修改另一边y轴的颜色

    1.首先讲一下如何用hist画二维直方图 x=[- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ...

  8. Python教程:matplotlib 绘制双Y轴曲线图

    前言 本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 作者:数据皮皮侠 双X轴的可以理解为共享y轴 ax1=ax.twiny() ...

  9. Python实现双X轴双Y轴绘图

    诈尸人口回归.这一年忙着灌水忙到头都掉了,最近在女朋友的提醒下终于想起来博客的账号密码,正好今天灌水的时候需要画一个双X轴双Y轴的图,研究了两小时终于用Py实现了.找资料的过程中没有发现有系统的文章, ...

随机推荐

  1. BZOJ 1032 祖玛

    Description 这是一个流行在Jsoi的游戏,名称为祖玛.精致细腻的背景,外加神秘的印加音乐衬托,彷佛置身在古老的国度里面,进行一个神秘的游戏——这就是著名的祖玛游戏.祖玛游戏的主角是一只石青 ...

  2. 【转】SharePoint 2013 stand alone服务器安装

    原文地址:http://www.cnblogs.com/jianyus/archive/2013/02/01/2889653.html  介绍:文章就是SharePoint2013安装过程的图解,包括 ...

  3. cf C. Arithmetic Progression

    http://codeforces.com/contest/382/problem/C 题意:给你n个数,然后让你添加一个数使得n+1个数能形成这样的规律,a[1]-a[0]=a[2]-a[1]=a[ ...

  4. ORACLE和MONGODB,必须也得进入。

    先在WIN下面操作一下. 参考的是<MONGODB权威指南>

  5. 程序员面试宝典题目重温-P1-100

    int f(int x ,int y){    return (x&y) + ((x^y)>>1)} f(729,271)输出是什么? x&y表示按位与,结果是x,y相同位 ...

  6. Light OJ 1021 - Painful Bases(状态压缩DP)

    题目大意: 给你一个base 进制的数字,把这个数字的每一位进行全排列,问有多少个数字是可以整除k的. 题目解析: #include<cstdio> #include<cstring ...

  7. HDOJ(HDU) 2136 Largest prime factor(素数筛选)

    Problem Description Everybody knows any number can be combined by the prime number. Now, your task i ...

  8. HDOJ 2188 悼念512汶川大地震遇难同胞——选拔志愿者

    Problem Description 对于四川同胞遭受的灾难,全国人民纷纷伸出援助之手,几乎每个省市都派出了大量的救援人员,这其中包括抢险救灾的武警部队,治疗和防疫的医护人员,以及进行心理疏导的心理 ...

  9. lightoj 1063 求割点

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1063 #include<cstdio> #include<cstri ...

  10. JavaScript中的[]和{}

    最早开始对js中括号的使用有疑问是在交互2值的时候: a = [b,b=a][0]; 详见JavaScript交换两个变量值的七种解决方案 因为 [[]][0] 的意思是:获取 [[]] 的第一个元素 ...