原創(chuàng)|使用教程|編輯:何家巧|2022-12-21 16:49:52.953|閱讀 266 次
概述:本文主要介紹在圖標(biāo)控件TeeChart for .NET中如何實(shí)現(xiàn)圖表分頁,一起來看看吧~
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
TeeChart for .NET是優(yōu)秀的工業(yè)4.0 WinForm圖表控件,官方獨(dú)家授權(quán)漢化,集功能全面、性能穩(wěn)定、價(jià)格實(shí)惠等優(yōu)勢于一體。TeeChart for .NET 中文版還可讓您在使用和學(xué)習(xí)上沒有任何語言障礙,至少可以節(jié)省30%的開發(fā)時(shí)間。
在TeeChar系列教程中,上一章我們主要講解了如何實(shí)現(xiàn)圖表分頁,今天我們繼續(xù)為大家講解“軸控制的實(shí)現(xiàn)(上)”。
TeeChart Pro將自動為你定義所有軸的標(biāo)簽,并提供足夠的靈活性來定制你可能有的任何具體要求。TeeChart Pro提供真正的多軸。這些都可以在設(shè)計(jì)或運(yùn)行時(shí)使用,為軸的定義提供了無數(shù)的可能性和靈活性。
內(nèi)容軸控制 - 關(guān)鍵領(lǐng)域
非日期-時(shí)間數(shù)據(jù)
當(dāng)添加一個(gè)新的系列時(shí),TeeChart Editor的Axis Page的Scales部分將顯示自動選擇,其他選項(xiàng)為灰色。所有顯示的數(shù)值都是數(shù)字。[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運(yùn)行按鈕中的代碼將繪制一個(gè)具有40個(gè)隨機(jī)值的線型系列。在設(shè)計(jì)時(shí)轉(zhuǎn)到TeeChart編輯器。在 "軸 "頁面的 "底軸刻度 "部分將自動 "關(guān)閉"。你現(xiàn)在可以為軸刻度配置最大值和最小值。再次運(yùn)行代碼時(shí),將根據(jù)你為軸配置的值來顯示數(shù)值。使用鼠標(biāo)的右鍵,你可以滾動查看剩余的數(shù)值。
Setting axis scales by code你可以用這段代碼在運(yùn)行時(shí)改變最大和最小值。
[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
你可以單獨(dú)設(shè)置軸刻度的最大值和最小值為自動,例如:
[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
增量
您可以定制軸的區(qū)間。從軸頁面的Scales部分選擇Desired Increment組合框,添加你需要的增量。你可以在運(yùn)行時(shí)通過代碼來改變它。
[C#.Net] Steema.TeeChart.Axis bottomAxis = tChart1.Axes.Bottom; bottomAxis.Increment = 20; [VB.Net] With TChart1.Axes.Bottom .Increment = 20 End With
Datetime data
如果你的數(shù)據(jù)是數(shù)據(jù)時(shí)間(你可以通過進(jìn)入系列,常規(guī)頁面為你的系列設(shè)置數(shù)據(jù)為數(shù)據(jù)時(shí)間),圖表->軸頁面,刻度部分將顯示數(shù)據(jù)時(shí)間范圍。從 "期望的增量 "組合框中選擇增量,并添加一些樣本數(shù)據(jù)。
[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
在運(yùn)行時(shí)改變增量。
[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屬性以了解更多關(guān)于日期軸標(biāo)記的信息。
未完待續(xù),請看圖表控件TeeChart for .NET系列教程四:軸控制(中)
如果您想了解TeeChart for .NET價(jià)格,歡迎咨詢
TeeChart for .NET 是優(yōu)秀的工業(yè)4.0 WinForm圖表控件,官方獨(dú)家授權(quán)漢化,集功能全面、性能穩(wěn)定、價(jià)格實(shí)惠等優(yōu)勢于一體。
TeeChart for .NET技術(shù)交流QQ群:740060302 歡迎加入
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn