|
311 | 311 | <g v-for="(plot, j) in serie.plots" :key="`line_${i}_${j}`"> |
312 | 312 | <line |
313 | 313 | :data-cy="`xy-line-segment-${i}-${j}`" |
314 | | - v-if="j < serie.plots.length - 1 && canShowValue(plot.value) && canShowValue(serie.plots[j+1].value)" |
| 314 | + v-if="plot && j < serie.plots.length - 1 && serie.plots[j+1] && canShowValue(plot.value) && canShowValue(serie.plots[j+1].value)" |
315 | 315 | :x1="plot.x" |
316 | 316 | :x2="serie.plots[j+1].x" |
317 | 317 | :y1="plot.y" |
|
324 | 324 | /> |
325 | 325 | <line |
326 | 326 | :data-cy="`xy-line-segment-${i}-${j}`" |
327 | | - v-if="j < serie.plots.length - 1 && canShowValue(plot.value) && canShowValue(serie.plots[j+1].value)" |
| 327 | + v-if="plot && j < serie.plots.length - 1 && serie.plots[j+1] && canShowValue(plot.value) && canShowValue(serie.plots[j+1].value)" |
328 | 328 | :x1="plot.x" |
329 | 329 | :x2="serie.plots[j+1].x" |
330 | 330 | :y1="plot.y" |
|
342 | 342 |
|
343 | 343 | <Shape |
344 | 344 | :data-cy="`xy-plot-${i}-${j}`" |
345 | | - v-if="canShowValue(plot.value)" |
| 345 | + v-if="plot && canShowValue(plot.value)" |
346 | 346 | :shape="['triangle', 'square', 'diamond', 'pentagon', 'hexagon', 'star'].includes(serie.shape) ? serie.shape : 'circle'" |
347 | 347 | :color="chartConfig.line.useGradient ? `url(#lineGradient_${i}_${uniqueId})` : serie.color" |
348 | 348 | :plot="{ x: plot.x, y: plot.y }" |
@@ -1330,13 +1330,11 @@ export default { |
1330 | 1330 | }, |
1331 | 1331 | lineSet() { |
1332 | 1332 | return this.activeSeriesWithStackRatios.filter(s => s.type === 'line').map((datapoint) => { |
1333 | | -
|
1334 | | - const min = Math.min(...datapoint.absoluteValues); |
1335 | | - const max = Math.max(...datapoint.absoluteValues); |
1336 | | - const autoScaledRatios = datapoint.absoluteValues.map(v => { |
| 1333 | + const min = Math.min(...datapoint.absoluteValues.filter(v => ![undefined, null].includes(v))); |
| 1334 | + const max = Math.max(...datapoint.absoluteValues.filter(v => ![undefined, null].includes(v))); |
| 1335 | + const autoScaledRatios = datapoint.absoluteValues.filter(v => ![null, undefined].includes(v)).map(v => { |
1337 | 1336 | return (v - min) / (max - min) |
1338 | 1337 | }); |
1339 | | -
|
1340 | 1338 | const autoScale = { |
1341 | 1339 | ratios: autoScaledRatios, |
1342 | 1340 | valueMin: min, |
@@ -1389,10 +1387,12 @@ export default { |
1389 | 1387 | }) |
1390 | 1388 |
|
1391 | 1389 | const autoScalePlots = datapoint.series.map((plot, j) => { |
1392 | | - return { |
1393 | | - x: (this.drawingArea.left + (this.slot.line/2)) + (this.slot.line * j), |
1394 | | - y: this.drawingArea.bottom - yOffset - (individualHeight * autoScaleRatiosToNiceScale[j]), |
1395 | | - value: datapoint.absoluteValues[j] |
| 1390 | + if(![undefined, null].includes(datapoint.absoluteValues[j])) { |
| 1391 | + return { |
| 1392 | + x: (this.drawingArea.left + (this.slot.line/2)) + (this.slot.line * j), |
| 1393 | + y: this.drawingArea.bottom - yOffset - (individualHeight * autoScaleRatiosToNiceScale[j]), |
| 1394 | + value: datapoint.absoluteValues[j] |
| 1395 | + } |
1396 | 1396 | } |
1397 | 1397 | }) |
1398 | 1398 | const curve = this.createSmoothPath(plots); |
@@ -1919,7 +1919,7 @@ export default { |
1919 | 1919 | const start = { x: plots[0].x, y: zero }; |
1920 | 1920 | const end = { x: plots.at(-1).x, y: zero }; |
1921 | 1921 | const path = []; |
1922 | | - plots.forEach(plot => { |
| 1922 | + plots.filter(p => !!p).forEach(plot => { |
1923 | 1923 | path.push(`${plot.x},${plot.y} `); |
1924 | 1924 | }); |
1925 | 1925 | return [ start.x, start.y, ...path, end.x, end.y].toString(); |
|
0 commit comments