0

I'm using the Windows.Forms.DataVisualization.Charting class to draw a simple char plotting a simple courb.

My courb is correclty plotted, but the points are not shown. Like dots or crosses where the points are. I tried using datapoint.BackImage, but that doesn't show anything.

I'm sure that the image is found because I store other images in the exact same folder, and they are correctly read when I use the same path.

The code where I feed the DataPoint:

foreach (MesureTaille mesureTaille in tailles)
{
    DataPoint point = new DataPoint(mesureTaille.age, mesureTaille.taille);

    point.BackImage = string.Concat(
       Application.StartupPath.Remove(Application.StartupPath.IndexOf("\\bin\\Debug")),
     "/BackgoundImage/dot.png");
    Serie_Age_Taille.Points.Add(point);
}
Amon
  • 296
  • 1
  • 14
  • 3
    I guess you need to use [`Series`](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.datavisualization.charting.series?view=netframework-4.8).[`MarkerStyle`](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.datavisualization.charting.datapointcustomproperties.markerstyle?view=netframework-4.8#System_Windows_Forms_DataVisualization_Charting_DataPointCustomProperties_MarkerStyle) and associated properties. – DavidG Jul 17 '19 at 10:04
  • [Markers example](https://stackoverflow.com/questions/39065172/is-there-a-way-to-draw-a-point-on-a-polar-chart/39066079?r=SearchResults&s=1|47.3489#39066079) can have various shapes, sizes and colors and can be set for a whole series or for separate points. - Also note that images in a chart (when actaully needed) should br loaded from the Chart.Images collection which will host NamedImages. [Examples](https://stackoverflow.com/search?q=user%3A3152130+chart+NamedImage) – TaW Jul 17 '19 at 10:44

1 Answers1

0

As DavidG and TaW pointed out, what I needed was Series.MarkerStyle :

// This line sets the dots !
Serie_Age_Taille.MarkerStyle = MarkerStyle.Cross;

foreach (MesureTaille mesureTaille in tailles)
{
       // And I don't need to do anything on the DataPoints
       DataPoint point = new DataPoint(mesureTaille.age, mesureTaille.taille);
       Serie_Age_Taille.Points.Add(point);
}
Amon
  • 296
  • 1
  • 14