Zooming of Annotation tool

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Avijit
Newbie
Newbie
Posts: 72
Joined: Tue Sep 15, 2009 12:00 am

Zooming of Annotation tool

Post by Avijit » Tue Oct 27, 2009 11:01 pm

Hi,
I have used the Annotation tool for highlighting a section of data in my chart control.
I have 10 Fastline series data. User can move the mouse at the bottom of the control to select or highlight a section of data.
I have to provide the top, left, height and width to the Annotation tool for highlighting the data.
See the image below.
DataSelectionUsingMouseMove.JPG
DataSelectionUsingMouseMove.JPG (81.52 KiB) Viewed 20326 times
Now, when i am zooming the trend control - the Annotation tool is not getting resized. In the below image, i have zoomed the data but the Annotation tool is still of same size.
AnnotationToolAfterZoom.JPG
AnnotationToolAfterZoom.JPG (59.12 KiB) Viewed 20323 times
In the RectangleTool this problem is not there. It is only specific to Annotation tool.
Can you suggest me a way to solve this problem.

Regards,
Avijit

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Zooming of Annotation tool

Post by Yeray » Wed Oct 28, 2009 3:10 pm

Hi Avijit,

First of all, I'd like to suggest you to use a ColorBandTool that, if I understand you well, was designed for doing what are you exactly trying to achieve.
And with annotations, the problem is that you have to reposition them each time the chart is resized or repainted using positions relative to the chart. For example, for the Zoom you could use Zoomed event:

Code: Select all

tChart1.Zoomed += new EventHandler(tChart1_Zoomed);
And do something like this:

Code: Select all

        void tChart1_Zoomed(object sender, EventArgs e)
        {
            tChart1.Draw();
            RecalcAnnotation();
        }
        private void RecalcAnnotation()
        {
            annot1.Left = tChart1.Axes.Bottom.CalcPosValue(5);
            annot1.Width = tChart1.Axes.Bottom.CalcPosValue(10) - annot1.Left;
            annot1.Top = tChart1.Axes.Left.IStartPos;
            annot1.Height = tChart1.Axes.Left.IEndPos - annot1.Top;
        }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Avijit
Newbie
Newbie
Posts: 72
Joined: Tue Sep 15, 2009 12:00 am

Re: Zooming of Annotation tool

Post by Avijit » Wed Oct 28, 2009 4:57 pm

Hi Yeray,

Please let me know if i can specify the left, width, top and height of the ColorBand tool.
Please have a look at the screenshot below from our own product that has been developed using MFC-
Marking.JPG
Marking.JPG (57.58 KiB) Viewed 20279 times
Now let me know if it is possible to use the ColorBand tool to do these kind of highlightings in TeeChart control.
I think ColorBand tool is always associates with a axis. It is really a disadvantage of the usage of the tool.
For the markings shown in the screen shot i have to specify the left, width, top and height for the tool.

Please let me know if you have any alternative solutions for this problem.
Also please allow the users to specify the left, width,top and height of the ColorBand tool. It is really required.

Regards,
Avijit

Avijit
Newbie
Newbie
Posts: 72
Joined: Tue Sep 15, 2009 12:00 am

Re: Zooming of Annotation tool

Post by Avijit » Wed Oct 28, 2009 10:17 pm

Hi,
Is it possible to specify the left, top, width and height of a Rectangle tool or Annotation tool in float?
Presently it is only accepting integers.
How can i specify the points as float?

Regards,
Avijit

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Zooming of Annotation tool

Post by Yeray » Fri Oct 30, 2009 4:48 pm

Hi Avijit,

Yes, as you've noticed, ColorBandTool was designed to be assigned to an axis so that it could highlight the whole width or the whole height (depending of if the axis is horizontal or vertical) from a value to another value.
As you need a rectangle, you need the rectangle tool or the annotation tool and you have to reposition it relatively to the chart axes. For example:

Code: Select all

        Steema.TeeChart.Styles.Line line1;
        Steema.TeeChart.Tools.RectangleTool rectangle1;

        private void InitializeChart()
        {
            chartController1.Chart = tChart1;
            tChart1.Aspect.View3D = false;

            line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);

            Random rnd = new Random();
            line1.Add(1000);
            for (int i = 1; i < 25; i++)
            {
                line1.Add(line1.YValues.Value[i - 1] + rnd.Next(10));
            }

            rectangle1 = new Steema.TeeChart.Tools.RectangleTool(tChart1.Chart);
            tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);

            tChart1.Draw();
        }

        void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
            rectangle1.Left = tChart1.Axes.Bottom.CalcPosValue(10);
            rectangle1.Width = tChart1.Axes.Bottom.CalcPosValue(15) - rectangle1.Left;
            rectangle1.Top = tChart1.Axes.Left.CalcPosValue(1070);
            rectangle1.Height = tChart1.Axes.Left.CalcPosValue(1050) - rectangle1.Top;
        }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Avijit
Newbie
Newbie
Posts: 72
Joined: Tue Sep 15, 2009 12:00 am

Re: Zooming of Annotation tool

Post by Avijit » Mon Jul 26, 2010 1:07 pm

Hello,
I just saw that the ColorBand tool does not occupy the Axis offset area. Is that intended?
For one fastline series i set the offset to 25%.
I have one ColorBand tool associated with the Custom Vertical axis of the fastline series.
I am seeing the ColorBand tool occupying only 50% of the Custom axis height.
Please let me know how to solve this issue.

Regards,
Avijit

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Zooming of Annotation tool

Post by Yeray » Mon Jul 26, 2010 4:23 pm

Hi Avijit,

Could you please arrange a simple example project we can run as-is to reproduce the problem here?
I'm not sure to understand what exact offset you have set to 25%.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Avijit
Newbie
Newbie
Posts: 72
Joined: Tue Sep 15, 2009 12:00 am

Re: Zooming of Annotation tool

Post by Avijit » Tue Jul 27, 2010 9:25 am

Hello Yerey,
Please see the attached project. I have created one ColorBand tool and associated with a vertical custom axis and added offset to the Axis. See the ColorBand is not starting from the begining of the Axis nor it is ending at the end of the axis.

-Avijit
Attachments
OffsetProb.zip
(12.73 KiB) Downloaded 715 times

Avijit
Newbie
Newbie
Posts: 72
Joined: Tue Sep 15, 2009 12:00 am

Re: Zooming of Annotation tool

Post by Avijit » Tue Jul 27, 2010 12:38 pm

Hi,
One more thing i want to know.
Is it possible to calculate the Start and End position of the ColorBand tool without calling the TChart.Draw() function?
This might be a performance issue in our case.

-Avijit

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

Re: Zooming of Annotation tool

Post by Sandra » Wed Jul 28, 2010 11:17 am

Hello Avijit,

I have checked your application, and I seem that ColorBand doesn't paint correctly, because you initialize Minimum and Maximum Offsets of custom axis to 25% and ColorBand behaves according to the axis where is assigned. So if you want that ColorBand paint full, you will need change Offset of custom axis by default. You could modify your code so:

Code: Select all

 public void DrawTrend()
    {
      FastLine _FastLIne = new FastLine();
      _FastLIne.FillSampleValues(100);
      
      Axis _Axis = new Axis();
      ChartControl.Axes.Custom.Add(_Axis);
      _Axis.StartEndPositionUnits = PositionUnits.Percent;
      _Axis.StartPosition = 0;
      _Axis.EndPosition = 100;
      //_Axis.MaximumOffset = 25;
      //_Axis.MinimumOffset = 25;
      _FastLIne.CustomVertAxis = _Axis;
      ChartControl.Series.Add(_FastLIne);
      _Axis.Automatic = true;
      _Axis.SetMinMax(_FastLIne.MinYValue(), _FastLIne.MaxYValue());
...
Hi,
One more thing i want to know.
Is it possible to calculate the Start and End position of the ColorBand tool without calling the TChart.Draw() function?
This might be a performance issue in our case.
I check your code and I removed next line in DrawTrend(),because it is not necessary, for calculate start and end position of ColorBandTool :

Code: Select all

 ChartControl.Draw();//is not necessary
So, I think if you remove this line, your application will work fine.

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

Avijit
Newbie
Newbie
Posts: 72
Joined: Tue Sep 15, 2009 12:00 am

Re: Zooming of Annotation tool

Post by Avijit » Tue Aug 03, 2010 11:26 am

Hello Sandra,
I removed the line. But now the colorbands are not getting drawn.
While checking the Axis sizes, i came to know that the Custom Axis IStartPos, IEndPos and IAxisSize is ZERO before calling the ChartControl.Draw function.
Please, let me know how to solve this.

Regards,
Avijit

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

Re: Zooming of Annotation tool

Post by Sandra » Tue Aug 03, 2010 12:00 pm

Hello Avijit,


I have tested again it and I confirm that here, previous code works fine with last version of TeeChart .Net. Can you please, tell us what version of TeeChart.Net you are using? Because, we can try to find a solution for it.


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

Avijit
Newbie
Newbie
Posts: 72
Joined: Tue Sep 15, 2009 12:00 am

Re: Zooming of Annotation tool

Post by Avijit » Tue Aug 03, 2010 12:09 pm

Hello,
i am using
Version - 4.0.0.30764

Regards,
Avijit

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

Re: Zooming of Annotation tool

Post by Sandra » Wed Aug 04, 2010 8:27 am

Hello Avijit,

I recommend you, update your version 4 of TeeChart .Net for last version 4 release that could download in this link. When you've updated version, you could check again, if my previous code works as you want.

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

Avijit
Newbie
Newbie
Posts: 72
Joined: Tue Sep 15, 2009 12:00 am

Re: Zooming of Annotation tool

Post by Avijit » Thu Aug 05, 2010 7:23 am

Hello Sandra,
I have installed the latest release (4th August, 2010)
I commented out the Offset part.
Also commented out the ChartControl.Draw().
As i told you, ColorBand tool is not at getting drawn at all.
For the Custom Axis - IStartPos, IEndPos and IAxisSize is ZERO now.
Please run the attached project as is and see for yourself.

regards,
Avijit
Attachments
OffsetProb.zip
NoColorBand
(22.56 KiB) Downloaded 706 times

Post Reply