Mark "Text" not displaying for a FastLine

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
BrayanSosa
Newbie
Newbie
Posts: 7
Joined: Tue Sep 12, 2017 12:00 am

Mark "Text" not displaying for a FastLine

Post by BrayanSosa » Fri May 03, 2024 7:21 pm

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.

Marc
Site Admin
Site Admin
Posts: 1274
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Mark "Text" not displaying for a FastLine

Post by Marc » Mon May 06, 2024 8:22 am

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
Steema Support

BrayanSosa
Newbie
Newbie
Posts: 7
Joined: Tue Sep 12, 2017 12:00 am

Re: Mark "Text" not displaying for a FastLine

Post by BrayanSosa » Mon May 06, 2024 1:43 pm

It worked, thank you very much for your help Marc!

Post Reply