Welcome to the Angular feedback portal. We’re happy you’re here! If you have feedback on how to improve the Angular, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

0
Votes

I got an render fail using in a serie pointColorMapping property when the datasource array is empty.

>Here the output console:

ERROR TypeError: Cannot read property 'interior' of undefined

    at Legend.getLegendOptions (ej2-charts.es2015.js:23357)

    at ChartComponent.refreshBound (ej2-charts.es2015.js:8352)

    at ChartComponent.processData (ej2-charts.es2015.js:8709)

    at ChartComponent.cartesianChartRendering (ej2-charts.es2015.js:8325)

    at ChartComponent. (ej2-charts.es2015.js:8307)

    at ChartComponent.push.../../node_modules/@syncfusion/ej2-angular-base/src/component-base.js.ComponentBase.trigger (component-base.js:306)

    at ChartComponent.render (ej2-charts.es2015.js:8305)

    at ChartComponent.appendTo (ej2-base.es2015.js:6899)

    at component-base.js:137

    at ZoneDelegate.invokeTask (zone-evergreen.js:391)

    at Object.onInvokeTask (core.js:39680)

    at ZoneDelegate.invokeTask (zone-evergreen.js:390)

    at Zone.runTask (zone-evergreen.js:168)

    at invokeTask (zone-evergreen.js:465)

    at ZoneTask.invoke (zone-evergreen.js:454)

    at timer (zone-evergreen.js:2650)


> Here the exact bug:

The method is not checking if the series points is empty, so when it tries to get de point[0] we got an undefined error.

getLegendOptions(visibleSeriesCollection, chart) {

        this.legendCollections = [];

        let seriesType;

        let fill;

        for (let series of visibleSeriesCollection) {

            if (series.category !== 'Indicator' && series.name !== '') {

                seriesType = (chart.chartAreaType === 'PolarRadar') ? series.drawType :

                    series.type;

                // To set legend color when use pointColorMapping

                fill = series.pointColorMapping ? (series.points[0].interior ? series.points[0].interior : series.interior) :

                    series.interior;

                this.legendCollections.push(new LegendOptions(series.name, fill, series.legendShape, (series.category === 'TrendLine' ?

                    this.chart.series[series.sourceIndex].trendlines[series.index].visible : series.visible), seriesType, series.marker.shape, series.marker.visible));

            }

        }

    }


Thanks in advance.