visual basic how to plot points on a graph using the chart

Solutions on MaxInterview for visual basic how to plot points on a graph using the chart by the best coders in the world

showing results for - "visual basic how to plot points on a graph using the chart"
Federica
14 Jan 2017
1Imports System.Windows.Forms.DataVisualization.Charting
2Public Class Form1
3    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
4        Dim scatterChart As New Chart
5
6        'Create the series
7        scatterChart.Series.Add(New Series("Property1") With {.ChartType = SeriesChartType.Point, .Color = Color.Green})
8        scatterChart.Series.Add(New Series("Property2") With {.ChartType = SeriesChartType.Point, .Color = Color.Green})
9
10        'Set the minimum and maximums
11        scatterChart.ChartAreas.Add(New ChartArea)
12        scatterChart.ChartAreas(0).AxisX.Minimum = 0
13        scatterChart.ChartAreas(0).AxisX.Maximum = 100
14        scatterChart.ChartAreas(0).AxisY.Minimum = 0
15        scatterChart.ChartAreas(0).AxisY.Maximum = 100
16
17        'Invert the y axis
18        scatterChart.ChartAreas(0).AxisY.IsReversed = True
19
20        'Plot the 2 sample data
21        scatterChart.Series("Property1").Points.AddXY(50, 25)
22        scatterChart.Series("Property2").Points.AddXY(75, 65)
23
24        Me.Controls.Add(scatterChart)
25    End Sub
26End Class