DevExress笔记
生活随笔
收集整理的這篇文章主要介紹了
DevExress笔记
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
最近用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.柱形圖外區域填充背景色:
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> View Code?
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 <250){drawOptions.Color = Color.FromArgb(0xFF, 0xC7, 0x39, 0x0C); //Red }else if (val < 350){drawOptions.Color = Color.FromArgb(0xFF, 0xF9, 0xAA, 0x0F); //Yellow }else{drawOptions.Color =Color.FromArgb(0xFF, 0x51, 0x89, 0x03); //Green }}
9.折線圖滾動條:
?
10.設置Y軸最小坐標和最大坐標
?
轉載于:https://www.cnblogs.com/527289276qq/p/7163242.html
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的DevExress笔记的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: leetcode笔记:Search in
- 下一篇: Oracle业务适合用PostgreSQ