Page 1 of 3
How to fit all the lines into a chart
Posted: Mon Jun 02, 2014 11:47 am
by 15668832
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.
Re: How to fit all the lines into a chart
Posted: Mon Jun 02, 2014 1:45 pm
by Christopher
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?
Re: How to fit all the lines into a chart
Posted: Mon Jun 02, 2014 2:16 pm
by 15668832
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.
Re: How to fit all the lines into a chart
Posted: Mon Jun 02, 2014 2:31 pm
by 15668832
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.
Re: How to fit all the lines into a chart
Posted: Mon Jun 02, 2014 3:16 pm
by Christopher
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?
Re: How to fit all the lines into a chart
Posted: Mon Jun 02, 2014 3:43 pm
by 15668832
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.
Re: How to fit all the lines into a chart
Posted: Mon Jun 02, 2014 4:50 pm
by Christopher
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;
Re: How to fit all the lines into a chart
Posted: Tue Jun 03, 2014 9:25 am
by 15668832
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.
Re: How to fit all the lines into a chart
Posted: Tue Jun 03, 2014 10:13 am
by Christopher
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;
Re: How to fit all the lines into a chart
Posted: Tue Jun 03, 2014 10:29 am
by 15668832
I beg your pardon, I do not see any change with the suggestion.
Re: How to fit all the lines into a chart
Posted: Tue Jun 03, 2014 10:50 am
by Christopher
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.
Re: How to fit all the lines into a chart
Posted: Tue Jun 03, 2014 10:55 am
by 15668832
Works but it breaks on re-sizing the window.
Nice video demonstration. Thanks.
Re: How to fit all the lines into a chart
Posted: Tue Jun 03, 2014 10:56 am
by 15668832
Though it is not a strict criterion but things may change in the future. Like, fixed size Chart to re-sizable.
Re: How to fit all the lines into a chart
Posted: Tue Jun 03, 2014 11:00 am
by Christopher
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?
Re: How to fit all the lines into a chart
Posted: Tue Jun 03, 2014 11:04 am
by Christopher
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:
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.