Questions

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
madve
Newbie
Newbie
Posts: 52
Joined: Thu Feb 16, 2006 12:00 am

Questions

Post by madve » Sun Aug 06, 2006 7:58 pm

Hi,

Q1.: I would like use the same Legend style with area style series as with line style series (a small line with LinePen.Color and a Pointer).

--[]-- line1
--[]-- area1 <--- that's what I want
--()-- line2

How can I do that?

Q2: When I set Pointer.Brush.Color there is no effect, the pointer always have a same color as a Line. How can I use a different Pointer color? (for example: a green line with red pointers)

Thanks in advance,

Gabor Varga

madve
Newbie
Newbie
Posts: 52
Joined: Thu Feb 16, 2006 12:00 am

Post by madve » Mon Aug 07, 2006 7:35 pm

Hi,

Q3: I want to use MarkTips to show the Series name when the user move the cursor over the serie. I set the Chart Style of the Legend to Series Names and the MarkTips Style to Legend but it shows only the value of the Series.

What is the correct method to show what I want?

Q4: I have a DateTime Bottom axis and I set the following:

Code: Select all

with MyChart.Axes.Bottom do
    begin
      Labels.DateTimeFormat := 'yyyy.MM.dd HH:mm:ss';
      Labels.MultiLine := true;
      Labels.Separation := 0;
      Labels.ExactDateTime := True;
      Increment := Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneHour);
      LabelsOnAxis := True;
      Labels.RoundFirstLabel := False;
    end;
But I see no effect when I set Separation, Increment, RoundFirstLabel...

How can I show Label on axis Minimum and Maximum, and how can I set axis Increment?

Thanks in advance,

Gabor Varga

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Tue Aug 08, 2006 9:03 am

Hello Gabor,
Q1.: I would like use the same Legend style with area style series as with line style series (a small line with LinePen.Color and a Pointer).
Try setting the pointer of the area series to true:

Code: Select all

area1.Pointer.Visible = true;
Q2: When I set Pointer.Brush.Color there is no effect, the pointer always have a same color as a Line. How can I use a different Pointer color? (for example: a green line with red pointers)
I've been able to reproduce this issue and have fixed it for the next maintenance release which is due to be released in early September.
Q3: I want to use MarkTips to show the Series name when the user move the cursor over the serie. I set the Chart Style of the Legend to Series Names and the MarkTips Style to Legend but it shows only the value of the Series.
Try using an annotation tool in conjunction with the mousemove event, e.g.

Code: Select all

    private void tChart1_MouseMove(object sender, MouseEventArgs e)
    {
      int series1 = line1.Clicked(e.X, e.Y);
      int series2 = line2.Clicked(e.X, e.Y);
      int series3 = area1.Clicked(e.X, e.Y);

      anno1.Shape.CustomPosition = true;
      anno1.Left = e.X;
      anno1.Top = e.Y;

      if (series1 != -1)
      {
        anno1.Active = true;
        anno1.Text = "Line1";
      }
      else if (series2 != -1)
      {
        anno1.Active = true;
        anno1.Text = "Line2";
      }
      else if (series3 != -1)
      {
        anno1.Active = true;
        anno1.Text = "Area1";
      }
      else
      {
        anno1.Active = false;
      }
    }
Q4: I have a DateTime Bottom axis and I set the following:
The increment works ok with the following code:

Code: Select all

private void InitializeChart()
    {
      line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
      
      DateTime now = DateTime.Now;
      Random rnd = new Random();
      int length = 10;
      for (int i = 0; i < length; i++)
      {
        now = now.AddMinutes(10);
        line1.Add(now, rnd.NextDouble());
      }
      tChart1.Axes.Bottom.Labels.DateTimeFormat = "yyyy.MM.dd HH:mm:ss";
      tChart1.Axes.Bottom.Labels.MultiLine = true;
      tChart1.Axes.Bottom.Increment = ((1.0 / 24.0) / 60.0) * 20.0; //Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.FifteenMinutes);
    }
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

madve
Newbie
Newbie
Posts: 52
Joined: Thu Feb 16, 2006 12:00 am

Post by madve » Tue Aug 08, 2006 6:39 pm

Hello Christopher,

Thanks for you reply, I tried what you suggest but I have some comments:

Q1: OK, Pointer works fine, but the color of the line in Legend is not the Linepen.Color. (In our application all series are Lines, for us Area is a special Line which have filled area.)

Q4: Try to increment length variable from 10 to 1000. Bottom label Increment comes to daily, no label at minimum and maximum.

Best regards,

Gabor Varga

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Wed Aug 09, 2006 10:58 am

Hello,
Q1: OK, Pointer works fine, but the color of the line in Legend is not the Linepen.Color. (In our application all series are Lines, for us Area is a special Line which have filled area.)
I'm sorry, but I'm a little confused as to the code you could be using. Would you be so kind as to send me a little code snippet that I could run to see what you mean?
Q4: Try to increment length variable from 10 to 1000. Bottom label Increment comes to daily, no label at minimum and maximum.
Yes, this is because there are too many labels to be shown at the specified increment and therefore the chart automatically changes it.
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

madve
Newbie
Newbie
Posts: 52
Joined: Thu Feb 16, 2006 12:00 am

Post by madve » Wed Aug 09, 2006 12:20 pm

Hi,

Q1: Add a Line and an Area to the TChart.

Set Border of the Area with the following properties:

Visible,
Style : Solid,
Color : Yellow
Width : 5

(In Editor: Series / Format / Border...)

In Legend you will see a the following:

----- line1 (a red line with "line1" caption)
[] area1 (a green rectangle with "area1" caption)

But I want to see the following

----- line1 (a red line with "line1" caption)
=== area1 (a 5 points width yellow line with caption "area1")

Q4: How can I force to show label at the Minimum and at the Maximum of the Axis? (And how can I force to show all Labels?)

Thanks,

Gabor Varga

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Thu Aug 10, 2006 3:11 pm

Hello,
Q1: Add a Line and an Area to the TChart.
OK. You could always try something like the following. Changing the shape of the Legend symbol is not going to be possible any other way at the moment.

Code: Select all

    private void button1_Click(object sender, EventArgs e)
    {
      tChart1.Series.Add(new Steema.TeeChart.Styles.Line());
      tChart1.Series.Add(new Steema.TeeChart.Styles.Area());
      tChart1.Series.Add(new Steema.TeeChart.Styles.Line());
      
      tChart1[1].ShowInLegend = false;
      tChart1[2].Title = "area1";

      tChart1[0].FillSampleValues();
      tChart1[1].FillSampleValues();

      (tChart1[2] as Line).LinePen.Width = 5;
 
      for (int i = 0; i < tChart1[1].Count; ++i)
      {
        tChart1[2].Add(tChart1.Series[1].XValues[i], tChart1.Series[1].YValues[i]);
      }
    }
Q4: How can I force to show label at the Minimum and at the Maximum of the Axis? (And how can I force to show all Labels?)
Setting the separation to zero will force all labels to draw if tchart thinks it can draw them all, however, it will not draw them all if it considers that doing so would produce an unreadable chart.
As for choosing which labels to display, you might want to have a look at the tutorials and specifically the tutorials on axes where it talks about the GetNextAxisLabel event.
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Thu Aug 10, 2006 4:13 pm

Hello,
As for choosing which labels to display, you might want to have a look at the tutorials and specifically the tutorials on axes where it talks about the GetNextAxisLabel event.
A quick and dirty way of doing this would be to add in your datatime values as labels, e.g.

Code: Select all

 private void InitializeChart()
    {
      int length = 10;
      DateTime now = DateTime.Now;
      Random rnd = new Random();
      tChart1.Axes.Bottom.Labels.DateTimeFormat = "hh:mm";
      for (int i = 0; i < length; i++)
      {
        line1.Add(now, rnd.NextDouble(), now.ToString(tChart1.Axes.Bottom.Labels.DateTimeFormat));
        now = now.AddHours(1);
      }
    }
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

madve
Newbie
Newbie
Posts: 52
Joined: Thu Feb 16, 2006 12:00 am

Post by madve » Sun Aug 13, 2006 5:27 pm

Hi,

Q1: OK, but I would like to have an event when user make invisible the tchart[ 2 ] serie with checking out the checkbox in the Legend to make tchart[ 1 ] invisible from code.

Best regards,

Gabor Varga

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Mon Aug 14, 2006 10:07 am

Hello,

Sure, you can use:

Code: Select all

    private void tChart1_ClickLegend(object sender, MouseEventArgs e)
    {
      line2.Active = line1.Active;
    }
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply