Page 1 of 1

Mark "Text" not displaying for a FastLine

Posted: Fri May 03, 2024 7:21 pm
by 20081655
Good afternoon,
I have created a TeeChart called "TeeChart" and I have added a FastLine called "gateLine1" The way I am creating this FastLine is as follows:
private Steema.TeeChart.WPF.Styles.FastLine gateLine1 = new Steema.TeeChart.WPF.Styles.FastLine();
AddHorizontalLine(10, 25, Colors.LimeGreen, out gateLine1);
private void AddHorizontalLine(double xValue, double yValue, System.Windows.Media.Color lineColor, out Steema.TeeChart.WPF.Styles.FastLine line)
{
//FUNCTION: This function is used to add the Gain line markers
line = new Steema.TeeChart.WPF.Styles.FastLine();

//line = new Steema.TeeChart.WPF.Styles.Line();
line.Color = lineColor;
line.Add(xValue, 0);
line.Add(xValue, yValue);
line.Add(xValue + 30, yValue);
line.Add(xValue + 30, 0);

line.LinePen.Width = 2;
TeeChart.Series.Add(line);
}

All other functionalities for the FastLine work and I can see the FastLine when I run my application. I wanted to add a mark/label to it so that the user can differentiate what my FastLine is, I am trying to do this as follows:
AddHorizontalLine(10, 25, Colors.LimeGreen, out gateLine1);
AddMarksToFastLines(gateLine1, "G1");
private void AddMarksToFastLines(Steema.TeeChart.WPF.Styles.FastLine line, string text)
{
line.Marks.Visible = true;
line.Marks.Font.Size = 10;
line.Marks.Items[0].Text = text; //text won't properly display for some reason
line.Marks.Color = line.Color;

//Disable all other points from having markers
for (int i = 1; i < line.Count; i++)
{
line.Marks.Items.Visible = false;
}

TeeChart.Invalidate();
}

I see my Mark on the singular point that I want it to show on, however the text that I wanted it to show on the label ("G1") is not displaying and instead it is using the y-coord of the point the Mark is attached to. I would like my text to display instead of the y-coord how can I fix this? Please let me know if you want to see anything else to better support me.

Re: Mark "Text" not displaying for a FastLine

Posted: Mon May 06, 2024 8:22 am
by Marc
Hello,

Simpler I think, to use the GetSeriesMark event:

Code: Select all

....
fastLine1.GetSeriesMark += fastLine1_GetSeriesMark;
...

private void fastLine1_GetSeriesMark(Steema.TeeChart.WPF.Styles.Series series, Steema.TeeChart.WPF.Styles.GetSeriesMarkEventArgs e)
{
         if (e.ValueIndex == 0)
             e.MarkText = mytext; 
         else
             e.MarkText = "";
}
Regards,
Marc Meumann

Re: Mark "Text" not displaying for a FastLine

Posted: Mon May 06, 2024 1:43 pm
by 20081655
It worked, thank you very much for your help Marc!