WPF DevExpress ChartControl用法

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

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

 WPF DevExpress ChartControl用法

        <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>

 

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

WPF DevExpress ChartControl用法

Demo:

WPF DevExpress ChartControl用法WPF DevExpress ChartControl用法View Code

Demo中包括:

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

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

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

4、背景、Legend设置等等

 

DevExpress官方下载地址 

 

本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须在文章页面给出原文连接,否则保留追究法律责任的权利。
上一篇:WPF 自定义标题栏 自定义菜单栏


下一篇:WPF 自定义雷达图