原創|使用教程|編輯:何家巧|2022-12-21 16:49:52.953|閱讀 266 次
概述:本文主要介紹在圖標控件TeeChart for .NET中如何實現圖表分頁,一起來看看吧~
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
TeeChart for .NET是優秀的工業4.0 WinForm圖表控件,官方獨家授權漢化,集功能全面、性能穩定、價格實惠等優勢于一體。TeeChart for .NET 中文版還可讓您在使用和學習上沒有任何語言障礙,至少可以節省30%的開發時間。
在TeeChar系列教程中,上一章我們主要講解了如何實現圖表分頁,今天我們繼續為大家講解“軸控制的實現(上)”。
TeeChart Pro將自動為你定義所有軸的標簽,并提供足夠的靈活性來定制你可能有的任何具體要求。TeeChart Pro提供真正的多軸。這些都可以在設計或運行時使用,為軸的定義提供了無數的可能性和靈活性。
內容軸控制 - 關鍵領域
非日期-時間數據
當添加一個新的系列時,TeeChart Editor的Axis Page的Scales部分將顯示自動選擇,其他選項為灰色。所有顯示的數值都是數字。[C#.Net] Random rnd = new Random(); for(int i = 0; i <= 40; ++i) line1.Add(Convert.ToDouble(i),rnd.Next(100),Color.Red); [VB.Net] Dim i As Integer For i = 0 To 40 Line1.Add(Convert.ToDouble(i), Rnd() * 100, Color.Red) Next i運行按鈕中的代碼將繪制一個具有40個隨機值的線型系列。在設計時轉到TeeChart編輯器。在 "軸 "頁面的 "底軸刻度 "部分將自動 "關閉"。你現在可以為軸刻度配置最大值和最小值。再次運行代碼時,將根據你為軸配置的值來顯示數值。使用鼠標的右鍵,你可以滾動查看剩余的數值。
Setting axis scales by code你可以用這段代碼在運行時改變最大和最小值。
[C#.Net] Steema.TeeChart.Axis bottomAxis = tChart1.Axes.Bottom; bottomAxis.Automatic = false; bottomAxis.Maximum = 36; bottomAxis.Minimum = 5; [VB.Net] With TChart1.Axes.Bottom .Automatic = False .Maximum = 36 .Minimum = 5 End With
你可以單獨設置軸刻度的最大值和最小值為自動,例如:
[C#.Net] Steema.TeeChart.Axis bottomAxis = tChart1.Axes.Bottom; bottomAxis.AutomaticMaximum = true; bottomAxis.AutomaticMinimum = false; bottomAxis.Minimum = 5; [VB.Net] With TChart1.Axes.Bottom .AutomaticMaximum = True .AutomaticMinimum = False .Minimum = 5 End With
增量
您可以定制軸的區間。從軸頁面的Scales部分選擇Desired Increment組合框,添加你需要的增量。你可以在運行時通過代碼來改變它。
[C#.Net] Steema.TeeChart.Axis bottomAxis = tChart1.Axes.Bottom; bottomAxis.Increment = 20; [VB.Net] With TChart1.Axes.Bottom .Increment = 20 End With
Datetime data
如果你的數據是數據時間(你可以通過進入系列,常規頁面為你的系列設置數據為數據時間),圖表->軸頁面,刻度部分將顯示數據時間范圍。從 "期望的增量 "組合框中選擇增量,并添加一些樣本數據。
[C#.Net] Random rnd = new Random(); DateTime today = DateTime.Today; TimeSpan oneDay = TimeSpan.FromDays(1); line1.XValues.DateTime = true; for(int i = 1; i <= 25; ++i) line1.Add(today,rnd.Next(100),Color.Red); today += oneDay; [VB.Net] Dim i As Integer Dim Today As DateTime = DateTime.Today Dim OneDay As TimeSpan = TimeSpan.FromDays(1) Line1.XValues.DateTime = True For i = 1 To 25 Line1.Add(Today, Rnd() * 100, Color.Red) Today = Today.Add(OneDay) Next
在運行時改變增量。
[C#.Net] Steema.TeeChart.Axis bottomAxis = tChart1.Axes.Bottom; bottomAxis.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.TwoDays); [VB.Net] With TChart1.Axes.Bottom .Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.TwoDays) End With
參見AxisLabels.ExactDateTime屬性以了解更多關于日期軸標記的信息。
未完待續,請看圖表控件TeeChart for .NET系列教程四:軸控制(中)
如果您想了解TeeChart for .NET價格,歡迎咨詢
TeeChart for .NET 是優秀的工業4.0 WinForm圖表控件,官方獨家授權漢化,集功能全面、性能穩定、價格實惠等優勢于一體。
TeeChart for .NET技術交流QQ群:740060302 歡迎加入
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn