How to fit all the lines into a chart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

How to fit all the lines into a chart

Post by Raavi » Mon Jun 02, 2014 11:47 am

I have a fixed tool window as a client and on which a teechart is docked. Now I try to place some lines whose lengths are not know and upon doing it the part of the line is beyond the size of teechart.

How can I fit all the lines into a teechart? In future, the fixed tool window may be re-sizable.

Thanks.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to fit all the lines into a chart

Post by Christopher » Mon Jun 02, 2014 1:45 pm

Raavi,
Raavi wrote:I have a fixed tool window as a client and on which a teechart is docked. Now I try to place some lines whose lengths are not know and upon doing it the part of the line is beyond the size of teechart.

How can I fit all the lines into a teechart? In future, the fixed tool window may be re-sizable.
Would you be so kind as to create a Short, Self Contained, Correct (Compilable), Example with which I can see your issue here?
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Re: How to fit all the lines into a chart

Post by Raavi » Mon Jun 02, 2014 2:16 pm

Sorry. I have to pick up the right words or an example to demonstrate.

But, I got 'false' for 'Chart.Zoom.Zoomed'. which tells me that not all Chart point fit into Chart.

Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Re: How to fit all the lines into a chart

Post by Raavi » Mon Jun 02, 2014 2:31 pm

On clicking Test button one may notice the part of the rectangle goes out of the chart.

I rather like to implement to fit all the lines in the chart. Some sort of autozoom.
Attachments
TestingTeeChartScaling.zip
(44.55 KiB) Downloaded 724 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to fit all the lines into a chart

Post by Christopher » Mon Jun 02, 2014 3:16 pm

Raavi wrote:On clicking Test button one may notice the part of the rectangle goes out of the chart.

I rather like to implement to fit all the lines in the chart. Some sort of autozoom.
If I change the code to:

Code: Select all

        private void AddSeriesToChart()
        {
            m_Sum = 10.0;
then the rectangle doesn't move ... is this the issue or am I misunderstanding it?
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Re: How to fit all the lines into a chart

Post by Raavi » Mon Jun 02, 2014 3:43 pm

1) What should I have to do thereby, 'm_Chart.Zoom.Zoomed' returns 'true'

2) If I set m_Sum += 10.0; then part of the lines go out of the Chart. This should not happen rather it should 'zoom out' to fit all lines in a given Chart size and the same for m_Sum -= 10 and in this case it should 'zoom in'.

* My problem is I cannot change the Chart size so I have to play with Zoom in and Zoom out by keeping Aspect ratio fixed either horizontally or vertically.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to fit all the lines into a chart

Post by Christopher » Mon Jun 02, 2014 4:50 pm

Raavi wrote:1) What should I have to do thereby, 'm_Chart.Zoom.Zoomed' returns 'true'

2) If I set m_Sum += 10.0; then part of the lines go out of the Chart. This should not happen rather it should 'zoom out' to fit all lines in a given Chart size and the same for m_Sum -= 10 and in this case it should 'zoom in'.

* My problem is I cannot change the Chart size so I have to play with Zoom in and Zoom out by keeping Aspect ratio fixed either horizontally or vertically.
I see. Maybe the problem is that the internal Series statistics aren't being updated as you set the ValueList.Value array directly. You could try:
m_Line.XValues.Count = 6;
m_Line.XValues.Value = m_RectangleX;
m_Line.XValues.Modified = true;

m_Line.YValues.Count = 6;
m_Line.YValues.Value = m_RectangleY;
m_Line.YValues.Modified = true;
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Re: How to fit all the lines into a chart

Post by Raavi » Tue Jun 03, 2014 9:25 am

I think, I can demonstrate what I mean about the lines not fitting into the chart with the attached solution.

* I cannot change the size of the Chart.
* I do not know what the dimensions for the line are.

In that case, however the line is defined it should fit into Chart.
Attachments
TestingTeeChartScaling.zip
(45.92 KiB) Downloaded 691 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to fit all the lines into a chart

Post by Christopher » Tue Jun 03, 2014 10:13 am

Raavi wrote:I think, I can demonstrate what I mean about the lines not fitting into the chart with the attached solution.

* I cannot change the size of the Chart.
* I do not know what the dimensions for the line are.

In that case, however the line is defined it should fit into Chart.
Try:

Code: Select all

            m_Chart.Axes.Bottom.Automatic = true;
            m_Chart.Axes.Bottom.MinimumOffset = 10;
            m_Chart.Axes.Bottom.MaximumOffset = 10;
            //m_Chart.Axes.Bottom.Visible = false;
            m_Chart.Axes.Bottom.Ticks.Length = 0;
            m_Chart.Axes.Bottom.Labels.Visible = false;
            m_Chart.Axes.Bottom.AxisPen.Visible = false;

            m_Chart.Axes.Left.Automatic = true;
            m_Chart.Axes.Left.MinimumOffset = 10;
            m_Chart.Axes.Left.MaximumOffset = 10;
            //m_Chart.Axes.Left.Visible = false;
            m_Chart.Axes.Left.Ticks.Length = 0;
            m_Chart.Axes.Left.Labels.Visible = false;
            m_Chart.Axes.Left.AxisPen.Visible = false;
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Re: How to fit all the lines into a chart

Post by Raavi » Tue Jun 03, 2014 10:29 am

I beg your pardon, I do not see any change with the suggestion.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to fit all the lines into a chart

Post by Christopher » Tue Jun 03, 2014 10:50 am

Raavi wrote:I beg your pardon, I do not see any change with the suggestion.
Yes, I'm sorry, those changes seem to be irrelevant. The relevant change is commenting out this line:

Code: Select all

//m_Chart.BeforeDrawSeries += (sender, d) => m_Chart.Chart.Axes.Bottom.AdjustMaxMin();
There's a little video here in which you can see the effect of the change.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Re: How to fit all the lines into a chart

Post by Raavi » Tue Jun 03, 2014 10:55 am

Works but it breaks on re-sizing the window.

Nice video demonstration. Thanks.

Raavi
Newbie
Newbie
Posts: 36
Joined: Tue Apr 01, 2014 12:00 am

Re: How to fit all the lines into a chart

Post by Raavi » Tue Jun 03, 2014 10:56 am

Though it is not a strict criterion but things may change in the future. Like, fixed size Chart to re-sizable. :-(

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to fit all the lines into a chart

Post by Christopher » Tue Jun 03, 2014 11:00 am

Raavi wrote:Works but it breaks on re-sizing the window.
I'm sorry, I thought that when you said "I cannot change the size of the Chart." you meant that the size of the Chart couldn't be changed.

So the size of the Chart *can* be changed, but only when the client resizes, is that correct?
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to fit all the lines into a chart

Post by Christopher » Tue Jun 03, 2014 11:04 am

Raavi wrote:Though it is not a strict criterion but things may change in the future. Like, fixed size Chart to re-sizable. :-(
If I comment out the line:

Code: Select all

//m_Line.IsoHorizAxes = true;
I can resize the chart and the series resizes correctly.

I am a little confused as to exactly what your requirements are, I'm sorry.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply