Page 1 of 1

How to display some text in Tee chart.

Posted: Thu Nov 28, 2013 12:25 pm
by 13049533
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.

Re: How to display some text in Tee chart.

Posted: Thu Nov 28, 2013 4:09 pm
by 10050769
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,

Re: How to display some text in Tee chart.

Posted: Fri Nov 29, 2013 8:48 am
by 13049533
Hi sandra,

Thanks for your help. it works well.

regards,
biji

Re: How to display some text in Tee chart.

Posted: Tue Dec 03, 2013 12:09 pm
by 13049533
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.

Re: How to display some text in Tee chart.

Posted: Tue Dec 03, 2013 12:59 pm
by Christopher
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.

Re: How to display some text in Tee chart.

Posted: Wed Dec 04, 2013 10:00 am
by 13049533
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.

Re: How to display some text in Tee chart.

Posted: Wed Dec 04, 2013 10:22 am
by Christopher
Hello Biji,

You're very welcome.

_/|\_