[DevExpress]ChartControl之创建X,Y轴Title示例

关键代码:

        /// <summary>
        /// 设置X轴Title
        /// </summary>
        /// <param name="chart">ChartControl</param>
        /// <param name="titleText">Title文字</param>
        /// <param name="titleColor">Title文字颜色</param>
        public static void SetAxisXTitle(this ChartControl chart, string titleText, Color titleColor)
        {
            XYDiagram _diagram = (XYDiagram)chart.Diagram;
            if (_diagram != null)
            {
                _diagram.AxisX.Title.Visible = true;
                _diagram.AxisX.Title.Alignment = StringAlignment.Center;
                _diagram.AxisX.Title.Text = titleText;
                _diagram.AxisX.Title.TextColor = titleColor;
                _diagram.AxisX.Title.Antialiasing = true;
                _diagram.AxisX.Title.Font = new Font("Tahoma", 14, FontStyle.Bold);
            }
        }
        /// <summary>
        /// 设置Y轴Title
        /// </summary>
        /// <param name="chart">ChartControl</param>
        /// <param name="titleText">Title文字</param>
        /// <param name="titleColor">Title文字颜色</param>
        public static void SetAxisYTitle(this ChartControl chart, string titleText, Color titleColor)
        {
            XYDiagram _diagram = (XYDiagram)chart.Diagram;
            if (_diagram != null)
            {
                _diagram.AxisY.Title.Visible = true;
                _diagram.AxisY.Title.Alignment = StringAlignment.Center;
                _diagram.AxisY.Title.Text = titleText;
                _diagram.AxisY.Title.TextColor = titleColor;
                _diagram.AxisY.Title.Antialiasing = true;
                _diagram.AxisY.Title.Font = new Font("Tahoma", 14, FontStyle.Bold);
            }
        }

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }代码使用:

            chartControl1.SetAxisXTitle("时间x轴演示", Color.Red);
            chartControl1.SetAxisYTitle("时间y轴演示", Color.Red);

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }运行效果:

希望有所帮助!谢谢!

时间: 2024-11-06 11:06:50

[DevExpress]ChartControl之创建X,Y轴Title示例的相关文章

WPF DevExpress Chart控件多Y轴,指定数据参考的Y轴

当Chart中有两个及以上的Y轴时,我们就要指明图表中的柱子或折线对应的是哪个Y轴了,这时候需要指明柱子或者折线的dxc:XYDiagram2D.SeriesAxisY属性,来设置对应的Y轴(dxc:XYDiagram2D.SeriesAxisY="{Binding ElementName=y2}"),其中Binding的ElementName就是需要对应的Y轴的Name(即这里的y2),界面代码如下: <dxc:ChartControl DataSource="{Bi

[DevExpress]ChartControl之创建Strip示例

关键代码: /// <summary> /// 创建Strip /// </summary> /// <param name="chart">ChartControl</param> /// <param name="strip">Strip</param> /// <param name="stripLable">Strip文字</param> //

Devexpress WPF ChartControl 多Y轴

<Window x:Class="DXApplication4.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/

【原】为DevExpress的ChartControl添加Y轴控制 和 GridControl中指定列添加超级链接

一.控制ChartControl的Y轴范围 使用Devexpress中的CharControl控件,需要控制AxisY轴的显示范围,需要使用该控件的BoundDataChanged事件,具体代码如下: 该代码实现的效果如下:   二.设置GridControl表格中的超级链接: 1.首先在表格的设计器中添加一个HyperLinkEdit 的 Repository: 2.将该Repository绑定到列表中的指定列中: 3.为第一步添加的rpLink控件添加Open_Link事件处理函数: 4.最

[DevExpress]ChartControl 创建Drill-Down样式的Title

关键代码: /// <summary> /// 创建Drill-Down样式的Title /// </summary> /// <param name="chart">ChartControl</param> /// <param name="title">title文字</param> /// <param name="visible">是否可见</par

[DevExpress]ChartControl之时间轴示例

关键代码: using System; using System.Data; using System.Windows.Forms; using DevExpress.XtraCharts; namespace DevExpressChart { public partial class winDateTime : Form { public winDateTime() { InitializeComponent(); } private void winDateTime_Load(object

EChart 标题 title 样式,x轴、y轴坐标显示,调整图表位置等

示例里工作一般情况是够用了,更复杂的可以查询教程: title 官方解说:http://echarts.baidu.com/option.html#title 坐标相关: X轴:http://echarts.baidu.com/option.html#xAxis 坐标相关: Y轴:http://echarts.baidu.com/option.html#yAxis 表格部分:http://echarts.baidu.com/option.html#grid <script> function

WPF DevExpress ChartControl使用之XYDiagram

WPF使用Dev和WinForm有许多不同,相对而言,WPF要更简单和炫酷一点,我只做了一点基本的功能,没有仔细的研究,这里只介绍一下WPF Dev ChartControl绘制XYDiagram的基础. XYDiagramControl.xaml页面 <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microso

[DevExpress]ChartControl之柱状图演示

关键代码: using System; using System.Data; using System.Windows.Forms; using CSharpUtilHelpV2; using DevExpress.XtraCharts; namespace DevExpressChart { public partial class winProduct : Form { public winProduct() { InitializeComponent(); } static readonl