Scrollpager problem adding a serie without values

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

Scrollpager problem adding a serie without values

Post by acastro » Fri Feb 14, 2014 11:47 am

If I add a new serie and I want to see it in the scrollpager but I have not add values yet the chart is deleted.

Please find here the example, press button1 to add the scrollpager and then button3 to add a new serie.
http://193.145.251.126/pnp/files/yCltRj ... Scroll.zip

Thanks

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

Re: Scrollpager problem adding a serie without values

Post by Christopher » Fri Feb 14, 2014 3:11 pm

wakeup wrote:If I add a new serie and I want to see it in the scrollpager but I have not add values yet the chart is deleted.
Possibly the easiest way to resolve this is to check if the series has points before assigning it to the tool's Series property, e.g.

Code: Select all

            if (tool != null && tChart1.Series[tChart1.Series.Count - 1].Count > 0)
            {
              tool.Series = null;
              for (int i = 0; i < tChart1.Series.Count; i++)
                tool.Series = tChart1.Series[i];
            }
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

acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

Re: Scrollpager problem adding a serie without values

Post by acastro » Fri Feb 14, 2014 3:15 pm

Yes, but I need to have the scrollpager ready if the user load values... I know I can do tricks but isn't it a bug?

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

Re: Scrollpager problem adding a serie without values

Post by Christopher » Fri Feb 14, 2014 3:29 pm

wakeup wrote:Yes, but I need to have the scrollpager ready if the user load values... I know I can do tricks but isn't it a bug?
If the user loads values, the series count will be greater than 0 (zero) and the code will execute without a problem.

Assigning a Series without any points in it to the tool.Series value means that the chart bottom axis values are set to the maximum and minimum XValues of the series; given that both of these will be 0 (zero), then I would say that the chart behaves as expected.
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

acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

Re: Scrollpager problem adding a serie without values

Post by acastro » Fri Feb 14, 2014 3:36 pm

Christopher wrote:Assigning a Series without any points in it to the tool.Series value means that the chart bottom axis values are set to the maximum and minimum XValues of the series; given that both of these will be 0 (zero), then I would say that the chart behaves as expected.
Without scrollpager it is not a problem. And if you do it although you try to load data the chart doesn't run...

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

Re: Scrollpager problem adding a serie without values

Post by Christopher » Fri Feb 14, 2014 3:46 pm

wakeup wrote:Without scrollpager it is not a problem.
What is not a problem without a scrollpager?
wakeup wrote:And if you do it although you try to load data the chart doesn't run...
Can you please pass me some code to show me what you mean 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

acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

Re: Scrollpager problem adding a serie without values

Post by acastro » Fri Feb 14, 2014 4:04 pm

Christopher wrote:
wakeup wrote:Without scrollpager it is not a problem.
What is not a problem without a scrollpager?
To have a serie without points in a chart is not a problem for the chart, so I think it shouldn't by a problem for the scrollpager...
Christopher wrote:
wakeup wrote:And if you do it although you try to load data the chart doesn't run...
Can you please pass me some code to show me what you mean here?
http://193.145.251.126/pnp/files/RAzDuu ... Scroll.zip
Button 1, button 3 and after button 6

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

Re: Scrollpager problem adding a serie without values

Post by Christopher » Fri Feb 14, 2014 4:32 pm

wakeup wrote:To have a serie without points in a chart is not a problem for the chart, so I think it shouldn't by a problem for the scrollpager...
The difference is that scrollpager has a Series property which determines how the chart is painted. If the Series assigned to the series property has no points, then the maximum and minimum bottom axis values will be set to zero.
wakeup wrote: http://193.145.251.126/pnp/files/RAzDuu ... Scroll.zip
Button 1, button 3 and after button 6
Try:

Code: Select all

       private void button6_Click(object sender, EventArgs e)
        {
          for (int i = 0; i < tChart1.Series.Count; i++) 
          { 
                tChart1.Series[i].FillSampleValues();
                tool.Series = tChart1.Series[i];
          }
        }
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

acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

Re: Scrollpager problem adding a serie without values

Post by acastro » Fri Feb 14, 2014 4:47 pm

Ok thanks!

Post Reply