Remove Series when Recall

TeeChart for JavaScript for the HTML5 Canvas
Post Reply
matt
Newbie
Newbie
Posts: 13
Joined: Fri Nov 07, 2014 12:00 am

Remove Series when Recall

Post by matt » Mon Feb 23, 2015 3:53 pm

Hello,
I use teechart for bar charts as well as for line charts. During the runtime, I close teechart and recall it. The problem is that the chart shows both previous lines/Series and the current new lines/Series. I only want current new lines are shown as I call the teechart. I don't know how to "get default" or "delete/clear previous lines" when I recall teechart.
I have tried different ways (code).

Thanks, Juliane

Code: Select all

//This works with recall:

function barChart(chart_bar)
{
    var vdata = new Tee.Bar();
    chart_bar.removeSeries( vdata );
    chart_bar.addSeries( vdata );
    //...
}

//This works not  with recall:

var lineData //global variable;
var key_array = [];
var bol_vals_strings = [];

function lineChart(chart_ser, bol)
{
    if (lineData)
    {
     chart_ser.removeSeries(lineData);
    }

    for (key in bol)
    {
        key_array.push(key);
        bol_vals_strings = bol[key];
        var val_array = [];
        for (var k = 0; k < bol_vals_strings.length; k++)
        {
            val_array.push(bol[key][k]);
        }
        var vdata = new Tee.Line();
        var vals = val_array;
        vdata.data.values = vals;
        chart_ser.addSeries( vdata );
        lineData = vdata;
        //....
    }
}

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Remove Series when Recall

Post by Yeray » Tue Feb 24, 2015 9:01 am

Hello,

I'm not sure to understand how are you doing this "recall". Is that an page reaload, aka F5?
Note what you describe doesn't happen if I reload the examples here and here.

If you still find problems with this, please try to arrange a simple example page we can run as-is to reproduce the problem here.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

matt
Newbie
Newbie
Posts: 13
Joined: Fri Nov 07, 2014 12:00 am

Re: Remove Series when Recall

Post by matt » Tue Mar 24, 2015 1:49 pm

Hello,
The recall works by communication with WebSocket, several functions are called, the html-page just once. I wanted to reload the data, not the whole chart. Previous data should be deleted/cleared before reloading.

Regards, Juliane

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Remove Series when Recall

Post by Yeray » Tue Mar 24, 2015 2:18 pm

Hi Juliane,

I think you should something similar to what is done in the realtime demo here.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply