彩票走势图

DevExpress XtraChart中怎样为图表添加标题

原创|其它|编辑:郝浩|2012-11-16 15:25:56.000|阅读 1218 次

概述:在这个例子中我们将使用DevExpress控件XtraChart来演示如何在运行时为图表添加和修改标题。

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

在这个例子中我们将使用DevExpress控件XtraChart来演示如何在运行时为图表添加和修改标题。

C#

// Create chart titles.
ChartTitle chartTitle1 = new ChartTitle();
ChartTitle chartTitle2 = new ChartTitle();

// Define the text for the titles.
chartTitle1.Text = "<i>Basic</i> <b>HTML</b> <u>is</u> <color=blue>supported</color>.";
chartTitle2.Text = "The capability to word-wrap is available for chart titles.";

chartTitle2.WordWrap = true;
chartTitle2.MaxLineCount = 2;

// Define the alignment of the titles.
chartTitle1.Alignment = StringAlignment.Center;
chartTitle2.Alignment = StringAlignment.Near;

// Place the titles where it's required.
chartTitle1.Dock = ChartTitleDockStyle.Top;
chartTitle2.Dock = ChartTitleDockStyle.Bottom;

// Customize a title's appearance.
chartTitle1.Antialiasing = true;
chartTitle1.Font = new Font("Tahoma", 14, FontStyle.Bold);
chartTitle1.TextColor = Color.Red;
chartTitle1.Indent = 10;

// Add the titles to the chart.
chartControl1.Titles.AddRange(new ChartTitle[] {
chartTitle1,
chartTitle2});

VB
' Create chart titles.
Dim chartTitle1 As New ChartTitle()
Dim chartTitle2 As New ChartTitle()

' Define the text for the titles.
chartTitle1.Text = "<i>Basic</i> <b>HTML</b> <u>is</u> <color=blue>supported</color>."
chartTitle2.Text = "The capability to word-wrap is available for chart titles."

chartTitle2.WordWrap = True
chartTitle2.MaxLineCount = 2

' Define the alignment of the titles.
chartTitle1.Alignment = StringAlignment.Center
chartTitle2.Alignment = StringAlignment.Near

' Place the titles where it's required.
chartTitle1.Dock = ChartTitleDockStyle.Top
chartTitle2.Dock = ChartTitleDockStyle.Bottom

' Customize a title's appearance.
chartTitle1.Antialiasing = True
chartTitle1.Font = New Font("Tahoma", 14, FontStyle.Bold)
chartTitle1.TextColor = Color.Red
chartTitle1.Indent = 10

' Add the titles to the chart.
chartControl1.Titles.AddRange(New ChartTitle() { chartTitle1, chartTitle2})




标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@cahobeh.cn

文章转载自:慧都控件网

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP