【TeeChart .NET教程】(十六)TeeChart的其他調(diào)色板組件
【下載TeeChart.Net最新版本】
(一)使用附加的TeeChart控件
TeeChart for.Net包含幾個(gè)可以添加到項(xiàng)目中的附加控件,以增強(qiáng)Charting應(yīng)用程序的運(yùn)行時(shí)功能。
1.1 選擇和插入組件
將TeeChart.Net組件添加到Visual Studio .Net ToolBox時(shí),也會(huì)自動(dòng)添加其他控件
1.2 將組件與TChart相關(guān)聯(lián)
您可以使用Chart屬性將Commander和其他非Chart組件與TChart相關(guān)聯(lián),例:
[C#.Net]
commander1.Chart = tChart1;
[VB.Net]
Commander1.Chart = TChart1
1.3 ButtonColor
ButtonColor顯示顏色編輯器,可以與TeeChart對(duì)象的Color屬性關(guān)聯(lián),以修改其顏色和透明度,例:
[C#.Net]
private void Form1_Load(object sender, System.EventArgs e) { tChart1.Aspect.View3D = false; line1.FillSampleValues(20); colorBand1.Axis = tChart1.Axes.Left; colorBand1.Start = line1.YValues.Maximum * 0.8; colorBand1.End = line1.YValues.Minimum * 1.2; buttonPen1.Pen = colorBand1.Pen; } private void buttonColor1_Click(object sender, System.EventArgs e) { colorBand1.Color = buttonColor1.Color; }
[VB.Net]
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TChart1.Aspect.View3D = False Line1.FillSampleValues(20) ColorBand1.Axis = TChart1.Axes.Left ColorBand1.Start = Line1.YValues.Maximum * 0.8 ColorBand1.End = Line1.YValues.Minimum * 1.2 ButtonPen1.Pen = ColorBand1.Pen End Sub Private Sub ButtonColor1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonColor1.Click ColorBand1.Color = ButtonColor1.Color End Sub
1.4 ButtonPen
ButtonPen顯示邊框編輯器,可以與TeeChart對(duì)象的Pen屬性關(guān)聯(lián),以修改其可見性,顏色,結(jié)尾,破折號(hào)樣式,寬度,樣式和透明度,例
[C#.Net]
private void Form1_Load(object sender,System.EventArgs e){ tChart1.Aspect.View3D = false; line1.FillSampleValues(20); colorBand1.Axis = tChart1.Axes.Left; colorBand1.Start = line1.YValues.Maximum * 0.8; colorBand1.End = line1.YValues.Minimum * 1.2; buttonPen1.Pen = colorBand1.Pen; } private void buttonColor1_Click(object sender,System.EventArgs e){ colorBand1.Color = buttonColor1.Color; }
[VB.Net]
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TChart1.Aspect.View3D = False Line1.FillSampleValues(20) ColorBand1.Axis = TChart1.Axes.Left ColorBand1.Start = Line1.YValues.Maximum * 0.8 ColorBand1.End = Line1.YValues.Minimum * 1.2 ButtonPen1.Pen = ColorBand1.Pen End Sub Private Sub ButtonColor1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonColor1.Click ColorBand1.Color = ButtonColor1.Color End Sub
1.5 TeeListBox
ChartListBox在運(yùn)行時(shí)顯示圖表中的Series列表,ChartListBox可用于為用戶提供有限的自定義和顯示/隱藏圖表系列。
1.6 Commander
Commander欄允許在運(yùn)行時(shí)向用戶提供導(dǎo)航和參數(shù)更改控制(通過TeeChart編輯器)。選擇導(dǎo)航按鈕并按住鼠標(biāo)左鍵,拖動(dòng)圖表面板以移動(dòng)圖表。
1.7 edit
edit允許自定義TeeChart編輯器:
[C#.Net]
private void Form1_Load(object sender, System.EventArgs e) { editor1.Chart = tChart1; line1.FillSampleValues(20); } private void button1_Click(object sender, System.EventArgs e) { editor1.DefaultTab = Steema.TeeChart.Editors.ChartEditorTabs.Legend; editor1.Title = "My Application Title"; editor1.ShowModal(); }
[VB.Net]
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Editor1.Chart = TChart1 Line1.FillSampleValues(20) End Sub Private Sub ButtonColor1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonColor1.Click Editor1.DefaultTab = Steema.TeeChart.Editors.ChartEditorTabs.Legend Editor1.Title = "My Application Title" Editor1.ShowModal() End Sub
1.8 GalleryPanel
GalleryPanel顯示可自定義的TeeChart系列圖庫。