最近用DevExpress的WPF图表控件做柱形图看板,总结记录了一些笔记:

1.显示图例:

 <dxc:ChartControl.Legend>
<dxc:Legend />
</dxc:ChartControl.Legend>

2.柱形图标题:

<dxc:ChartControl.Titles>
<dxc:Title HorizontalAlignment="Center" VerticalAlignment="Center" Content="焊接" Foreground="#03CACC"/>
</dxc:ChartControl.Titles>

3.柱形图颜色:

 <dxc:ChartControl.Palette>
<dxc:YellowPalette/>
</dxc:ChartControl.Palette>

4.柱形图外区域填充背景色:

 <dxc:XYDiagram2D.DefaultPane>
<dxc:Pane DomainBorderBrush="#343246" DomainBrush="#343246" />
</dxc:XYDiagram2D.DefaultPane>

5.柱形图颜色设置为一样:ColorEach="True"

 <dxc:XYDiagram2D Background="#343246"  SeriesDataMember="Name" BorderBrush="#FF343246">
<dxc:XYDiagram2D.SeriesTemplate>
<dxc:BarSideBySideSeries2D Background="#343246" LabelsVisibility="True" ArgumentDataMember="Name" ValueDataMember="Value" ColorEach="True">
<dxc:BarSideBySideSeries2D.Label>
<dxc:SeriesLabel Background="#343246" ConnectorVisible="False" Indent="0" dxc:BarSideBySideSeries2D.LabelPosition="Outside">
<dxc:SeriesLabel.ElementTemplate>
<DataTemplate>
<Label Content="{Binding Text}" Foreground="Green" FontSize="15"/>
</DataTemplate>
</dxc:SeriesLabel.ElementTemplate>
</dxc:SeriesLabel>
</dxc:BarSideBySideSeries2D.Label>
</dxc:BarSideBySideSeries2D>
</dxc:XYDiagram2D.SeriesTemplate>
<dxc:XYDiagram2D.AxisX>
<dxc:AxisX2D>
<dxc:AxisX2D.Label>
<dxc:AxisLabel Foreground="White" BorderBrush="Black"/>
</dxc:AxisX2D.Label>
</dxc:AxisX2D>
</dxc:XYDiagram2D.AxisX>
<dxc:XYDiagram2D.AxisY>
<dxc:AxisY2D GridLinesVisible="False">
<dxc:AxisY2D.Label>
<dxc:AxisLabel Background="#343246" Foreground="White" BorderBrush="#FF343246"/>
</dxc:AxisY2D.Label>
</dxc:AxisY2D>
</dxc:XYDiagram2D.AxisY>
<dxc:XYDiagram2D.DefaultPane>
<dxc:Pane DomainBorderBrush="#343246" DomainBrush="#343246" />
</dxc:XYDiagram2D.DefaultPane>
<dxc:LineSeries2D MarkerVisible="True" Background="#343246" LabelsVisibility="True" ArgumentDataMember="Key" ValueDataMember="Value" x:Name="series1" Brush="#FF343246">
<dxc:LineSeries2D.LineStyle>
<dxc:LineStyle Thickness="1"/>
</dxc:LineSeries2D.LineStyle>
</dxc:LineSeries2D>
</dxc:XYDiagram2D>

6.设置平行X轴的横线:

 <dxc:AxisY2D.ConstantLinesInFront>
<dxc:ConstantLine Brush="#FF0000" LegendText="计划产量">
<dxc:ConstantLine.Title>
<dxc:ConstantLineTitle Content="计划产量:20"/>
</dxc:ConstantLine.Title>
<dxc:ConstantLine.Value>
<sys:Int32>20</sys:Int32>
</dxc:ConstantLine.Value>
</dxc:ConstantLine>
</dxc:AxisY2D.ConstantLinesInFront>

7.设置Y轴坐标(X轴类似):

<dxc:AxisY2D.Label>
<dxc:AxisLabel Background="#343246" Foreground="White" BorderBrush="#FF343246"/>
</dxc:AxisY2D.Label>

8.设置低于平行X轴的横线的颜色(根据柱子的值,设置柱子不同颜色):

dxc:ChartControl 的 CustomDrawSeriesPoint="chartControl_CustomDrawSeriesPoint" 事件:

 <dxc:ChartControl  Background="#343246" Name="chartControl1" Grid.Row="2"  Grid.Column="0"
HorizontalAlignment="Left" VerticalAlignment="Top" CustomDrawSeriesPoint="chartControl_CustomDrawSeriesPoint" >

C#代码:

private void chartControl_CustomDrawSeriesPoint(object sender, CustomDrawSeriesPointEventArgs e)
{
CorrectDrawOptions(e.SeriesPoint.Value, e.DrawOptions);
}
private void CorrectDrawOptions(double val, DrawOptions drawOptions)
{
if (drawOptions!=null&&val <)
{
drawOptions.Color = Color.FromArgb(0xFF, 0xC7, 0x39, 0x0C); //Red
}
else if (val < )
{
drawOptions.Color = Color.FromArgb(0xFF, 0xF9, 0xAA, 0x0F); //Yellow
}
else
{
drawOptions.Color =Color.FromArgb(0xFF, 0x51, 0x89, 0x03); //Green
}
}

9.折线图滚动条:

Diagram.AxisX.Range.Auto = false; //要开启滚动条必须将其设置为false
Diagram.EnableAxisXScrolling = true;//启用滚动条
Diagram.AxisX.Range.SideMarginsEnabled = false;//启用滚动条 XYDiagram Diagram { get { return chartControl1.Diagram as XYDiagram; } }

10.设置Y轴最小坐标和最大坐标

((XYDiagram2D)this.chartControl1.Diagram).AxisY.WholeRange = new Range() { MinValue = , MaxValue =  };

DevExress笔记的更多相关文章

  1. git-简单流程(学习笔记)

    这是阅读廖雪峰的官方网站的笔记,用于自己以后回看 1.进入项目文件夹 初始化一个Git仓库,使用git init命令. 添加文件到Git仓库,分两步: 第一步,使用命令git add <file ...

  2. js学习笔记:webpack基础入门(一)

    之前听说过webpack,今天想正式的接触一下,先跟着webpack的官方用户指南走: 在这里有: 如何安装webpack 如何使用webpack 如何使用loader 如何使用webpack的开发者 ...

  3. SQL Server技术内幕笔记合集

    SQL Server技术内幕笔记合集 发这一篇文章主要是方便大家找到我的笔记入口,方便大家o(∩_∩)o Microsoft SQL Server 6.5 技术内幕 笔记http://www.cnbl ...

  4. PHP-自定义模板-学习笔记

    1.  开始 这几天,看了李炎恢老师的<PHP第二季度视频>中的“章节7:创建TPL自定义模板”,做一个学习笔记,通过绘制架构图.UML类图和思维导图,来对加深理解. 2.  整体架构图 ...

  5. PHP-会员登录与注册例子解析-学习笔记

    1.开始 最近开始学习李炎恢老师的<PHP第二季度视频>中的“章节5:使用OOP注册会员”,做一个学习笔记,通过绘制基本页面流程和UML类图,来对加深理解. 2.基本页面流程 3.通过UM ...

  6. NET Core-学习笔记(三)

    这里将要和大家分享的是学习总结第三篇:首先感慨一下这周跟随netcore官网学习是遇到的一些问题: a.官网的英文版教程使用的部分nuget包和我当时安装的最新包版本不一致,所以没法按照教材上给出的列 ...

  7. springMVC学习笔记--知识点总结1

    以下是学习springmvc框架时的笔记整理: 结果跳转方式 1.设置ModelAndView,根据view的名称,和视图渲染器跳转到指定的页面. 比如jsp的视图渲染器是如下配置的: <!-- ...

  8. 读书笔记汇总 - SQL必知必会(第4版)

    本系列记录并分享学习SQL的过程,主要内容为SQL的基础概念及练习过程. 书目信息 中文名:<SQL必知必会(第4版)> 英文名:<Sams Teach Yourself SQL i ...

  9. 2014年暑假c#学习笔记目录

    2014年暑假c#学习笔记 一.C#编程基础 1. c#编程基础之枚举 2. c#编程基础之函数可变参数 3. c#编程基础之字符串基础 4. c#编程基础之字符串函数 5.c#编程基础之ref.ou ...

随机推荐

  1. Cobbler自动化安装部署系统

    自动化安装部署 https://www.cnblogs.com/nulige/p/6796593.html PXE+Kickstart工作原理 pxe+kickstart工作流程 网卡上的pxe芯片有 ...

  2. 第三方插件Vue-Lazyload

    使图片懒加载

  3. Windows7 SP1 64bit配置IIS7.5和ASP.NET4

    一.安装前的环境 1. Windows7 SP1 64bit: 2. 在安装IIS7.5之前,安装了Visual Studio 2010或.NET Framework4: 二.安装IIS7.5 1.  ...

  4. pthread线程私有数据

    进程内所有的线程共享地址空间,任何声明为静态或外部的变量,或在进程堆声明的变量都可以被进程内的所有线程读写. static,extern,或堆变量的值是上次线程改写的值 一个线程真正拥有的唯一私有存储 ...

  5. Chrome 解决flash问题

    Chrome 无法显示使用插件的内容 Chrome 不再支持很多插件.不过网站创建者已经通过更安全的方式,将多数这类功能添加到 Chrome 中. 为什么 NPAPI 插件现在无法正常运行过去,许多插 ...

  6. Linux内核 TCP/IP参数调优

    http://www.360doc.com/content/14/0606/16/3300331_384326124.shtml

  7. while循环-for循环

    while true: 无限循环语句 break跳出循环,当count=1000的时候结束循环 count是结束当前循环'''count = 0while True: print("coun ...

  8. 给iOS开发新手送点福利,简述UIActivityIndicatorView的属性和用法

    UIActivityIndicatorView 1.   activityIndicatorViewStyle 设置指示器的样式 UIActivityIndicatorViewStyleWhiteLa ...

  9. 图片采集器_PHP

    现在国内模仿“pinterest”的越来越多了,之前我做过一个基于chrome浏览器上的一个“图片采集工具”,类似于“花瓣网“那样的,初期我觉得挺简单,后来做起来发现还是挺复杂的,特别是整合到你自己的 ...

  10. setAttribute第三个参数

    object.setAttribute(sName, vValue [, iFlags]) sName参数应是Dom属性而非html中的属性.Dom中Html专有的接口属性应该以小写字母开头,如果属性 ...