系列價(jià)值表
TeeChart for .NET制圖控件提供了一套出色的通用組件套件,可滿足無(wú)數(shù)的制圖要求,也針對(duì)重要的垂直領(lǐng)域,例如金融,科學(xué)和統(tǒng)計(jì)領(lǐng)域。制圖控件提供了一套出色的通用組件套件,可滿足無(wú)數(shù)的制圖要求,也針對(duì)重要的垂直領(lǐng)域,例如金融,科學(xué)和統(tǒng)計(jì)領(lǐng)域。
TeeChart 系列將其值存儲(chǔ)在可通過(guò) ValueList 類訪問和修改的 Valuelist 中。
加入官方社群740060302,歡迎相互交流
訪問序列值
你可以訪問列表中的任何值:
例子
[C#]
MessageBox.Show(bar1.YValues[3].ToString()); //Displays value of 4th point (index starts at 0) of a BarSeries
點(diǎn)擊復(fù)制
[VB.Net]
MsgBox(Bar1.YValues(3)) 'Displays value of 4th point (index starts at 0) of a BarSeries
點(diǎn)擊復(fù)制
以這種方式訪問的值可用于對(duì)Series數(shù)據(jù)設(shè)置陷阱:
[C#]
for(int i = 0; i < bar1.Count; ++i) { if(bar1.YValues[i] > 500) { MessageBox.Show("Value: (" + bar1.XValues[i] + ", " + bar1.YValues[i] + ") exceeds limit"); } }
點(diǎn)擊復(fù)制
[VB.Net]
Dim i As Integer For i = 0 To Bar1.Count If Bar1.YValues(i) > 500 Then MsgBox("Value: (" & Bar1.XValues(i) & ", " & Bar1.YValues(i) & ") exceeds limit") End If Next
點(diǎn)擊復(fù)制
通過(guò)一些Series方法和幾個(gè)Chart事件使用的ValueIndex點(diǎn)也可以獲得相同的值。
例子
[C#]
private void tChart1_ClickSeries(object sender, Steema.TeeChart.Styles.Series s, int valueIndex, System.Windows.Forms.MouseEventArgs e) { if(s.Equals(bar1)) { MessageBox.Show("ValueIndex is: " + valueIndex.ToString()); MessageBox.Show("Point's YValue is " + bar1.YValues[valueIndex].ToString()); } }
點(diǎn)擊復(fù)制
[VB.Net]
Private Sub TChart1_ClickSeries(ByVal sender As Object, ByVal s As Steema.TeeChart.Styles.Series, ByVal valueIndex As Integer, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TChart1.ClickSeries If s Is Bar1 Then MsgBox("ValueIndex is: " & valueIndex) MsgBox("Point's YValue is " & Bar1.YValues(valueIndex)) End If End Sub
點(diǎn)擊復(fù)制
使用值的示例
這段代碼根據(jù)用戶的鼠標(biāo)點(diǎn)擊修改BarSeries Bar的值。
例子
使用TChart。使用ClickSeries事件來(lái)確定用戶點(diǎn)擊了哪里。
[C#]
private void tChart1_ClickSeries(object sender, Steema.TeeChart.Styles.Series s, int valueIndex, System.Windows.Forms.MouseEventArgs e) { UpDatePoint(valueIndex,tChart1.Axes.Left.CalcPosPoint((e.Y))); }
點(diǎn)擊復(fù)制
[VB.Net]
Private Sub TChart1_ClickSeries(ByVal sender As Object, ByVal s As Steema.TeeChart.Styles.Series, ByVal valueIndex As Integer, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TChart1.ClickSeries UpDatePoint(valueIndex, TChart1.Axes.Left.CalcPosPoint(e.Y)) End Sub
點(diǎn)擊復(fù)制
調(diào)用UpdatePoint子例程來(lái)修改Bar的值:
[C#]
private void UpDatePoint(int Bar, double Y) { if(Bar < tChart1.Series[0].Count) { tChart1.Series[0].YValues[Bar] = Y; tChart1.Series[0].Repaint(); } }
點(diǎn)擊復(fù)制
[VB.Net]
Private Sub UpDatePoint(ByVal Bar As Integer, ByVal Y As Double) If Bar < TChart1.Series(0).Count Then TChart1.Series(0).YValues(Bar) = Y TChart1.Series(0).Repaint() End If End Sub
點(diǎn)擊復(fù)制
如需下載產(chǎn)品TeeChart for NET ,請(qǐng)點(diǎn)擊產(chǎn)品名進(jìn)入下載頁(yè)面