Hello,
I'm using the Microsoft Chart Controls for Microsoft .NET Framework 3.5 and am having a spot of trouble getting Data Markers to show on the image.
I'm generating the chart at run-time, so can't just use the designer.
Sub New()
MainChart = New Chart
MainChart.Size = New Drawing.Size(500, 200)
MainArea = New ChartArea()
With MainArea
.Name = "Default"
.AxisX.LabelStyle.Format = "MMM"
.AxisX.MajorGrid.Enabled = False
.AxisX.IsLabelAutoFit = False
.AxisY.MajorGrid.LineColor = Drawing.Color.Gainsboro
.AxisY.IsLabelAutoFit = True
.AxisY.Minimum = 0
.AxisY.Maximum = 50
End With
MainChart.ChartAreas.Add(MainArea)
MainSeries = New Series()
With MainSeries
.ChartArea = "Default"
.Name = "MainSeries"
.ChartType = SeriesChartType.Line ''# .FastLine would hide markers...
.IsXValueIndexed = True
.XValueType = ChartValueType.Date
.MarkerSize = 9
.MarkerStyle = MarkerStyle.Diamond
.ToolTip = "#VALX: #VAL"
End With
MainChart.Series.Add(MainSeries)
End Sub
I then add a bunch of data points using
Public Sub AddDataPoint(ByVal X As Date, ByVal Y As Double)
MainSeries.Points.AddXY(X, Y)
End Sub
After that, I can save the chart as an image
Public Sub SaveImage(ByVal Filename As String)
MainChart.SaveImage(Filename, ChartImageFormat.Png)
End Sub
Which all works lovely, and I get pretty charts. The only problem is that there are no markers on the datapoints.
Can anyone shed any light on what I'm doing wrong?