@adrienhobbs/candlekit 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -524,6 +524,9 @@ function ChartComponent({
524
524
  container.removeEventListener("mouseup", handleMouseUp, true);
525
525
  container.removeEventListener("click", handleClick, true);
526
526
  chart.remove();
527
+ indicatorSeriesRef.current.clear();
528
+ indicatorPaneIndexRef.current.clear();
529
+ nextPaneIndexRef.current = 2;
527
530
  };
528
531
  }, []);
529
532
  useEffect(() => {
@@ -745,7 +748,7 @@ function ChartComponent({
745
748
  lineWidth: indicator.settings.lineWidth || 2,
746
749
  title: indicator.name
747
750
  }, paneIndex);
748
- const lineData = data.map((d) => ({ time: d.time, value: d.value }));
751
+ const lineData = data.map((d) => ({ time: d.time, value: d.value })).filter((d) => Number.isFinite(d.value));
749
752
  series.setData(lineData);
750
753
  indicatorSeriesRef.current.set(indicator.id, series);
751
754
  } else if (definition.renderConfig.hasBandFill && definition.renderConfig.fillBands) {
@@ -788,7 +791,7 @@ function ChartComponent({
788
791
  color: indicator.settings.color || "#8b5cf6",
789
792
  title: indicator.name
790
793
  }, paneIndex);
791
- const histData = data.map((d) => ({ time: d.time, value: d.value }));
794
+ const histData = data.map((d) => ({ time: d.time, value: d.value })).filter((d) => Number.isFinite(d.value));
792
795
  series.setData(histData);
793
796
  indicatorSeriesRef.current.set(indicator.id, series);
794
797
  } else if (seriesType === "area") {
@@ -799,7 +802,7 @@ function ChartComponent({
799
802
  lineWidth: indicator.settings.lineWidth || 2,
800
803
  title: indicator.name
801
804
  }, paneIndex);
802
- const areaData = data.map((d) => ({ time: d.time, value: d.value }));
805
+ const areaData = data.map((d) => ({ time: d.time, value: d.value })).filter((d) => Number.isFinite(d.value));
803
806
  series.setData(areaData);
804
807
  indicatorSeriesRef.current.set(indicator.id, series);
805
808
  }
@@ -815,7 +818,7 @@ function ChartComponent({
815
818
  if (definition.renderConfig.outputCount === 1) {
816
819
  const series = indicatorSeriesRef.current.get(indicator.id);
817
820
  if (series) {
818
- const lineData = data.map((d) => ({ time: d.time, value: d.value }));
821
+ const lineData = data.map((d) => ({ time: d.time, value: d.value })).filter((d) => Number.isFinite(d.value));
819
822
  series.setData(lineData);
820
823
  }
821
824
  } else if (definition.renderConfig.hasBandFill && definition.renderConfig.fillBands) {