原創|使用教程|編輯:何家巧|2023-01-13 11:54:37.970|閱讀 147 次
概述:在TeeChar系列教程中,上一章完成了圖例設計的講解,本次我們為大家帶來“使用系列”的前部分,包括系列類型中的結構講解,希望對大家有所幫助。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
TeeChart for .NET是優秀的工業4.0 WinForm圖表控件,官方獨家授權漢化,集功能全面、性能穩定、價格實惠等優勢于一體。TeeChart for .NET 中文版還可讓您在使用和學習上沒有任何語言障礙,至少可以節省30%的開發時間。
在TeeChar系列教程中,上一章完成了“圖例設計”的全部講解,本次我們為大家帶來“使用系列”的前部分,包括系列類型中的結構講解,希望對大家有所幫助。
內容-目錄
一、系列類型
(一)系列類的結構
(二)選擇一個系列類型
(三)將數據添加到系列中
(四)從系列中刪除數據點
(五)向系列中添加空點
二、在圖表中混合系列類型
(一)添加新的系列
(二)為系列選擇坐標軸
(三)連接系列
(四)改變系列的順序
三、系列值列表
(一)訪問系列值
(二)使用數值的例子
四、系列事件作為TeeChart類型庫結構的一個小背景,這里是對系列類和接口的一個解釋。下圖顯示了TeeChart系列類之間的關系。所有的類都源于通用的 "系列 "類,因此共享 "系列 "屬性和方法。有幾個抽象類派生自Series(Custom3DSeries、CustomBarSeries和CircledSeries),這些類以灰色顯示,它們的接口不能直接用于編程,它們的特性被它們的后代Series類型所繼承。所有派生的系列(橙色)都可以在TeeChart圖庫中訪問,以納入你的圖表中。以這種方式派生的TeeChart系列,允許通過一個共同的索引結構對繼承的屬性和方法進行可編程的訪問(見本節后面的示例代碼)。
[C#]
//Add a series at runtime
private void button1_Click(object sender, System.EventArgs e)
{
Steema.TeeChart.Styles.Area tmpAreaSeries = new Steema.TeeChart.Styles.Area(tChart1.Chart);
tmpAreaSeries.FillSampleValues(4);
//Or
//Steema.TeeChart.Styles.Area tmpAreaSeries = new Steema.TeeChart.Styles.Area();
//tChart1.Series.Add(tmpAreaSeries);
//tmpAreaSeries.FillSampleValues(4);
}
[VB.Net]
'Add a series at runtime
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim tmpAreaSeries As New Steema.TeeChart.Styles.Area(TChart1.Chart)
tmpAreaSeries.FillSampleValues(4)
'Or
'Dim tmpAreaSeries As New Steema.TeeChart.Styles.Area()
'TChart1.Series.Add(tmpAreaSeries)
'tmpAreaSeries.FillSampleValues(4)
End Sub
所有AreaSeries的屬性和方法對新系列都是可用的,就像在設計時創建的任何系列一樣。
在同一個圖表中混合使用不同系列的例子是,在設計時使用TeeChart編輯器在圖表中添加一個Area(系列(0))、Bar(系列(1))和Line(系列(2))系列。所有這些都訪問一個共同的索引結構,即圖表的系列列表。與系列有關的工作可能看起來像下面這樣。
[C#]
private void Form1_Load(object sender, System.EventArgs e)
{
//You could add the Series at runtime
Steema.TeeChart.Styles.Area area1 = new Steema.TeeChart.Styles.Area(tChart1.Chart);
Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
//Use Series common properties
tChart1.Series[0].FillSampleValues(10);
tChart1.Series[1].FillSampleValues(10);
tChart1.Series[2].FillSampleValues(10);
tChart1.Series[1].Marks.Visible = false;
tChart1.Series[2].Marks.Visible = false;
//Modify Bar specific properties
bar1.BarStyle = Steema.TeeChart.Styles.BarStyles.Pyramid; //Change Bar type
bar1.Pen.Color = Color.Yellow; //Bar bounding lines colour
//Modify Line specific properties
line1.Stairs = true; //Set line to Stairs
line1.LinePen.Color = Color.Blue; //LineSeries bounding lines colour
//Modify Area specific properties
area1.AreaBrush.Style = System.Drawing.Drawing2D.HatchStyle.Cross; //Area fill pattern
}
[VB.Net]
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'You could add the Series at runtime
Dim Area1 As New Steema.TeeChart.Styles.Area(TChart1.Chart)
Dim Bar1 As New Steema.TeeChart.Styles.Bar(TChart1.Chart)
Dim Line1 As New Steema.TeeChart.Styles.Line(TChart1.Chart)
'Use Series common properties
TChart1.Series(0).FillSampleValues(10)
TChart1.Series(1).FillSampleValues(10)
TChart1.Series(2).FillSampleValues(10)
TChart1.Series(1).Marks.Visible = False
TChart1.Series(2).Marks.Visible = False
'Modify Bar specific properties
Bar1.BarStyle = Steema.TeeChart.Styles.BarStyles.Pyramid 'Change Bar type
Bar1.Pen.Color = Color.Yellow 'Bar bounding lines colour
'Modify Line specific properties
Line1.Stairs = True 'Set line to Stairs
Line1.LinePen.Color = Color.Blue 'LineSeries bounding lines colour
'Modify Area specific properties
Area1.AreaBrush.Style = System.Drawing.Drawing2D.HatchStyle.Cross 'Area fill pattern
End Sub
以上就是TeeChart系列教程中的“使用系列”的介紹了,點擊查看更多教程。
如果您想了解TeeChart for .NET價格,歡迎咨詢
TeeChart for .NET技術交流QQ群:740060302 歡迎加入
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn