如何利用DevExpress DXCharts图表控件来自定义图表标题?
作者:zhuhm 来源:本站原创 浏览:Loading...次 发布时间:2012-09-13 评论:0条
通过DXCharts图表控件,你可以完全定制图表标题的外观和行为。本示例主要向你展示如何利用DXCharts图表控件来自定义图表标题。
VB.NET
<Window x:Class="CustomChartTitles.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts"
Title="Custom Chart Titles" Height="380" Width="650">
<Grid>
<dxc:ChartControl Name="chart">
<dxc:ChartControl.Titles>
<dxc:Title>
<WrapPanel Orientation="Vertical">
<CheckBox Name="chRed" Foreground="Red" IsChecked="True" FontSize="14">
Red
</CheckBox>
<CheckBox Name="chGreen" Foreground="Green" IsChecked="True" FontSize="14">
Green
</CheckBox>
<CheckBox Name="chBlue" Foreground="Blue" IsChecked="True" FontSize="14">
Blue
</CheckBox>
</WrapPanel>
</dxc:Title>
</dxc:ChartControl.Titles>
<dxc:ChartControl.Diagram>
<dxc:XYDiagram2D>
<dxc:XYDiagram2D.AxisX>
<dxc:AxisX2D>
<dxc:AxisX2D.Range>
<dxc:AxisRange SideMarginsEnabled="False" />
</dxc:AxisX2D.Range>
</dxc:AxisX2D>
</dxc:XYDiagram2D.AxisX>
<dxc:XYDiagram2D.Series>
<dxc:AreaSeries2D Name="Blue" Brush="Blue" Transparency="0.5"
Visible="{Binding ElementName=chBlue, Path=IsChecked}">
<dxc:AreaSeries2D.Points>
<dxc:SeriesPoint Argument="1" Value="0.5" />
<dxc:SeriesPoint Argument="2" Value="2" />
<dxc:SeriesPoint Argument="3" Value="1.5" />
</dxc:AreaSeries2D.Points>
<dxc:AreaSeries2D.Label>
<dxc:SeriesLabel Visible="False" />
</dxc:AreaSeries2D.Label>
</dxc:AreaSeries2D>
<dxc:AreaSeries2D Name="Red" Brush="Red" Transparency="0.5"
Visible="{Binding ElementName=chRed, Path=IsChecked}">
<dxc:AreaSeries2D.Points>
<dxc:SeriesPoint Argument="1" Value="0.3" />
<dxc:SeriesPoint Argument="2" Value="1.8" />
<dxc:SeriesPoint Argument="3" Value="1.3" />
</dxc:AreaSeries2D.Points>
<dxc:AreaSeries2D.Label>
<dxc:SeriesLabel Visible="False" />
</dxc:AreaSeries2D.Label>
</dxc:AreaSeries2D>
<dxc:AreaSeries2D Name="Green" Brush="Green" Transparency="0.5"
Visible="{Binding ElementName=chGreen, Path=IsChecked}">
<dxc:AreaSeries2D.Points>
<dxc:SeriesPoint Argument="1" Value="0.1" />
<dxc:SeriesPoint Argument="2" Value="1.6" />
<dxc:SeriesPoint Argument="3" Value="1.1" />
</dxc:AreaSeries2D.Points>
<dxc:AreaSeries2D.Label>
<dxc:SeriesLabel Visible="False" />
</dxc:AreaSeries2D.Label>
</dxc:AreaSeries2D>
</dxc:XYDiagram2D.Series>
</dxc:XYDiagram2D>
</dxc:ChartControl.Diagram>
</dxc:ChartControl>
</Grid>
</Window>
<Window x:Class="CustomChartTitles.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts"
Title="Custom Chart Titles" Height="380" Width="650">
<Grid>
<dxc:ChartControl Name="chart">
<dxc:ChartControl.Titles>
<dxc:Title>
<WrapPanel Orientation="Vertical">
<CheckBox Name="chRed" Foreground="Red" IsChecked="True" FontSize="14">
Red
</CheckBox>
<CheckBox Name="chGreen" Foreground="Green" IsChecked="True" FontSize="14">
Green
</CheckBox>
<CheckBox Name="chBlue" Foreground="Blue" IsChecked="True" FontSize="14">
Blue
</CheckBox>
</WrapPanel>
</dxc:Title>
</dxc:ChartControl.Titles>
<dxc:ChartControl.Diagram>
<dxc:XYDiagram2D>
<dxc:XYDiagram2D.AxisX>
<dxc:AxisX2D>
<dxc:AxisX2D.Range>
<dxc:AxisRange SideMarginsEnabled="False" />
</dxc:AxisX2D.Range>
</dxc:AxisX2D>
</dxc:XYDiagram2D.AxisX>
<dxc:XYDiagram2D.Series>
<dxc:AreaSeries2D Name="Blue" Brush="Blue" Transparency="0.5"
Visible="{Binding ElementName=chBlue, Path=IsChecked}">
<dxc:AreaSeries2D.Points>
<dxc:SeriesPoint Argument="1" Value="0.5" />
<dxc:SeriesPoint Argument="2" Value="2" />
<dxc:SeriesPoint Argument="3" Value="1.5" />
</dxc:AreaSeries2D.Points>
<dxc:AreaSeries2D.Label>
<dxc:SeriesLabel Visible="False" />
</dxc:AreaSeries2D.Label>
</dxc:AreaSeries2D>
<dxc:AreaSeries2D Name="Red" Brush="Red" Transparency="0.5"
Visible="{Binding ElementName=chRed, Path=IsChecked}">
<dxc:AreaSeries2D.Points>
<dxc:SeriesPoint Argument="1" Value="0.3" />
<dxc:SeriesPoint Argument="2" Value="1.8" />
<dxc:SeriesPoint Argument="3" Value="1.3" />
</dxc:AreaSeries2D.Points>
<dxc:AreaSeries2D.Label>
<dxc:SeriesLabel Visible="False" />
</dxc:AreaSeries2D.Label>
</dxc:AreaSeries2D>
<dxc:AreaSeries2D Name="Green" Brush="Green" Transparency="0.5"
Visible="{Binding ElementName=chGreen, Path=IsChecked}">
<dxc:AreaSeries2D.Points>
<dxc:SeriesPoint Argument="1" Value="0.1" />
<dxc:SeriesPoint Argument="2" Value="1.6" />
<dxc:SeriesPoint Argument="3" Value="1.1" />
</dxc:AreaSeries2D.Points>
<dxc:AreaSeries2D.Label>
<dxc:SeriesLabel Visible="False" />
</dxc:AreaSeries2D.Label>
</dxc:AreaSeries2D>
</dxc:XYDiagram2D.Series>
</dxc:XYDiagram2D>
</dxc:ChartControl.Diagram>
</dxc:ChartControl>
</Grid>
</Window>
C#
<Window x:Class="CustomChartTitles.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts"
Title="Custom Chart Titles" Height="380" Width="650">
<Grid>
<dxc:ChartControl Name="chart">
<dxc:ChartControl.Titles>
<dxc:Title>
<WrapPanel Orientation="Vertical">
<CheckBox Name="chRed" Foreground="Red" IsChecked="True" FontSize="14">
Red
</CheckBox>
<CheckBox Name="chGreen" Foreground="Green" IsChecked="True" FontSize="14">
Green
</CheckBox>
<CheckBox Name="chBlue" Foreground="Blue" IsChecked="True" FontSize="14">
Blue
</CheckBox>
</WrapPanel>
</dxc:Title>
</dxc:ChartControl.Titles>
<dxc:ChartControl.Diagram>
<dxc:XYDiagram2D>
<dxc:XYDiagram2D.AxisX>
<dxc:AxisX2D>
<dxc:AxisX2D.Range>
<dxc:AxisRange SideMarginsEnabled="False" />
</dxc:AxisX2D.Range>
</dxc:AxisX2D>
</dxc:XYDiagram2D.AxisX>
<dxc:XYDiagram2D.Series>
<dxc:AreaSeries2D Name="Blue" Brush="Blue" Transparency="0.5"
Visible="{Binding ElementName=chBlue, Path=IsChecked}">
<dxc:AreaSeries2D.Points>
<dxc:SeriesPoint Argument="1" Value="0.5" />
<dxc:SeriesPoint Argument="2" Value="2" />
<dxc:SeriesPoint Argument="3" Value="1.5" />
</dxc:AreaSeries2D.Points>
<dxc:AreaSeries2D.Label>
<dxc:SeriesLabel Visible="False" />
</dxc:AreaSeries2D.Label>
</dxc:AreaSeries2D>
<dxc:AreaSeries2D Name="Red" Brush="Red" Transparency="0.5"
Visible="{Binding ElementName=chRed, Path=IsChecked}">
<dxc:AreaSeries2D.Points>
<dxc:SeriesPoint Argument="1" Value="0.3" />
<dxc:SeriesPoint Argument="2" Value="1.8" />
<dxc:SeriesPoint Argument="3" Value="1.3" />
</dxc:AreaSeries2D.Points>
<dxc:AreaSeries2D.Label>
<dxc:SeriesLabel Visible="False" />
</dxc:AreaSeries2D.Label>
</dxc:AreaSeries2D>
<dxc:AreaSeries2D Name="Green" Brush="Green" Transparency="0.5"
Visible="{Binding ElementName=chGreen, Path=IsChecked}">
<dxc:AreaSeries2D.Points>
<dxc:SeriesPoint Argument="1" Value="0.1" />
<dxc:SeriesPoint Argument="2" Value="1.6" />
<dxc:SeriesPoint Argument="3" Value="1.1" />
</dxc:AreaSeries2D.Points>
<dxc:AreaSeries2D.Label>
<dxc:SeriesLabel Visible="False" />
</dxc:AreaSeries2D.Label>
</dxc:AreaSeries2D>
</dxc:XYDiagram2D.Series>
</dxc:XYDiagram2D>
</dxc:ChartControl.Diagram>
</dxc:ChartControl>
</Grid>
</Window>
<Window x:Class="CustomChartTitles.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts"
Title="Custom Chart Titles" Height="380" Width="650">
<Grid>
<dxc:ChartControl Name="chart">
<dxc:ChartControl.Titles>
<dxc:Title>
<WrapPanel Orientation="Vertical">
<CheckBox Name="chRed" Foreground="Red" IsChecked="True" FontSize="14">
Red
</CheckBox>
<CheckBox Name="chGreen" Foreground="Green" IsChecked="True" FontSize="14">
Green
</CheckBox>
<CheckBox Name="chBlue" Foreground="Blue" IsChecked="True" FontSize="14">
Blue
</CheckBox>
</WrapPanel>
</dxc:Title>
</dxc:ChartControl.Titles>
<dxc:ChartControl.Diagram>
<dxc:XYDiagram2D>
<dxc:XYDiagram2D.AxisX>
<dxc:AxisX2D>
<dxc:AxisX2D.Range>
<dxc:AxisRange SideMarginsEnabled="False" />
</dxc:AxisX2D.Range>
</dxc:AxisX2D>
</dxc:XYDiagram2D.AxisX>
<dxc:XYDiagram2D.Series>
<dxc:AreaSeries2D Name="Blue" Brush="Blue" Transparency="0.5"
Visible="{Binding ElementName=chBlue, Path=IsChecked}">
<dxc:AreaSeries2D.Points>
<dxc:SeriesPoint Argument="1" Value="0.5" />
<dxc:SeriesPoint Argument="2" Value="2" />
<dxc:SeriesPoint Argument="3" Value="1.5" />
</dxc:AreaSeries2D.Points>
<dxc:AreaSeries2D.Label>
<dxc:SeriesLabel Visible="False" />
</dxc:AreaSeries2D.Label>
</dxc:AreaSeries2D>
<dxc:AreaSeries2D Name="Red" Brush="Red" Transparency="0.5"
Visible="{Binding ElementName=chRed, Path=IsChecked}">
<dxc:AreaSeries2D.Points>
<dxc:SeriesPoint Argument="1" Value="0.3" />
<dxc:SeriesPoint Argument="2" Value="1.8" />
<dxc:SeriesPoint Argument="3" Value="1.3" />
</dxc:AreaSeries2D.Points>
<dxc:AreaSeries2D.Label>
<dxc:SeriesLabel Visible="False" />
</dxc:AreaSeries2D.Label>
</dxc:AreaSeries2D>
<dxc:AreaSeries2D Name="Green" Brush="Green" Transparency="0.5"
Visible="{Binding ElementName=chGreen, Path=IsChecked}">
<dxc:AreaSeries2D.Points>
<dxc:SeriesPoint Argument="1" Value="0.1" />
<dxc:SeriesPoint Argument="2" Value="1.6" />
<dxc:SeriesPoint Argument="3" Value="1.1" />
</dxc:AreaSeries2D.Points>
<dxc:AreaSeries2D.Label>
<dxc:SeriesLabel Visible="False" />
</dxc:AreaSeries2D.Label>
</dxc:AreaSeries2D>
</dxc:XYDiagram2D.Series>
</dxc:XYDiagram2D>
</dxc:ChartControl.Diagram>
</dxc:ChartControl>
</Grid>
</Window>
本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [http://www.devexpresscn.com/]
本文地址:http://www.devexpresscn.com/DevExpress-Resources/Demo-238.html
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [http://www.devexpresscn.com/]
本文地址:http://www.devexpresscn.com/DevExpress-Resources/Demo-238.html
关键字: DXCharts
评论列表
暂无评论
请谈谈你的看法 请使用IE或者Firefox浏览器,暂不支持Chrome!
慧都控件网为DevExpress界面控件的中国地区唯一正式授权经销商,正版控件销售公司,授权代理商,经销商及合作伙伴。
电话:400-700-1020
023-66090381
邮箱:sales@evget.com
相关资源
- ASPxGridView控件FAQ
- 中级信用环境中网站停止工作
- ASPxperience控件常见问题FAQ
- 添加ASPxNavBar控件到SharePoint 2010
- ASPxTreeList控件FAQ
- 如何序列化包含可序列化的DX控件的WPF窗体
- ASPxNavBar控件替换快速启动菜单
- ASPxPopupControl控件实现向下钻取报告
- 放大DXGrid单元格中的图像
- 如何修改DXGrid for WPF单元格的背景色?
- DXCharts创建二维面积图
- 通过辅助复选框列实现多行选择
- DXCharts入门手册
- 将ChartControl添加到Windows窗体中
- DevExpress DXCharts入门手册
- jQuery为WebChartControl控件增加交互性
- XtraCharts入门教程一:利用向导创建ASP.NET图表
- XtraCharts入门教程二:创建一个简单的非绑定图表
- XtraCharts入门教程三:绑定图表系列到数据源
- 利用滚动图例创建一个图表控件