Skip to content

Commit 5d0ef1c

Browse files
committed
Remove patchLonelyDatapoints workaround (plotly/plotly.js#6407)
1 parent 83f3b24 commit 5d0ef1c

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

src/plotly-graph-card.ts

-22
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,6 @@ import parseConfig from "./parse-config";
2626

2727
const componentName = isProduction ? "plotly-graph" : "plotly-graph-dev";
2828

29-
const isNumber = (y: any) => !Number.isNaN(parseFloat(y));
30-
31-
function patchLonelyDatapoints(xs: Datum[], ys: Datum[]) {
32-
/* Ghost traces when data has single numeric value sandwiched between unavailable, unknown, etc ones
33-
Plotly issue: https://github.com/plotly/plotly.js/issues/6407
34-
see: https://github.com/dbuezas/lovelace-plotly-graph-card/issues/103
35-
and: https://github.com/dbuezas/lovelace-plotly-graph-card/issues/124
36-
*/
37-
if (ys.length === 1) {
38-
// A single lonely point won't create ghosts, and this fix breaks bar charts with a single bar
39-
// see: https://github.com/dbuezas/lovelace-plotly-graph-card/issues/129#issuecomment-1312730979
40-
return;
41-
}
42-
for (let i = 0; i < ys.length; i++) {
43-
if (!isNumber(ys[i - 1]) && isNumber(ys[i]) && !isNumber(ys[i + 1])) {
44-
ys.splice(i, 0, ys[i]);
45-
xs.splice(i, 0, xs[i]);
46-
}
47-
}
48-
}
49-
5029
function extendLastDatapointToPresent(
5130
xs: Datum[],
5231
ys: Datum[],
@@ -489,7 +468,6 @@ export class PlotlyGraph extends HTMLElement {
489468
console.error(e);
490469
}
491470
}
492-
patchLonelyDatapoints(xs, ys);
493471

494472
if (xs.length === 0 && ys.length === 0) {
495473
/*

0 commit comments

Comments
 (0)