Page 1 of 1

Remove Series when Recall

Posted: Mon Feb 23, 2015 3:53 pm
by 17770651
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;
        //....
    }
}

Re: Remove Series when Recall

Posted: Tue Feb 24, 2015 9:01 am
by yeray
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.

Re: Remove Series when Recall

Posted: Tue Mar 24, 2015 1:49 pm
by 17770651
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

Re: Remove Series when Recall

Posted: Tue Mar 24, 2015 2:18 pm
by yeray
Hi Juliane,

I think you should something similar to what is done in the realtime demo here.