Wrong data in Chart after redraw

Hi
I stumbled upon a problem with an ej-chart.

I have a chart with four series. Sometimes it can happen that for one series there is no data. If I load the data to all series I can see that there is non in the one empty series. After doing a redraw() on the widget the series which should be empty is filled with data from the series with next lower index.

Example:
I have an Object with four data Arrays called "res". Properties toFront, toBack, toLeft, toRight each contains an array with data for a series.
In This example res['toLeft'] is undefined.

myChart is a reference to the ejChart.

The following code is used to fill the charts series:

this.myChart.widget.model.series[0].dataSource = res['toFront'];
this.myChart.widget.model.series[1].dataSource = res['toBack'];
this.myChart.widget.model.series[2].dataSource = res['toLeft'];
this.myChart.widget.model.series[3].dataSource = res['toRight'];
console.log(this.myChart.widget.model.series[2].dataSource);
this.myChart.widget.redraw();
console.log(this.myChart.widget.model.series[2].dataSource);

Now the first "console.log" prints an "undefined", while the second prints the data of res['toBack']. So it seems after the redraw() the data stored in series[1].dataSource are copied to series[2]dataSource.

There is no problem if all series[i].dataSource are filled with data.

Any hints what I can do or is this a bug?
I use npm packages "ej-angular2": "^16.1.37" and "syncfusion-javascript": "^16.1.37" and checkd with versions 15.4.21

Regards
Bernd

3 Replies

BP Baby Palanidurai Syncfusion Team June 15, 2018 05:31 PM UTC

Hi Bernd, 

 We are able to reproduce the reported scenario at our end. And we will fix the issue and the fix will be included in any of the upcoming release. As a workaround we have provide you the solution by setting empty array for dataSource  in commonSeriesOptions . Please find the below code snippet to achieve this workaround, 

       this.chart.widget.model.series[0].dataSource = res['toFront']; 
        this.chart.widget.model.series[1].dataSource = res['toBack']; 
        this.chart.widget.model.series[2].dataSource = res['toLeft']; 
        this.chart.widget.model.series[3].dataSource = res['toRight']; 
        this.chart.widget.model.commonSeriesOptions.dataSource = []; 
        this.chart.widget.redraw(); 
  

Screenshot: 
 
Sample for your reference can be find from below link, 
  
Kindly revert us, if you have any concerns. 
  

Thanks, 
Baby 



BS Bernd Schuhmacher June 18, 2018 05:00 AM UTC

Hi Baby

Thanks for the hint for the work around. This solved the problem for now.

Regards
Bernd


BP Baby Palanidurai Syncfusion Team June 19, 2018 05:25 AM UTC

Hi Bernd, 

Thanks for your update, 

   Please let us know if you need any further assistance on this. 


Thanks, 
Baby. 


Loader.
Up arrow icon