https://documentation.devexpress.com/#WindowsForms/CustomDocument8117

添加折线图(柱状图)

拖动ChartControl到Form上

在Series Collection中添加Line(或Bar)

DevExpress.XtraCharts.Series series1 = new DevExpress.XtraCharts.Series();
DevExpress.XtraCharts.LineSeriesView lineSeriesView1 = new DevExpress.XtraCharts.LineSeriesView(); series1.View = lineSeriesView1;
   this.chartControl1.SeriesSerializable = new DevExpress.XtraCharts.Series[] {
series1,
series2,
series3,
series4};

Legend

位置

AlignmentHorizontal  设置为Center

AlignmentVertical 设置为BottomOutside

Direction  设置为LeftToRight

  this.chartControl1.Legend.AlignmentHorizontal = DevExpress.XtraCharts.LegendAlignmentHorizontal.Center;
this.chartControl1.Legend.AlignmentVertical = DevExpress.XtraCharts.LegendAlignmentVertical.BottomOutside;
this.chartControl1.Legend.Direction = DevExpress.XtraCharts.LegendDirection.LeftToRight;

可见性

直接在界面上选中Legend,设置Visibility

曲线上的点显示

设置Marker Visibility

  series1.LegendText = "空调用电";
series1.Name = "Series 1";
lineSeriesView1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True;

调整: 可以直接设置series1.Name = "空调用电"; 这样的话,鼠标在悬浮的时候,显示某一列的数据时,对应曲线名字可以对应上。无需设置LegendText

坐标轴

https://documentation.devexpress.com/#WindowsForms/CustomDocument5779

坐标轴标题

DevExpress.XtraCharts.XYDiagram xyDiagram1 = new DevExpress.XtraCharts.XYDiagram();

xyDiagram1.AxisX.Title.Text = "时间";
xyDiagram1.AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.True;
xyDiagram1.AxisX.VisibleInPanesSerializable = "-1";
xyDiagram1.AxisY.Title.Text = "用电量(KW·h)";
xyDiagram1.AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True;
xyDiagram1.AxisY.VisibleInPanesSerializable = "-1";
this.chartControl1.Diagram = xyDiagram1;

坐标轴类型

https://documentation.devexpress.com/#WindowsForms/CustomDocument5799

首先设置曲线的ArgumentScaleType 【横轴是argument,纵轴是value】

series1.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.DateTime;

设置好之后,坐标轴那边会自动出现DateTimeScaleOptions的属性

横轴自定义(同比,环比)  series1.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative;

坐标轴范围

https://documentation.devexpress.com/#WindowsForms/CustomDocument5803

Visual Ranges and Whole Ranges

坐标轴的滑动

            xyDiagram1.EnableAxisXScrolling = true;
xyDiagram1.EnableAxisYScrolling = true;
            xyDiagram1.AxisY.VisualRange.Auto = false;
xyDiagram1.AxisY.VisualRange.MaxValueSerializable = "10";
xyDiagram1.AxisY.VisualRange.MinValueSerializable = "0";
xyDiagram1.AxisY.WholeRange.Auto = false;
xyDiagram1.AxisY.WholeRange.MaxValueSerializable = "100";
xyDiagram1.AxisY.WholeRange.MinValueSerializable = "0";

Visual Range的范围小于WholeRange的范围确保了有滑动的可能

获取坐标轴

XYDiagram diagram = chart.Diagram as XYDiagram;
if (diagram != null) {
diagram.AxisY.Title.Text = "Population mid-year, millions";
}

图表的标题

Titles处add一个

            DevExpress.XtraCharts.ChartTitle chartTitle1 = new DevExpress.XtraCharts.ChartTitle();

            chartTitle1.Text = "图表标题";
this.chartControl1.Titles.AddRange(new DevExpress.XtraCharts.ChartTitle[] {
chartTitle1});

柱状图

设置柱子

选中Series,展开,选中Points,设置Data中的Argument和Value

设置数值显示的位置

case "Top":
label.Position = BarSeriesLabelPosition.Top;

设置柱子的颜色

每一个柱子的颜色不同:   只需要在run designer界面,设置ColorEach就会自动生成如下代码

DevExpress.XtraCharts.SideBySideBarSeriesView sideBySideBarSeriesView1 = new DevExpress.XtraCharts.SideBySideBarSeriesView();

sideBySideBarSeriesView1.ColorEach = true;

series1.View = sideBySideBarSeriesView1;

动态设置柱状图横轴上的点

chartControl1.Series[0].Points[0].Argument = dateTime.ToString($"yyyy年第{week}周");
chartControl1.Series[0].Points[1].Argument = dateTime.AddDays(-7).ToString($"yyyy年第{week1}周");

==========================================

关于刻度

https://documentation.devexpress.com/#WindowsForms/CustomDocument18209

Tickmarks are dashes of different sizes and shapes that mark scale values with the specific step.

There are two types of tickmarks - major tickmarks that are able to display related scale values and minor tickmarks,

which are dashes of a smaller size without text, located between two neighboring major tickmarks (see the figure below).

To specify the number of tickmarks, use the ArcScale.MajorTickCount and ArcScale.MinorTickCount properties (the LinearScale.MajorTickCount and LinearScale.MinorTickCount properties for linear scales).

MajorTickCount 控制从头到尾的大刻度的数量,假如范围从-20到40。要六等分,那么大刻度的数量是60/6+1=7

MinorTickCount 控制两个大刻度之间小刻度的数量,,假如小刻度的单位是1的话。那么小刻度的数量是10/1-1=9

Just like many other gauge elements, tickmarks can be painted using a specific brush object, assigned to the related properties within the ArcScaleComponent.AppearanceMajorTickmark(LinearScaleComponent.AppearanceMajorTickmark) and ArcScaleComponent.AppearanceMinorTickmark (LinearScaleComponent.AppearanceMinorTickmark) property sections.

Scales have two sets of properties that manage tickmarks of each type - the ArcScale.MajorTickmark and ArcScale.MinorTickmark properties

(the LinearScale.MajorTickmark and LinearScale.MinorTickmark properties for linear scales). These sections provide access to such properties as:

ChartControl 折线图 柱状图的更多相关文章

  1. v-charts 绘制柱状图、条形图、水球图、雷达图、折线图+柱状图,附官网地址

    v-charts 官网地址:https://v-charts.js.org/#/ 柱状图: <template> <ve-histogram :data="chartDat ...

  2. 百度推出的echarts,制表折线图柱状图饼图等的超级工具(转)

    一.简介: 1.绘制数据图表,有了它,想要网页上绘制个折线图.柱状图,从此easy. 2.使用这个百度的echarts.js插件,是通过把图片绘制在canvas上在显示在页面上. 官网对echarts ...

  3. 06. Matplotlib 2 |折线图| 柱状图| 堆叠图| 面积图| 填图| 饼图| 直方图| 散点图| 极坐标| 图箱型图

    1.基本图表绘制 plt.plot() 图表类别:线形图.柱状图.密度图,以横纵坐标两个维度为主同时可延展出多种其他图表样式 plt.plot(kind='line', ax=None, figsiz ...

  4. OpenGL——折线图柱状图饼图绘制

    折线图绘制代码: #include<iostream> //旧版本 固定管线 #include<Windows.h> #include <GL/glut.h> // ...

  5. G2 基本使用 折线图 柱状图 饼图 基本配置

    G2的基本使用 1.浏览器引入  <!-- 引入在线资源 --> <script src="https://gw.alipayobjects.com/os/lib/antv ...

  6. echarts双y轴折线图柱状图混合实时更新图

    先看下效果,自己用ps做了张gif图,发现很好玩啊..不喜勿喷 自己下载个echarts.min.js 直接上代码: <!DOCTYPE html><html><head ...

  7. echarts折线图柱状图的坐标轴的颜色及样式的设置

    基本用法请查看echarts官网. 一.图例legend的设置. 1.字体和颜色的设置 textStyle:{ fontSize:15, color:'#fff' } 2.样式的设置 legend: ...

  8. JavaScript数据可视化编程学习(一)Flotr2,包含简单的,柱状图,折线图,饼图,散点图

    一.基础柱状图 二.基础的折线图 三.基础的饼图 四.基础的散点图 一.基础柱状图 如果你还没有想好你的数据用什么类型的图表来展示你的数据,你应该首先考虑是否可以做成柱状图.柱状图可以表示数据的变化过 ...

  9. Qt数据可视化(散点图、折线图、柱状图、盒须图、饼状图、雷达图)开发实例

    ​  目录 散点图 折线图 柱状图 水平柱状图 水平堆叠图 水平百分比柱状图 盒须图 饼状图 雷达图 Qt散点图.折线图.柱状图.盒须图.饼状图.雷达图开发实例. 在开发过程中我们会使用多各种各样的图 ...

随机推荐

  1. Mini ORM——PetaPoco笔记

    Mini ORM--PetaPoco笔记 记录一下petapoco官网博客的一些要点.这些博客记录了PetaPoco是如何一步步改进的. 目录: Announcing PetaPoco PetaPoc ...

  2. python_编程规范

    缩进 4个"空格"作为一个缩进层次,永远不要使用"制表位" 空格 运算符两边放置一个空格 命名  模块名:模块应该是不含下画线的.简短的.小写的名字.  类名: ...

  3. UE4入门与精通

    由于目前在使用UE4引擎,多少也有一些心得,比如在日常使用中会遇到一些问题.坑(潜规则)或者一些使用技巧等.本人决定开一个大坑,主要有两个目的:一是可以自己做个记录,二是可以给大家提供一些参考吧.主要 ...

  4. 分布式集群搭建(hadoop2.6.0+CentOS6.5)

    摘要:之前安装过hadoop1.2.1集群,发现比较老了,后来安装cloudera(hadoop2.6.0),发现集成度比较高,想知道原生的hadoop什么样子,于是着手搭建一个伪分布式集群(三台), ...

  5. jQuery工具方法

    目录 常用工具方法 判断数据类型的方法 Ajax操作 $.ajax 简便写法 Ajax事件 返回值 JSONP 文件上传 参考链接 jQuery函数库提供了一个jQuery对象(简写为$),这个对象本 ...

  6. AIX 5L 系统管理技术 —— 存储管理——卷组

    卷组 在安装系统时,就会创建一个rootvg卷组.包含自带硬盘(内置硬盘)和系统逻辑卷,一个系统只能有一个rootvg卷组.一般情况下rootvg卷组最好只包含自带硬盘. 一.创建卷组 在创建卷组之前 ...

  7. 对ADC(DAC)的线性度(INL和DNL)的一点理解 [转]

    大家在使用ADC的时候,往往最关注位数,而对ADC的线性度往往会忽略. 其实这个线性度也是ADC非常重要的指标,ADC(或DAC,其实ADC也是由DAC组成的)线性度指标有两个: INL:翻译过来叫“ ...

  8. Samsung S4卡屏卡在开机画面的不拆机恢复照片一例

    大家好!欢迎再次来到我Dr.wonder的世界, 今天我给你们带来Samsung S4 I9508 卡屏开在开机画面的恢复!非常de经典. 首先看图 他开机一直卡在这里, 然后 ,我们使用专业仪器,在 ...

  9. C#利用反射机制创建对象

    "反射"其实就是利用程序集的元数据信息. 反射可以有很多方法,编写程序时请先导入 System.Reflection 命名空间. 1.假设你要反射一个 DLL 中的类,并且没有引用 ...

  10. 通过jquery获取天气的方法

    代码为: $.getScript('http://int.dpool.sina.com/iplookup/iplookup.php?format=js',function(_result){ if(r ...