pure-vue-chart icon indicating copy to clipboard operation
pure-vue-chart copied to clipboard

Crashes when going from a larger set of points to a lower one

Open dbarasti opened this issue 3 years ago • 0 comments

I bond the points prop to a computed value that returns the array of points to display. When I go from a larger set of points to a lower one, the chart component crashes with the following error:

[Vue warn]: Error in render: "TypeError: _this3.dataColors[index] is undefined"

found in

---> <VueBarGraph>
       <Chart>
         <App> at src/App.vue
           <Root> vue.runtime.esm.js:619
    VueJS 18
    _callee2$ chart.vue:45
    Babel 10
    _callee$ chart.vue:32
    Babel 8
    _callee$ App.vue:42
    Babel 8
    keyup App.vue:38
    VueJS 3

TypeError: _this3.dataColors[index] is undefined
    chartData vue-bar-graph.common.js:7663
    chartData vue-bar-graph.common.js:7651
    VueJS 3
    render vue-bar-graph.common.js:3291
    VueJS 14
    _callee2$ chart.vue:45
    Babel 10
    _callee$ chart.vue:32
    Babel 8
    _callee$ App.vue:42
    Babel 8
    keyup App.vue:38
    VueJS 3
vue.runtime.esm.js:1897
    VueJS 17
    _callee2$ chart.vue:45
    Babel 10
    _callee$ chart.vue:32
    Babel 8
    _callee$ App.vue:42
    Babel 8
    keyup App.vue:38
    VueJS 3

To reproduce: display dynamically a set of n points, then change the cardinality of the set (simply removing some values) to m (m<n)

dbarasti avatar Nov 01 '21 19:11 dbarasti