I have added Marks in Line series, But when we are adding marks in same x-axis then it is showing both marks previously added and new one also. i wanted to show only last one.
m_ctrlChart.AddSeries(scLine);
m_ctrlChart.Series(0).AddNullXY(0, 5, "");
m_ctrlChart.Series(0).AddXY(22, 5, "C", 0); // Here we have added 'C' on 22.
m_ctrlChart.Series(0).AddXY(22, 5, "SMP", 0); // Again we have added SMP on 22.
m_ctrlChart.Series(0).AddXY(40, 5, "G", 0);
m_ctrlChart.Series(0).SetTitle(LPCTSTR("Line Series 0"));
CSeriesPointerItems pointerit = m_ctrlChart.Series(0).GetAsLine().GetPointer();
pointerit.SetVisible(TRUE);
pointerit.SetStyle(psStar);
pointerit.GetBrush().SetStyle(bsClear);
But we wanted to show 'SMP' on 22 x-axis and wanted to clear C from that location.
Thanks, Prabhat.
TeeChart shows the both Marks "C" and "SMP" because you are adding two Points with the same XValue
here:
m_ctrlChart.Series(0).AddXY(22, 5, "C", 0); // Here we have added 'C' on 22.
m_ctrlChart.Series(0).AddXY(22, 5, "SMP", 0); // Again we have added SMP on 22.
I understand you want to modify a Label, rather than adding a new point.
In that case, the first thing you need to know is the index
of the point for the label to modify. In the code you posted, you made both calls consecutive, so, the point to be modified is the last on the series at that moment:
index = m_ctrlChart.Series(0).getCount()-1;
Alternatively, you can use the return value AddXY() call has given. Ie:
index = m_ctrlChart.Series(0).AddXY(22, 5, "C", 0); // Here we have added 'C' on 22.
Then, once you have the index
of the point to modify, you are ready to use it:
m_ctrlChart.Series(0).SetPointLabel(index, "SMP");