How to display some text in Tee chart.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
biji
Newbie
Newbie
Posts: 35
Joined: Wed Jul 02, 2008 12:00 am

How to display some text in Tee chart.

Post by biji » Thu Nov 28, 2013 12:25 pm

Hi,

I would like to display some text on left top corner in tee chart. Can anyone help me how to do this. As shown in the image below.

Thanks.
Attachments
image.jpg
image.jpg (17.98 KiB) Viewed 14406 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: How to display some text in Tee chart.

Post by Sandra » Thu Nov 28, 2013 4:09 pm

Hello bijit,

I think you can use annotation tool to add the titles let-top corner as do in next lines of code:

Code: Select all

 private void AddTitles()
        {
          tChart1.Draw();
          //Create Annotations

          anSeries1 = new Steema.TeeChart.Tools.Annotation(tChart1.Chart);
          //First Title
          anSeries1.Text = "Hello";
          anSeries1.Shape.Font.Color = Color.Black;
          anSeries1.Shape.Font.Bold = true;
          //position
          anSeries1.Left = rect.Left;
          anSeries1.Top = tChart1.Axes.Right.IStartPos;
          anSeries1.Shape.Pen.Visible = false;
          anSeries1.Shape.Shadow.Visible = false; 
          anSeries1.Shape.Brush.Transparency = 100;
         
        }
Could you confirm us if previous code works in your end?

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

biji
Newbie
Newbie
Posts: 35
Joined: Wed Jul 02, 2008 12:00 am

Re: How to display some text in Tee chart.

Post by biji » Fri Nov 29, 2013 8:48 am

Hi sandra,

Thanks for your help. it works well.

regards,
biji

biji
Newbie
Newbie
Posts: 35
Joined: Wed Jul 02, 2008 12:00 am

Re: How to display some text in Tee chart.

Post by biji » Tue Dec 03, 2013 12:09 pm

Hi Sandra,

The above code working well to display some text on teechart.

I have a small problem here, how to refresh the text because I have written one text first and when i load another chart data then it has to replace the old text with new text but what happening with the above code is it it was not replacing but it was overwriting the old text. Both text's are displaying at the same place.

could you tel me how to refresh or replace the old text with new?

I have tried with

Code: Select all

 tChart1.Refresh();
but still i have same problem.

Thanks,
biji.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to display some text in Tee chart.

Post by Christopher » Tue Dec 03, 2013 12:59 pm

Hello Biji,

Maybe when you load another chart data you are creating two annotation tools, one of which is on top of the other. You could check if you already have an Annotation on the chart by code like this (press the button twice):

Code: Select all

    Annotation anSeries1;

    private void button1_Click(object sender, EventArgs e)
    {
      if (anSeries1 == null)
      {
        anSeries1 = new Steema.TeeChart.Tools.Annotation(tChart1.Chart);
        //First Title
        anSeries1.Text = "Hello";
        anSeries1.Shape.Font.Color = Color.Black;
        anSeries1.Shape.Font.Bold = true;
        //position
        anSeries1.Left = 100;
        anSeries1.Top = tChart1.Axes.Right.IStartPos;
        anSeries1.Shape.Pen.Visible = false;
        anSeries1.Shape.Shadow.Visible = false;
        anSeries1.Shape.Brush.Transparency = 100;
      }
      else
      {
        anSeries1.Text = "New Hello";
      }
    }
if this is not the problem you have, could you please add a little code to your reply so I can reproduce the problem here?

Thank you,

Christopher Ireland.

biji
Newbie
Newbie
Posts: 35
Joined: Wed Jul 02, 2008 12:00 am

Re: How to display some text in Tee chart.

Post by biji » Wed Dec 04, 2013 10:00 am

Hi Christopher,

yes, your guess was correct. I was creating two annotation tools, but i thought when you refresh chart it will disappear. Now i have used your logic, it works well.

Thanks allot.
biji.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to display some text in Tee chart.

Post by Christopher » Wed Dec 04, 2013 10:22 am

Hello Biji,

You're very welcome.

_/|\_
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply