Not drawing null values using chart.js

前端 未结 5 1589
别那么骄傲
别那么骄傲 2021-02-05 12:00

I\'m using Chart.js to draw a chart.. My dataset have some null values, Actually chart.js plot a line between points that are previous and successor of the null values in this w

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-05 12:47

    I'm not sure if ChartJS itself can natively do this.

    However one way I did something similar was to make the line graph out of multiple datasets. One dataset would end when a null value is reached, and the next dataset would start. This would of course requires parsing all this data before passing it into var linechartdata

    You can make all the datasets have the same colors and highlights and the graph should render with spaces where null data would have been found.

提交回复
热议问题