private Dictionary<string, double> chartPieDataDic = new Dictionary<string, double>();
private Dictionary<string, double> chartBarDataDic = new Dictionary<string, double>();
private void showPie()
{
ChartTitle title = new ChartTitle();
title.Text = "全省话务分析饼图-话务类型分布";

chartControl1.Titles.Clear();
chartControl1.Titles.Add(title);

Series series1 = new Series("话务类型", ViewType.Pie);
((PiePointOptions)series1.PointOptions).PointView = PointView.ArgumentAndValues;

foreach (KeyValuePair<string, double> keyvalue in chartPieDataDic)
{
series1.Points.Add(new SeriesPoint(keyvalue.Key, new double[] { keyvalue.Value }));
}

chartControl1.Series.Clear();
chartControl1.Series.Add(series1);
}
private void InitPieChartData()
{
try
{
chartPieDataDic.Add("大连", 0.2);
chartPieDataDic.Add("沈阳", 0.26);
chartPieDataDic.Add("锦州", 0.15);
chartPieDataDic.Add("盘锦", 0.15);
chartPieDataDic.Add("本溪", 0.1);
chartPieDataDic.Add("抚顺", 0.12);
chartPieDataDic.Add("营口", 0.02);
}
catch { }
}
private void InitBarChartData()
{
try
{
chartBarDataDic.Add("2001", 0.05);
chartBarDataDic.Add("2002", 0.02);
chartBarDataDic.Add("2003", 0.08);
chartBarDataDic.Add("2004", 0.15);
chartBarDataDic.Add("2005", 0.1);
chartBarDataDic.Add("2006", 0.3);
chartBarDataDic.Add("2007", 0.2);
chartBarDataDic.Add("2008", 0.1);
}
catch { }
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.Text.IndexOf("饼图") != -1)
{
showPie();
}
else if (comboBox1.Text.IndexOf("柱图") != -1)
{
showBar();
}
else if (comboBox1.Text.IndexOf("线图") != -1)
{
showLine();
}
else if (comboBox1.Text.IndexOf("点图") != -1)
{
showPoint();
}
else if (comboBox1.Text.IndexOf("ViewType") != -1)
{
BindData(ViewType.Line);
}
}
private void showBar()
{
try
{
ChartTitle title = new ChartTitle();
title.Text = "市网元容量增长率统计分析柱图";

chartControl1.Titles.Clear();
chartControl1.Titles.Add(title);

Series series2 = new Series("大连", ViewType.Bar);
Series series3 = new Series("沈阳", ViewType.Bar);
Series series4 = new Series("本溪", ViewType.Bar);
foreach (KeyValuePair<string, double> kvp in chartBarDataDic)
{
series2.Points.Add(new SeriesPoint(kvp.Key, new double[] { kvp.Value }));
series3.Points.Add(new SeriesPoint(kvp.Key, new double[] { kvp.Value + 0.08 }));
series4.Points.Add(new SeriesPoint(kvp.Key, new double[] { kvp.Value + 0.02 }));
}

chartControl1.Series.Clear();
chartControl1.Series.Add(series2);
chartControl1.Series.Add(series3);
chartControl1.Series.Add(series4);

chartControl1.Legend.Visible = true; // 显示标签(旁边的标注哪个颜色代表哪个城市)
}
catch { }
}
private void showLine()
{
ChartTitle title = new ChartTitle();
title.Text = "线图";
chartControl1.Titles.Clear();
chartControl1.Titles.Add(title);

Series series1 = new Series("辽宁", ViewType.Line);
series1.ArgumentScaleType = ScaleType.Numerical;

series1.Points.Add(new SeriesPoint(1, new double[] { 10 }));
series1.Points.Add(new SeriesPoint(2, new double[] { 12 }));
series1.Points.Add(new SeriesPoint(3, new double[] { 14 }));
series1.Points.Add(new SeriesPoint(4, new double[] { 17 }));
series1.Points.Add(new SeriesPoint(5, new double[] { 21 }));
series1.Points.Add(new SeriesPoint(6, new double[] { 26 }));
series1.Points.Add(new SeriesPoint(7, new double[] { 29 }));
series1.Points.Add(new SeriesPoint(8, new double[] { 30 }));

((PointSeriesView)series1.View).PointMarkerOptions.Kind = MarkerKind.Triangle;

Series series2 = new Series("山东", ViewType.Line);
series2.ArgumentScaleType = ScaleType.Numerical; //这句话必须有,否则点画不出来.
((LineSeriesView)series2.View).LineStyle.DashStyle = DashStyle.DashDotDot;
series2.Points.Add(new SeriesPoint(1, new double[] { 4 }));
series2.Points.Add(new SeriesPoint(2, new double[] { 14 }));
series2.Points.Add(new SeriesPoint(3, new double[] { 17 }));
series2.Points.Add(new SeriesPoint(4, new double[] { 22 }));
series2.Points.Add(new SeriesPoint(5, new double[] { 20 }));
series2.Points.Add(new SeriesPoint(6, new double[] { 15 }));
series2.Points.Add(new SeriesPoint(7, new double[] { 18 }));
series2.Points.Add(new SeriesPoint(8, new double[] { 11 }));

((PointSeriesView)series2.View).PointMarkerOptions.Kind = MarkerKind.Cross;

chartControl1.Series.Clear();
chartControl1.Series.Add(series1);
chartControl1.Series.Add(series2);
chartControl1.Legend.Visible = true;
}
private void showPoint()
{
ChartTitle title = new ChartTitle();
title.Text = "点图";
chartControl1.Titles.Clear();
chartControl1.Titles.Add(title);

Series series1 = new Series("上线人数", ViewType.Point);
series1.ArgumentScaleType = ScaleType.Numerical;

series1.Points.Add(new SeriesPoint(1, new double[] { 20 }));
series1.Points.Add(new SeriesPoint(2, new double[] { 12 }));
series1.Points.Add(new SeriesPoint(3, new double[] { 11 }));
series1.Points.Add(new SeriesPoint(4, new double[] { 17 }));
series1.Points.Add(new SeriesPoint(5, new double[] { 21 }));
series1.Points.Add(new SeriesPoint(6, new double[] { 21 }));
series1.Points.Add(new SeriesPoint(7, new double[] { 29 }));
series1.Points.Add(new SeriesPoint(8, new double[] { 30 }));

((PointSeriesView)series1.View).PointMarkerOptions.Kind = MarkerKind.Triangle;

Series series2 = new Series("下线人数", ViewType.Point);
series2.ArgumentScaleType = ScaleType.Numerical; //这句话必须有,否则点画不出来.

series2.Points.Add(new SeriesPoint(1, new double[] { 4 }));
series2.Points.Add(new SeriesPoint(2, new double[] { 14 }));
series2.Points.Add(new SeriesPoint(3, new double[] { 17 }));
series2.Points.Add(new SeriesPoint(4, new double[] { 22 }));
series2.Points.Add(new SeriesPoint(5, new double[] { 20 }));
series2.Points.Add(new SeriesPoint(6, new double[] { 15 }));
series2.Points.Add(new SeriesPoint(7, new double[] { 18 }));
series2.Points.Add(new SeriesPoint(8, new double[] { 11 }));

((PointSeriesView)series2.View).PointMarkerOptions.Kind = MarkerKind.Cross;

chartControl1.Series.Clear();
chartControl1.Series.Add(series1);
chartControl1.Series.Add(series2);
chartControl1.Legend.Visible = true;
}

DevExpress.XtraCharts.chartControl的更多相关文章

  1. 张奎师弟参与devexpress chartControl绘图--解决了devexpress的chartControl控件不能添加系列的问题

    using DevExpress.XtraCharts; using System; using System.Collections.Generic; using System.ComponentM ...

  2. DevExpress中chartControl中实现统计图功能

    public partial class Form1 : DevExpress.XtraEditors.XtraForm { public Form1() { InitializeComponent( ...

  3. DevExpress之ChartControl实现时间轴实例 z

    using System; using System.Data; using System.Windows.Forms; using DevExpress.XtraCharts; namespace ...

  4. DevExpress之ChartControl用法

    DevExpress中的ChartControl顾名思义就是数据基于图表展示,其关键在于Series上的处理. using System; using System.Drawing; using De ...

  5. 【原】为DevExpress的ChartControl添加Y轴控制 和 GridControl中指定列添加超级链接

    一.控制ChartControl的Y轴范围 使用Devexpress中的CharControl控件,需要控制AxisY轴的显示范围,需要使用该控件的BoundDataChanged事件,具体代码如下: ...

  6. devexpress中用ChartControl生成柱状图

    在界面中拖入一个ChartControl控件,然后添加一个simplebutton控件.在simplebutton控件的click事件中加入如下代码: private void button1_Cli ...

  7. DevExpress中ChartControl柱状图(Bar)用法

    我的数据 代码如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 chartControl1.Series.Clear(); ...

  8. devexpress 之 ChartControl

    \}5#~mV#cr(/k1yIZ7.Lg

  9. DevExpress.XtraCharts曲线上的点所对应的坐标值

    private void chartControl_ObjectSelected(object sender, HotTrackEventArgs e) { e.Cancel = false; XYD ...

随机推荐

  1. 你真的用上keepalive了吗

    转自http://qa.blog.163.com/blog/static/19014700220134771052763/ Keep-Alive即俗称的长连接,使客户端到服务端建立的连接持续有效,当对 ...

  2. [转]ArcGIS移动客户端离线地图的几种解决方案

    原文地址:http://blog.chinaunix.net/uid-10914615-id-3023158.html 移动GIS中,通常将数据分为两大类:basemap layer和operatio ...

  3. Linux id 命令 - 显示用户id和组id信息

    要登入一台计算机,我们需要一个用户名.用户名是一个可以被计算机识别的身份.基于此,计算机会对使用这个用户名的登陆的人应用一系列的规则.在Linux系统下,我们可以使用 id 命令. 什么是 id 命令 ...

  4. iOS 监听 出发 Home键 NSNotificationCenter UIApplicationWillResignActiveNotification

    第一步: 创建2个NSNotificationCenter监听 [[NSNotificationCenter defaultCenter] addObserver:self selector:@sel ...

  5. 微信朋友圈分享js代码最新2015年无错版

    最近微信对分享做了进一步规范,导致很多分享都不起作用了,今天跟大家分享,2015年最新修无错的! 以下是主要微信分享页面代码:(其中红色部分主要懒友自己填写自己哈.) <?php require ...

  6. Map集合重要练习

    重要练习:将字符串中的字母按如下格式显示: a(1)b(2)...... 代码及思路如下: /* 获取字符串中字母的次数,并打印出如下格式a(1)b(2)c(3)...... 思路: 先定义一个方法, ...

  7. struts2 s:if 的字符串比较问题

    如果数据库字段的数据类型为string or  char 类型,此时在页面 <s:if test=""></s:if> 中test <s:iterat ...

  8. JavaScript之cookie

    JavaScript通过Cookie实现简单的用户登录状态的保存.Cookie可以跨越多个网页使用,但不能跨域名使用,也不同跨浏览器使用. 1.设置cookie function SetCookie( ...

  9. Android EditText 取消复制粘贴功能,取消横向全屏编辑功能(一)

    在做一些安全性的软件时候常常要考虑取消 EditText 上的复制粘贴功能以确保安全性.下面就记录了这个方法: 首先在API-11以下的版本很简单,只需要在Xml布局文件或者用代码把长按属性设置成fa ...

  10. Oracle触发器trigger3利用时间限制用户输入

    --触发器的应用限制用户写入 --具体功能:在写入一个表之前,限制必须要在周一到周5和工作时间8:00~18:00 create or replace trigger tri3 before inse ...