Page 1 of 1

Scrollpager problem adding a serie without values

Posted: Fri Feb 14, 2014 11:47 am
by 15654539
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

Re: Scrollpager problem adding a serie without values

Posted: Fri Feb 14, 2014 3:11 pm
by Christopher
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];
            }

Re: Scrollpager problem adding a serie without values

Posted: Fri Feb 14, 2014 3:15 pm
by 15654539
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?

Re: Scrollpager problem adding a serie without values

Posted: Fri Feb 14, 2014 3:29 pm
by Christopher
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.

Re: Scrollpager problem adding a serie without values

Posted: Fri Feb 14, 2014 3:36 pm
by 15654539
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...

Re: Scrollpager problem adding a serie without values

Posted: Fri Feb 14, 2014 3:46 pm
by Christopher
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?

Re: Scrollpager problem adding a serie without values

Posted: Fri Feb 14, 2014 4:04 pm
by 15654539
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

Re: Scrollpager problem adding a serie without values

Posted: Fri Feb 14, 2014 4:32 pm
by Christopher
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];
          }
        }

Re: Scrollpager problem adding a serie without values

Posted: Fri Feb 14, 2014 4:47 pm
by 15654539
Ok thanks!