Marking of data using Color Band

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Nitin
Newbie
Newbie
Posts: 52
Joined: Fri Jun 30, 2006 12:00 am

Marking of data using Color Band

Post by Nitin » Fri Sep 04, 2009 5:59 am

Hi TeeChart Team,
Is it possible to select a range of data and show to the user with different color coding using mouse move over the bottom axis legend area?

What actually I want is –
I have 10 fastlineseries in one control in 10 different custom axes.
My X-axis is common for all the 10 fastlineseries. It is of type Date/Time.
Now i just want to move my mouse with left button down in the bottom axis label area and once the mouse is released the area between mouse down point and the mouse up point should get selected with different color coding. Please see the image below -
[img]
Marking.PNG
Marking.PNG (192.83 KiB) Viewed 8127 times
[/img]

I have tried using the ColorBand tool to do it. But the problem with the colorband tool is - i have to mention the axis for putting it. But as you can see in the image - the middle selection it is not associated with any axis. It is just like drawing a box inside the control with the start and end position provided by the mouse move operation in time axis rectangle.
Please let me know if i am able to make my things clear.:)

Nitin
Newbie
Newbie
Posts: 52
Joined: Fri Jun 30, 2006 12:00 am

Re: Marking of data using Color Band

Post by Nitin » Fri Sep 04, 2009 6:13 am

One more very critical point -
What ever i am doing in the control, i cant call refresh or invalidate for the whole control. Otherwise it will be a performance issue if i have a huge amount of data. Drawing any item in the chart should be done without refreshing the control.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Marking of data using Color Band

Post by Narcís » Fri Sep 04, 2009 8:10 am

Hi Nitin,

In that case I'd try using Rectangle or annotation tools without text for that. You'll have to specify left, top, width and height values for them which you can get from mouse events.
Best Regards,
Narcís Calvet / 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

Nitin
Newbie
Newbie
Posts: 52
Joined: Fri Jun 30, 2006 12:00 am

Re: Marking of data using Color Band

Post by Nitin » Fri Sep 11, 2009 1:02 pm

Hi,
I tried using rectangle tool to do it but once the tool is getting created, the control is getting refreshed.
I have huge data. So, refreshing the control is taking 5-8 seconds.
Dont know if i can use this tool on mouse move event or not.
Any idea?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Marking of data using Color Band

Post by Narcís » Mon Sep 14, 2009 10:21 am

Hi Nitin,

Yes, Rectangle tool supports mouse dragging and resizing. For preventing the whole chart to repaint and only painting a small region you can do as in this example:

Code: Select all

    private Annotation anno;

    private void InitializeChart()
    {
      timer1.Enabled = true;
      tChart1.Graphics3D.BufferStyle = BufferStyle.DoubleBuffer;
      //tChart1.AfterDraw += new PaintChartEventHandler(tChart1_AfterDraw);

      tChart1.Aspect.View3D = false;
      tChart1.Series.Add(typeof(Line));
      tChart1[0].FillSampleValues(10000);

      CursorTool cursor;
      tChart1.Tools.Add(cursor = new CursorTool());
      cursor.Style = CursorToolStyles.Vertical;
      cursor.FollowMouse = true;
      cursor.FastCursor = true; //try false
      cursor.Change += new CursorChangeEventHandler(cursor_Change);


      tChart1.Tools.Add(anno = new Annotation());
      anno.AutoSize = false;
      anno.Top = 10;
      anno.Left = 10;
      anno.Height = 20;
      anno.Width = 110;
      r1 = anno.Shape.ShapeBounds;
      tChart1.AutoRepaint = false;
    }

    void cursor_Change(object sender, CursorChangeEventArgs e)
    {
      anno.Text = e.XValue.ToString();
      tChart1.Invalidate(r1);
    }

    private Rectangle r1;
Best Regards,
Narcís Calvet / 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

Post Reply