Page 1 of 1

Bug in Waterfall serie?

Posted: Wed Jan 30, 2008 9:08 am
by 13046960
We have problems with the Waterfall series. Not all lines are drawn.
Please check the code below.

Dim oSerie As New Steema.TeeChart.Styles.Waterfall
oSerie.IrregularGrid = True
TChart1.Aspect.Chart3DPercent = 100
For i As Integer = 0 To 9
oSerie.Add(i, 2 + Rnd(), 1)
Next
For i As Integer = 0 To 9
oSerie.Add(2 * i, 2 + Rnd(), 2)
Next
TChart1.Series.Add(oSerie)


Please help!!

Posted: Wed Jan 30, 2008 11:46 am
by narcis
Hi Janne,

This is not being plotted because your series doesn't fall in the description of those series style I made on this thread.

An alternative to achieve what you request would be using 2 series, for example:

Code: Select all

        Dim oSerie1 As New Steema.TeeChart.Styles.Waterfall(TChart1.Chart)
        Dim oSerie2 As New Steema.TeeChart.Styles.Waterfall(TChart1.Chart)

        oSerie1.IrregularGrid = True
        oSerie2.IrregularGrid = True

        TChart1.Aspect.Chart3DPercent = 100

        For i As Integer = 0 To 9
            oSerie1.Add(i, 2 + Rnd(), 1)
        Next

        For i As Integer = 0 To 9
            oSerie2.Add(2 * i, 2 + Rnd(), 2)
        Next

Not possible

Posted: Wed Jan 30, 2008 2:47 pm
by 13046960
Hi Narcis

Unfortunately this is not possible.
This solution will have to poor performance.
In our application we will need at least 100 series with at least 400 values in each. The performance is then very bad.

Is it possible to get the functionality from our first question in some way? Customization? Bug fix release? We need it really soon.

Thanks a lot for your help!

Posted: Thu Jan 31, 2008 11:43 am
by narcis
Hi Janne,

Why do you assume that performance will be bad? All we're doing is splitting the data in half and using two series, instead of using the whole data in one. We don't think that performance would be adversly affected. Moreover, you can check that both options take almost the same time running this example:

Code: Select all

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TChart1.Series.RemoveAllSeries()

        Dim oSerie As New Steema.TeeChart.Styles.Waterfall

        oSerie.IrregularGrid = True

        TChart1.Aspect.Chart3DPercent = 100

        For i As Integer = 0 To 9
            oSerie.Add(i, 2 + Rnd(), 1)
        Next

        For i As Integer = 0 To 9
            oSerie.Add(2 * i, 2 + Rnd(), 2)
        Next

        TChart1.Series.Add(oSerie)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TChart1.Series.RemoveAllSeries()

        Dim oSerie1 As New Steema.TeeChart.Styles.Waterfall(TChart1.Chart)
        Dim oSerie2 As New Steema.TeeChart.Styles.Waterfall(TChart1.Chart)

        oSerie1.IrregularGrid = True
        oSerie2.IrregularGrid = True

        TChart1.Aspect.Chart3DPercent = 100

        For i As Integer = 0 To 9
            oSerie1.Add(i, 2 + Rnd(), 1)
        Next

        For i As Integer = 0 To 9
            oSerie2.Add(2 * i, 2 + Rnd(), 2)
        Next
    End Sub

    Private startTime As DateTime, now As DateTime

    Private Sub TChart1_BeforeDraw(ByVal sender As System.Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D) Handles TChart1.BeforeDraw
        startTime = DateTime.Now
    End Sub

    Private Sub TChart1_AfterDraw(ByVal sender As System.Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D) Handles TChart1.AfterDraw
        'calculate elapsed time         
        now = DateTime.Now
        Dim elapsedTime As TimeSpan = New TimeSpan(now.Ticks - startTime.Ticks)
        Dim total As Integer = (elapsedTime.Seconds * 1000) + elapsedTime.Milliseconds

        label1.Text = "Elapsed time: " + total.ToString() + " ms"
    End Sub

Posted: Thu Jan 31, 2008 12:41 pm
by 13046960
The reason why I say that the solution will have poor performance is of course that I have tested this.
In this sample to show the problem we have we used a lot of less data.
In fact we will need 100 series with 400 values in each.
If we would be able to plot it all in one serie it takes 3.2 s of we have 100 series it crashes after 2 minutes with "An unhandled exception of type 'System.OutOfMemoryException' occurred in mscorlib.dll".

We really need the possibility to plot it in the same serie.
Is it possible to buy customization to fix this?

I have included a sample with 100 series.
'------------------------------------------------------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TChart1.Series.RemoveAllSeries()
Dim oSerie As New Steema.TeeChart.Styles.Waterfall
oSerie.IrregularGrid = True
TChart1.Aspect.Chart3DPercent = 100
For j As Integer = 0 To 99
If j Mod 2 = 0 Then
For i As Integer = 0 To 399
oSerie.Add(i, 2 + Rnd(), j)
Next
Else
For i As Integer = 0 To 399
oSerie.Add(2 * i, 2 + Rnd(), j)
Next
End If
Next
TChart1.Series.Add(oSerie)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TChart1.Series.RemoveAllSeries()
For j As Integer = 0 To 99
Dim oSerie As New Steema.TeeChart.Styles.Waterfall(TChart1.Chart)
oSerie.IrregularGrid = True
TChart1.Aspect.Chart3DPercent = 100
If j Mod 2 = 0 Then
For i As Integer = 0 To 399
oSerie.Add(i, 2 + Rnd(), j)
Next
Else
For i As Integer = 0 To 399
oSerie.Add(2 * i, 2 + Rnd(), j)
Next
End If
Next
End Sub

Private startTime As DateTime, now As DateTime

Private Sub TChart1_BeforeDraw(ByVal sender As System.Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D) Handles TChart1.BeforeDraw
startTime = DateTime.Now
End Sub

Private Sub TChart1_AfterDraw(ByVal sender As System.Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D) Handles TChart1.AfterDraw
'calculate elapsed time
now = DateTime.Now
Dim elapsedTime As TimeSpan = New TimeSpan(now.Ticks - startTime.Ticks)
Dim total As Integer = (elapsedTime.Seconds * 1000) + elapsedTime.Milliseconds

label1.Text = "Elapsed time: " + total.ToString() + " ms"
End Sub
'---------------------------------------------------------------------


Thanks in advance!

Posted: Thu Jan 31, 2008 12:58 pm
by narcis
Hi Janne,

Thanks for the information. In your example you wouldn't need to use so many series, only using 2 works fine here (using code below) and is quicker than using Button1's code.

Code: Select all

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TChart1.Series.RemoveAllSeries()
        TChart1.Aspect.Chart3DPercent = 100

        Dim oSerie1 As New Steema.TeeChart.Styles.Waterfall(TChart1.Chart)
        Dim oSerie2 As New Steema.TeeChart.Styles.Waterfall(TChart1.Chart)

        'oSerie1.IrregularGrid = True
        'oSerie2.IrregularGrid = True

        For j As Integer = 0 To 99

            If j Mod 2 = 0 Then
                For i As Integer = 0 To 399
                    oSerie1.Add(i, 2 + Rnd(), j)
                Next
            Else
                For i As Integer = 0 To 399
                    oSerie2.Add(2 * i, 2 + Rnd(), j)
                Next
            End If
        Next
    End Sub
Can you please try if the code snippet above works fine for you?

Thanks in advance.

Posted: Thu Jan 31, 2008 2:01 pm
by 13046960
Hi Narcis,

This will not work for my application.
The samples I have sent you are much simplier than what we need.
Let's say you have date on the z axis, the plot contains of 100 different dates. Each date has 400 values plotted x and y. The maximum x value of each date varies but it is even spaces for one date.
Belive me, I really need 100 series if it should be solved with your suggestion. My question still remains can this be solved in a bug fix release or can we buy a customization?
Otherwise we need to consider using a different control.

Really need a answer.

Thanks for your help!

Please help

Posted: Thu Feb 07, 2008 9:35 am
by 13046960
Could anyone try to answer my question?

Posted: Thu Feb 07, 2008 12:31 pm
by narcis
Hi Janne,

We are investigating possibilities. For the data density you are charting, have you considered using a Tower Series? One Series may be used to plot all of the data points.

Posted: Thu Feb 07, 2008 1:13 pm
by narcis
Hi Janne,

Our suggestion to achieve what you request is doing like in the example below. If you want to use 100x400 series we think there's to much data in the chart for being interpretable. Our suggestion, if possible, would be to use smaller datasets.

Code: Select all

    private void button1_Click(object sender, EventArgs e)
    {

      double[] dataX = new double[800];
      double[] dataY = new double[800];
      double[] dataZ = new double[800];

      Random rnd = new Random();
      tChart1.Series.RemoveAllSeries();
      Steema.TeeChart.Styles.Waterfall oSerie = new Steema.TeeChart.Styles.Waterfall();
      oSerie.Pen.Visible = false;
      oSerie.WaterLines.Visible = false;
      oSerie.IrregularGrid = true;
      tChart1.Aspect.Chart3DPercent = 100;
      tChart1.Axes.Depth.Visible = true;
      int counter = 0;
      for (int j = 0; j < 10; j++)
      {
        if (j % 2 == 0)
        {
          int loop = counter;
          for (int i = 0; i < 40; i++)
          {
            dataX[i + loop] = i;
            dataY[i + loop] = 2 + rnd.Next();
            dataZ[i + loop] = j;

            int plus = 40;
            dataX[i + plus + loop] = i+40;
            dataY[i + plus + loop] = 0;
            dataZ[i + plus + loop] = j;

            counter++;
            counter++;
          }
        }
        else
        {
          int loop = counter;
          for (int i = 0; i < 40; i++)
          {
            double val = 2 + rnd.Next();
            dataX[i + loop] = 2 * i;
            dataY[i + loop] = val;
            dataZ[i + loop] = j;

            int plus = 40;
            dataX[i + plus + loop] = (2 * i)-1;
            dataY[i + plus + loop] = val;
            dataZ[i + plus + loop] = j;

            counter++;
            counter++;
          }
        }
      }

      oSerie.Add(dataX,dataY,dataZ);
      tChart1.Series.Add(oSerie);
    } 

Posted: Thu Feb 07, 2008 4:50 pm
by 13046960
Thanks for trying to help.
However this does not solve the problem I have.

In order to make our problem more understandable, we feel it would be best if we could send you sample data and some screenshots. Would it be possible to send this to you on email ?`

Thank you in advance.[/url]

Posted: Fri Feb 08, 2008 8:21 am
by narcis
Hi Janne,

Ok, you can post your files at our upload page.

Thanks in advance.

Posted: Fri Feb 08, 2008 3:01 pm
by 13046960
Hi Narcis,

I have uploaded one file containing the data that is shown incorrectly and a jpg of the screen. I have also included a jpeg of a sample where all graphs are ending with the same x value and the same number of values and it shows nicely.
If it can't be solved without modifications we are prepared to pay for some development.

Thanks in advance!

Posted: Thu Feb 14, 2008 9:04 am
by narcis
Hi Janne,

I've sent you an e-mail with the plot we obtained from your data. If you wish the regions that are empty on the Chart to be plotted then you need to rationalise the data, setting a value at each x,z location, even if that value is zero.

Code used to add the data as follows after converting the dataset to a text file format:

Code: Select all

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim ts As New Steema.TeeChart.Data.TextSource("chart1.txt")
        TChart1.Aspect.View3D = True

        ts.HeaderLines = 1
        ts.Separator = vbTab
        ts.Fields.Add(0, "X")
        ts.Fields.Add(1, "Y")
        ts.Fields.Add(2, "Z")
        Dim waterfall1 = New Steema.TeeChart.Styles.Waterfall(TChart1.Chart)
        waterfall1.DataSource = ts
    End Sub