I have the following code. I have hardcoded the x and y values to test. And for some reason for the point (0,-0.5) it plots (1,-0.5) For the life of me I do not know what is going on, because if you try other values then the graph displays correctly.
foreach (var grp in q)
{
point = new DataPoint();
Sum1 = grp.Sum1 > 2 ? 2 : grp.Sum1;
Sum1 = Sum1 < -2 ? -2 : Sum1;
Sum2 = grp.Sum2 > 2 ? 2 : grp.Sum2;
Sum2 = Sum2 < -2 ? -2 : Sum2;
point.XValue = 0;
point.YValues = new double[] { -0.5 };
chart1.Series.Add(grp.Id.ToString());
chart1.Series[grp.Id.ToString()].ChartType = SeriesChartType.Point;
chart1.Series[grp.Id.ToString()].Label = grp.Id.ToString();
chart1.Series[grp.Id.ToString()].Points.Add(point);
chart1.Series[grp.Id.ToString()].ToolTip = "THEMES = " + Sum1 + "\n PRICES = " + Sum2;
chart1.Series[grp.Id.ToString()].LabelToolTip = "THEMES = " + Sum1 + "\n PRICES = " + Sum2;
chart1.Series[grp.Id.ToString()].MarkerSize = 11;
chart1.Update();
if (grp.Id.ToString() == "WW" || grp.Id.ToString() == "PB"
|| grp.Id.ToString() == "AJ" || grp.Id.ToString() == "AK")
{
avgTheme += (float)Sum1;
avgPrice += (float)Sum2;
count++;
}
}
UPDATE:
this line needed to be added, works only with .NET 4.5
chart1.Series["ABC"].CustomProperties = "IsXAxisQuantitative=True";