• WPF DevExpress ChartControl用法


     WPF常用的第三方控件集,DevExpress中ChartControl的使用

    下面介绍如何生成Chart界面:

     

            <dxc:ChartControl AnimationMode="OnDataChanged" Background="Transparent" BorderThickness="0" BorderBrush="Transparent"
                              SelectionMode="Single" SeriesSelectionMode="Point">
                <dxc:XYDiagram2D PaneOrientation="Vertical" EqualBarWidth="True">
                    <dxc:XYDiagram2D.DefaultPane>
                        <dxc:Pane DomainBrush="Transparent" Foreground="White" />
                    </dxc:XYDiagram2D.DefaultPane>
    
                    <dxc:XYDiagram2D.AxisY>
                        <dxc:AxisY2D TickmarksMinorVisible="False" Brush="White" Thickness="2" GridLinesVisible="True"
                            Interlaced="False" TickmarksVisible="False">
                            <dxc:AxisY2D.CustomLabels>
                                <dxc:CustomAxisLabel Content="0" Value="0"/>
                                <dxc:CustomAxisLabel Content="20" Value="20"/>
                                <dxc:CustomAxisLabel Content="40" Value="40"/>
                                <dxc:CustomAxisLabel Content="60" Value="60"/>
                                <dxc:CustomAxisLabel Content="80" Value="80"/>
                                <dxc:CustomAxisLabel Content="100" Value="100"/>
                            </dxc:AxisY2D.CustomLabels>
                            <dxc:AxisY2D.WholeRange>
                                <dxc:Range MaxValue="100" MinValue="0" AutoSideMargins="False"/>
                            </dxc:AxisY2D.WholeRange>
                            <dxc:AxisY2D.Label>
                                <dxc:AxisLabel  Background="Transparent" Foreground="White" />
                            </dxc:AxisY2D.Label>
                        </dxc:AxisY2D>
                    </dxc:XYDiagram2D.AxisY>
                    <dxc:XYDiagram2D.AxisX>
                        <dxc:AxisX2D Brush="Transparent" TickmarksVisible="True" TickmarksMinorVisible="False" Reverse="False" Logarithmic="False" TickmarksCrossAxis="False">
                            <dxc:AxisX2D.Label>
                                <dxc:AxisLabel Background="Transparent" Foreground="White" />
                            </dxc:AxisX2D.Label>
                        </dxc:AxisX2D>
                    </dxc:XYDiagram2D.AxisX>
    
                    <dxc:BarSideBySideSeries2D DisplayName="BarSeries" LabelsVisibility="True" ColorEach="True"
                                               BarWidth="0.3" CrosshairEnabled="False" CrosshairLabelVisibility="False"
                                               >
    
                        <dxc:BarSideBySideSeries2D.Model>
                            <dxc:BorderlessSimpleBar2DModel/>
                        </dxc:BarSideBySideSeries2D.Model>
                        <dxc:BarSideBySideSeries2D.Label>
                            <dxc:SeriesLabel  ConnectorVisible="False" Indent="0" dxc:BarSideBySideSeries2D.LabelPosition="Outside">
                                <dxc:SeriesLabel.ElementTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Text}" Foreground="White" FontSize="17"/>
                                    </DataTemplate>
                                </dxc:SeriesLabel.ElementTemplate>
                            </dxc:SeriesLabel>
                        </dxc:BarSideBySideSeries2D.Label>
                        <dxc:SeriesPoint Argument="1" Value="96.4"/>
                        <dxc:SeriesPoint Argument="2" Value="45.5"/>
                        <dxc:SeriesPoint Argument="3" Value="12.5"/>
                        <dxc:SeriesPoint Argument="4" Value="81.5"/>
                        <dxc:SeriesPoint Argument="5" Value="88.5"/>
                        <dxc:SeriesPoint Argument="6" Value="30.5"/>
                    </dxc:BarSideBySideSeries2D>
                </dxc:XYDiagram2D>
                <dxc:ChartControl.Legend>
                    <dxc:Legend Background="LightSteelBlue" BorderBrush="Transparent"></dxc:Legend>
                </dxc:ChartControl.Legend>
            </dxc:ChartControl>

    其它样式设置,可详见如下:

    Demo:

    View Code

    Demo中包括:

    1、设置X/Y轴-包括颜色、刻度、范围

    2、行线颜色、顶上和底部行线取巧的设置

    3、注状图、波浪图、线、圆点虚线、普通虚线。

    4、背景、Legend设置等等

    DevExpress官方下载地址 

  • 相关阅读:
    Spring Boot 7:配置文件信息读取
    Spring Boot 6:自定义filter
    Spring AOP:Java动态代理和CGlib
    Spring AOP:概念
    设计模式(二)---策略模式
    设计模式(一)--装饰模式
    java并发编程实战笔记
    剑指offer java -查找旋转数组的最小数字
    读书计划
    协议初学
  • 原文地址:https://www.cnblogs.com/kybs0/p/5808602.html
Copyright © 2020-2023  润新知