如何在数据点所在的图表上放置点?

时间:2019-07-17 10:02:27

标签: c# winforms

我正在使用Windows.Forms.DataVisualization.Charting类来绘制一个简单的字符,绘制一个简单的courb。

我的courb是正确绘制的,但未显示这些点。像点或点所在的十字形。 我尝试使用datapoint.BackImage,但是什么都没显示

我确定找到了该图像,因为我将其他图像存储在完全相同的文件夹中,并且在使用相同路径时可以正确读取它们。

输入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);
}

1 个答案:

答案 0 :(得分:0)

正如DavidG和TaW所指出的,我需要的是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);
}