0👍
You already have check to apply rounded corners when not hidden (filtered).
Just need to add condition to apply rounded corners when filtered assuming that zeros are not shown.
Something like this:
if (!this._chart.getDatasetMeta(findLast).hidden) {
lastVisible = findLast;
if (this._chart.data.datasets[findLastTo - 1].data[this._index] == 0) {
lastVisible -= 1;
}
} else {
if (this._chart.data.datasets[findLast].data[this._index] == 0) {
lastVisible = findLast;
lastVisible -= 1;
}
}
Here is modified JSFiddle: https://jsfiddle.net/xopr36g5/
0👍
I fixed this problem by calculating the depth of dataset dynamically.Thanks for answers
var lastVisible;
var datasetsLength = this._chart.data.datasets.length;
this._chart.data.datasets.map((e,index)=>{
lastVisible=datasetsLength-1;
//to find the depth of datasets and get non-zero value
for(var i=lastVisible;i>0;i--){
if(!this._chart.getDatasetMeta(i).hidden){
if(this._chart.data.datasets[i].data[this._index] != 0){
lastVisible = i;
break;
}
}
}
})
- Chartjs-ChartJs Memory Leak | Garbage Collection does not clean Chart Object or Arrays after render
- Chartjs-Chartjs is graphing my values at positions 0,1,2 rather than their values along the x axis
Source:stackexchange.com