Option Strict On Imports System.Windows.Forms.DataVisualization.Charting Public Class Form1 Private WithEvents Chart1 As Chart Private WithEvents ComboBox1 As ComboBox Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Chart1 = New Chart() With {.Dock = DockStyle.Fill} Controls.Clear() Controls.Add(Chart1) ComboBox1 = New ComboBox() With {.Dock = DockStyle.Top} ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList ComboBox1.DataSource = [Enum].GetValues(GetType(SeriesChartType)) Controls.Add(ComboBox1) Chart1.Series.Clear() Chart1.ChartAreas.Clear() Dim ca = Chart1.ChartAreas.Add("CA") Dim s1 = Chart1.Series.Add("S1") Dim s2 = Chart1.Series.Add("S2") s1.BorderWidth = 3 s1.BorderDashStyle = ChartDashStyle.Dot s1.ChartType = SeriesChartType.Line s2.MarkerSize = 15 s2.MarkerStyle = MarkerStyle.Circle s2.MarkerColor = Color.BlueViolet s2.ChartType = SeriesChartType.Point s2.BorderDashStyle = ChartDashStyle.Solid ComboBox1.SelectedItem = s1.ChartType AddHandler ComboBox1.SelectionChangeCommitted, Sub() s1.ChartType = DirectCast(ComboBox1.SelectedItem, SeriesChartType) s2.Points.AddXY(3, 5) s2.Points.AddXY(4, 55) s2.Points.AddXY(5, 25) s2.Points.AddXY(1, 70) s1.Points.AddXY(1, 10) s1.Points.AddXY(3, 30) s1.Points.AddXY(2, 10) s1.Points.AddXY(2, 40) s1.Points.AddXY(4, 80) s1.Points.AddXY(3, 80) s1.Points(0).Color = Color.OrangeRed s1.Points(1).Color = Color.ForestGreen s1.Points(2).Color = Color.DeepPink s1.Points(3).Color = Color.DarkCyan s1.Points(4).Color = Color.DarkGoldenrod s1.Points(5).Color = Color.Aqua s1.Points.ToList().ForEach(Sub(p) p.MarkerSize = 21) s1.Points(0).MarkerStyle = MarkerStyle.Square s1.Points(1).MarkerStyle = MarkerStyle.Cross s1.Points(2).MarkerStyle = MarkerStyle.Diamond s1.Points(3).MarkerStyle = MarkerStyle.Star5 s1.Points(4).MarkerStyle = MarkerStyle.Triangle s1.Points(5).MarkerStyle = MarkerStyle.Star10 End Sub Private Sub Chart2_PrePaint(sender As Object, e As ChartPaintEventArgs) Handles Chart1.PrePaint Dim cg = e.ChartGraphics Dim pre As PointF? = Nothing Using myPen As New Pen(Brushes.BlueViolet, 4) myPen.DashStyle = Drawing2D.DashStyle.Dash For Each p In Chart1.Series("S2").Points Dim x = cg.GetPositionFromAxis("CA", AxisName.X2, p.XValue) Dim y = cg.GetPositionFromAxis("CA", AxisName.Y2, p.YValues(0)) Dim cur = cg.GetAbsolutePoint(New PointF(CSng(x), CSng(y))) If pre IsNot Nothing Then e.ChartGraphics.Graphics.DrawLine(myPen, pre.Value, cur) End If pre = cur Next End Using End Sub End Class