Zooming of Annotation tool

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Zooming of Annotation tool

Post by Sandra » Thu Aug 05, 2010 9:03 am

Hello Avijit,
Also commented out the ChartControl.Draw().
As i told you, ColorBand tool is not at getting drawn at all.
Ok, I could reproduce it now. If you don't want use ChartControl.Draw() you can customize your values axis using SetMinMax() property as do to next code:

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.SetMinMax(_FastLIne.MinYValue(), _FastLIne.MaxYValue());
    // ChartControl.Draw();
     ColorBand _ColorBand = new ColorBand(ChartControl.Chart);
     _ColorBand.Axis = _Axis;
     _ColorBand.Color = Color.Yellow;
     _ColorBand.Transparency = 75;
     _ColorBand.Brush.Color = Color.Yellow;
     _ColorBand.Start = _Axis.Minimum;
     _ColorBand.End = _Axis.Maximum;
     ChartControl.Tools.Add(_ColorBand);
    }
Could you please, tell us if previous code is a good solution for you?

Moreover, you can say us if when you utilizes ChartController.Draw() your application works as you want?

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 » Thu Aug 05, 2010 9:17 am

Hi,
Tell me one thing -

For example say my FastLine series is of 1000 points and all are NaN.
Or say my fastLine series is of 1000 points and all are 0 or someother value. (no change in the value)

In that case, your login will hold good??

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 » Thu Aug 05, 2010 12:39 pm

Hello Avijit,

I think that I haven't understood well your problem. Please see next images I made using your code:

Image1: using SetMinMax() property and FillSampleValues=1000:
image1.JPG
image1.JPG (81.33 KiB) Viewed 10999 times
Image2: using SetMinMax() property, FillSampleValues=1000, and MaximumOffset = 25; MinimumOffset = 25:
image2.JPG
image2.JPG (28.84 KiB) Viewed 11004 times
Could you please tell us, if in previous images appear your problem with ColorBandTool?

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 1:09 pm

Hello,
can you do one thing?
Instead of doing FillSampleValues(1000) please create a fastline series with 1000 NaN data.
Then try to call SetMinMax()
Let me know how is it behaving?

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 » Fri Aug 06, 2010 9:09 am

Hello Avijit,

Ok, I have checked that your request and I have next gotten images:

Image1: Using 1000 NaN and SetMinMax()
image3.jpg
image3.jpg (13.18 KiB) Viewed 10972 times
Image2: Using 1000 NaN and tChar1.Draw()
image4.JPG
image4.JPG (12.36 KiB) Viewed 10971 times

It is obviously that in the image1 SetMinMax() doesn't return correctly MaxYvalue, so MinYValue=0, this is correct, but MaxYValue =1E-50, this is incorrect when should be 0, as in image2 using tChart1.Draw(). Could you confirm us if it is your problem when you are using SetMInMax() axes property?

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 » Fri Aug 06, 2010 10:49 am

Hello Sandra,
My problem is -

1. I cant use SetMinMax because i will not be able to calculate the MaxYValue for all NaN data.
2. If i am not able to calculate the MaxYValue then the ColorBand values are 0.0 and 0.0


Conclution:
I cant use SetMinMax as it is not calculating the MaxYValue correctly.
But its returning ZERO for TChart.Draw is also not correct.
If you see, the Custom axis pixel position (after TChart.Draw pixel positions are calcualted properly) is different and i have associated the ColorBand with the Custom Axis still ColorBand is not drawn.

If Axis is there, Color Band also should be there irrespective of any Series associated with the Custom axis or not. (There may not be any Series associated with the Custom Axis but Custom Axis is there).

Hope i am able to make you understand the problem.

-Avijit

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

Re: Zooming of Annotation tool

Post by Sandra » Mon Aug 09, 2010 1:12 pm

Hello Avijit,

Please, you could try using YValues.Maximum instead of calling MaxYValue() function in your code as next code:

Code: Select all

   FastLine _FastLIne = new FastLine();
        //_FastLIne.FillSampleValues(100);
        for (int i = 0; i < 1000; i++)
        {
            _FastLIne.SetNull(i);

        }
        Axis _Axis = new Axis(ChartControl.Chart);
        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.SetMinMax(_FastLIne.YValues.Minimum, _FastLIne.YValues.Maximum);
        _Axis.Automatic = false;
        ColorBand _ColorBand = new ColorBand(ChartControl.Chart);
        _ColorBand.Axis = _Axis;
        _ColorBand.Color = Color.Yellow;
        _ColorBand.Transparency = 75;
        _ColorBand.Brush.Color = Color.Yellow;
        _ColorBand.Start = _FastLIne.YValues.Minimum;
        _ColorBand.End = _FastLIne.YValues.Maximum;

        ChartControl.Tools.Add(_ColorBand);
    }
Could you tell us, if previous code solves your problem?

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 » Mon Aug 09, 2010 2:08 pm

Hello Sandra,
I tried that and the result is same.

What i am saying you is -
My FastLine contails 10 data points. Values are as below -

DataPoint 1 - NAN
DataPoint 2 - NAN
DataPoint 3 - NAN
DataPoint 4 - NAN
DataPoint 5 - NAN
DataPoint 6 - NAN
DataPoint 7 - NAN
DataPoint 8 - NAN
DataPoint 9 - NAN
DataPoint 10 - NAN

Now can you tell me what will be the value of
_FastLine.YValues.Minimum and _FastLine.YValues.Maximum ??

Regards,
Avijit

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

Re: Zooming of Annotation tool

Post by Yeray » Wed Aug 11, 2010 2:58 pm

Hi Avijit,

While double.NaN values have to be treated for the developer, it's the same talking about NaN values than Null points, of course assuming that you don't want them to be drawn.
TeeChart calculates internally the Minimum and Maximum visible values of the series assigned to an axis to set the axis Minimum and Maximum. If there is no point visible, both Minimum and Maximum are 0 (both for the series and the axis).

On the other hand, having the axis Minimum = Maximum, makes the series to be drawn in a line, similar to doing:

Code: Select all

            tChart1.Axes.Left.StartPosition = 49;
            tChart1.Axes.Left.EndPosition = 51;
So you should prevent it, for example like follows:

Code: Select all

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            tChart1.Legend.Visible = false;

            Steema.TeeChart.Styles.FastLine fast1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);

            for (int i = 0; i < 25; i++)
            {
                fast1.Add(double.NaN);
            }

            for (int i = 0; i < fast1.Count; i++)
                if (double.IsNaN(fast1.YValues[i])) fast1.SetNull(i);

            fast1.TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.DoNotPaint;

            if (tChart1.Axes.Left.Minimum == tChart1.Axes.Left.Maximum)
            {
                tChart1.Axes.Left.Automatic = false;
                tChart1.Axes.Left.Minimum = tChart1.Axes.Left.Minimum - 1;
                tChart1.Axes.Left.Maximum = tChart1.Axes.Left.Maximum + 1;
            }

            Steema.TeeChart.Tools.ColorBand colorband1 = new Steema.TeeChart.Tools.ColorBand(tChart1.Chart);
            colorband1.Axis = tChart1.Axes.Left;
            colorband1.Color = Color.Yellow;

            colorband1.Start = tChart1.Axes.Left.Minimum;
            colorband1.End = tChart1.Axes.Left.Maximum;
        }
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

Post Reply