File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -171,13 +171,18 @@ const total = computed(() => {
171171
172172const absoluteDataset = computed (() => {
173173 return safeDatasetCopy .value .map ((d , i ) => {
174+ const dValue = d .value || 0 ;
175+ const _dProportion = dValue / total .value ;
176+ const dProportion = isNaN (_dProportion) ? 0 : _dProportion;
177+ const dWidth = dProportion * svg .value .width ;
178+
174179 return {
175180 ... d,
176- value: d . value || 0 ,
177- proportion: ( d . value || 0 ) / total . value ,
178- width: ( d . value || 0 ) / total .value * svg .value .width ,
181+ value: dValue ,
182+ proportion: dProportion ,
183+ width: dWidth || svg .value . width / safeDatasetCopy .value .length ,
179184 proportionLabel: dataLabel ({
180- v: ( d . value || 0 ) / total . value * 100 ,
185+ v: dProportion * 100 ,
181186 s: ' %' ,
182187 r: FINAL_CONFIG .value .style .legend .percentage .rounding
183188 }),
You can’t perform that action at this time.
0 commit comments