Miten saa annettua tiedot x-y taulukosta Chart-controlliin? Pitäisi saada kolme eri käyrää samaan kaavioon. (Visual Basic 2010 Express). Anttij
Moi anttij!
vääntele oheisen esimerkin pohjalta...
Public Partial Class MainForm Private Structure xy_struct Dim x As Integer Dim y As Integer End Structure Private xy_arvot (9, 2) As xy_struct 'esim. Public Sub New() Me.InitializeComponent() End Sub Sub MainForm_Load(sender As Object, e As EventArgs) For i As Integer = 0 To xy_arvot.GetUpperBound(0) For j As Integer = 0 To xy_arvot.GetUpperBound(1) 'tämä on vain esimerkki xy-arvojen määrittelystä xy_arvot(i, j).x = _ CType((i + 1) * 10 / (j * i + 3), Integer) xy_arvot(i, j).y = _ CType((j + 1) * 10 / (i + j + 1), Integer) Next j Next i chart1.Series.Clear For i As Integer = 0 To 2 chart1.Series.Add("Sarja" & (i + 1).ToString) Next For i As Integer = 1 To chart1.Series.Count chart1.Series("Sarja" & CStr(i)).ChartType = _ DataVisualization.Charting.SeriesChartType.Spline Next For i As Integer = 0 To xy_arvot.GetUpperBound(0) For j As Integer = 0 To xy_arvot.GetUpperBound(1) chart1.Series("Sarja" & CStr(j + 1)).Points.AddXY( _ xy_arvot(i, j).x, xy_arvot(i, j).y) Next j Next i End Sub End Class
(oikea nimi)
Aihe on jo aika vanha, joten et voi enää vastata siihen.