We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to clean series charts

Thread ID:

Created:

Updated:

Platform:

Replies:

129689 Mar 28,2017 09:39 PM UTC Mar 29,2017 08:20 AM UTC JavaScript 1
loading
Tags: ejChart
Roimer Machacón Otero
Asked On March 28, 2017 09:39 PM UTC

Hi, we're using syncfusion charts, now when load initially the chart appear a serie with name "series0" and default values.

Exist a form of delete this serie, to the moment of load the chart.

We've this code:

var Chart = $("#chProduccionSiembras").ejChart("instance");
//Here hide the serie but we need remove this
                Chart.model.series[0] = { visibility: 'hidden' }

                //Adding a new series dynamically using Chart instance
                for (strName in valor) {
                    strValue = valor[strName];
                    console.log(strValue);
                    Chart.model.series[Chart.model.series.length] = { dataSource: strValue, name: 'Siembra: ' + strName }
                }
                //Redrawing chart after updating series collection
                Chart.redraw();



Dharanidharan Dharmasivam [Syncfusion]
Replied On March 29, 2017 08:20 AM UTC

Hi Roimer,  

Thanks for contacting Syncfusion support. 

We have analyzed your query. Your requirement can be achieved by following any one of the below methods. 

Method 1: Initializing the series with empty array. 
Response: You can initialize the chart with empty series, so that chart will render with empty points. In a button click we have added series to the chart dynamically. You can change this scenario, with respect to your requirement. Find the code snippet below. 

[JS] 

<input type="button" onclick="addSeries()" value="Add Series" /> 

$("#container").ejChart( 
        { 
          //Initializing empty series                                             
            series:[{ }], 
        }); 
 
function addSeries() { 
        var Chart = $("#container").ejChart("instance"); 
        var data = GetData(); 
        if (Chart.model.series[0].points.length == 0 || Chart.model.initSeriesRender == false) 
        Chart.model.series = []; 
        Chart.model.series.push({ "dataSource": data.Open, "xName": "XValue", "yName": "YValue" ,    
                                                    name: 'Siembra: ' + window.count }); 
        Chart.redraw(); 
        window.count+=1; 
    } 


Screenshot with empty series: 
 

Screenshot after adding the series in button click: 

 

Sample for reference can be find from below link. 

Method 2: Using initSeriesRendering property. 
Response: When initSeriesRender property is set to false, then no series will be rendered in the chart. Then before redraw the chart, initSeriesRender property need to be set as true, then only chart will render with specified series. Find the code snippet below. 

[JS] 

<input type="button" onclick="addSeries()" value="Add Series" /> 

$("#container").ejChart( 
        { 
             initSeriesRender : false 
        }); 
 
function addSeries() { 
        var Chart = $("#container").ejChart("instance"); 
        //... 
        Chart.model.initSeriesRender = true; 
        Chart.redraw(); 
                              
    } 

Sample for reference can be find from below link. 

Thanks, 
Dharani. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;