@pipsend/charts 2.1.0 → 2.2.0

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @license
3
- * Pipsend Charts v2.1.0
3
+ * Pipsend Charts v2.2.0
4
4
  * Copyright (c) 2026 Pipsend
5
5
  * Licensed under MIT License
6
6
  * Built on TradingView Lightweight Charts™ (Apache 2.0)
@@ -15916,6 +15916,85 @@
15916
15916
  return volumes !== undefined && volumes.size > 0;
15917
15917
  }
15918
15918
 
15919
+ const TRANSPARENT = 'rgba(0, 0, 0, 0)';
15920
+ /**
15921
+ * Take a series off the screen without hiding it.
15922
+ *
15923
+ * `visible: false` takes down everything hung off the series as well: its
15924
+ * price lines, primitives and price-axis label stop rendering. A transform
15925
+ * that only wants the bars themselves out of the way — Heikin Ashi drawing
15926
+ * over its source — needs the series to stay visible to the engine, so its
15927
+ * paint is made transparent instead and the last-value label and price line
15928
+ * are switched off. Custom series have no known colours; those fall back to
15929
+ * `visible: false`.
15930
+ *
15931
+ * @param series - Series to blank out.
15932
+ * @returns Puts back the options the series had when it was blanked.
15933
+ */
15934
+ function hideSeriesPaint(series) {
15935
+ switch (series.seriesType()) {
15936
+ case 'Candlestick':
15937
+ return blank(series, {
15938
+ upColor: TRANSPARENT,
15939
+ downColor: TRANSPARENT,
15940
+ borderVisible: false,
15941
+ wickVisible: false,
15942
+ });
15943
+ case 'Bar':
15944
+ return blank(series, {
15945
+ upColor: TRANSPARENT,
15946
+ downColor: TRANSPARENT,
15947
+ });
15948
+ case 'Line':
15949
+ return blank(series, {
15950
+ color: TRANSPARENT,
15951
+ crosshairMarkerVisible: false,
15952
+ pointMarkersVisible: false,
15953
+ });
15954
+ case 'Area':
15955
+ return blank(series, {
15956
+ lineColor: TRANSPARENT,
15957
+ topColor: TRANSPARENT,
15958
+ bottomColor: TRANSPARENT,
15959
+ crosshairMarkerVisible: false,
15960
+ pointMarkersVisible: false,
15961
+ });
15962
+ case 'Baseline':
15963
+ return blank(series, {
15964
+ topLineColor: TRANSPARENT,
15965
+ topFillColor1: TRANSPARENT,
15966
+ topFillColor2: TRANSPARENT,
15967
+ bottomLineColor: TRANSPARENT,
15968
+ bottomFillColor1: TRANSPARENT,
15969
+ bottomFillColor2: TRANSPARENT,
15970
+ crosshairMarkerVisible: false,
15971
+ pointMarkersVisible: false,
15972
+ });
15973
+ case 'Histogram':
15974
+ return blank(series, {
15975
+ color: TRANSPARENT,
15976
+ });
15977
+ default:
15978
+ return blank(series, { visible: false });
15979
+ }
15980
+ }
15981
+ function blank(series, paint) {
15982
+ const patch = {
15983
+ ...paint,
15984
+ lastValueVisible: false,
15985
+ priceLineVisible: false,
15986
+ };
15987
+ const before = series.options();
15988
+ const snapshot = {};
15989
+ for (const key of Object.keys(patch)) {
15990
+ snapshot[key] = before[key];
15991
+ }
15992
+ series.applyOptions(patch);
15993
+ return () => {
15994
+ series.applyOptions(snapshot);
15995
+ };
15996
+ }
15997
+
15919
15998
  /**
15920
15999
  * Pins a bounded indicator (RSI, Stochastic…) to a fixed price range.
15921
16000
  *
@@ -17612,9 +17691,9 @@
17612
17691
  * Draw a source series as Heikin Ashi candles.
17613
17692
  *
17614
17693
  * The source series is left in place holding its real prices — it is only
17615
- * hidden — so indicators bound to it keep computing on the true OHLC, and
17616
- * `remove()` puts the chart back exactly as it was. That makes this usable as a
17617
- * chart-type toggle:
17694
+ * painted transparent — so indicators bound to it keep computing on the true
17695
+ * OHLC, its price lines and primitives stay on screen, and `remove()` puts the
17696
+ * chart back exactly as it was. That makes this usable as a chart-type toggle:
17618
17697
  *
17619
17698
  * ```js
17620
17699
  * const ha = applyHeikinAshi(candleSeries, chart);
@@ -17656,10 +17735,16 @@
17656
17735
  priceScaleId: sourceOptions.priceScaleId,
17657
17736
  priceFormat: sourceOptions.priceFormat,
17658
17737
  }, resolved.paneIndex);
17659
- const sourceWasVisible = sourceOptions.visible;
17660
- if (resolved.hideSource === true) {
17661
- series.applyOptions({ visible: false });
17662
- }
17738
+ let restoreSourcePaint = null;
17739
+ const blankSource = (blank) => {
17740
+ if (blank && restoreSourcePaint === null) {
17741
+ restoreSourcePaint = hideSeriesPaint(series);
17742
+ }
17743
+ else if (!blank && restoreSourcePaint !== null) {
17744
+ restoreSourcePaint();
17745
+ restoreSourcePaint = null;
17746
+ }
17747
+ };
17663
17748
  const runtime = bindIndicator({
17664
17749
  _internal_source: series,
17665
17750
  _internal_chart: chart,
@@ -17683,9 +17768,7 @@
17683
17768
  wickUpColor: current.wickUpColor,
17684
17769
  wickDownColor: current.wickDownColor,
17685
17770
  });
17686
- series.applyOptions({
17687
- visible: current.hideSource === true ? false : sourceWasVisible,
17688
- });
17771
+ blankSource(current.hideSource === true);
17689
17772
  },
17690
17773
  });
17691
17774
  const handle = {
@@ -17695,10 +17778,10 @@
17695
17778
  recalculate: runtime.recalculate,
17696
17779
  remove: () => {
17697
17780
  runtime.remove();
17698
- // The source outlives the indicator, so its visibility is ours to put
17781
+ // The source outlives the indicator, so its paint is ours to put
17699
17782
  // back — otherwise removing a Heikin Ashi overlay leaves a blank chart.
17700
17783
  try {
17701
- series.applyOptions({ visible: sourceWasVisible });
17784
+ blankSource(false);
17702
17785
  }
17703
17786
  catch (error) {
17704
17787
  // The series may already be gone if the chart was disposed
@@ -29766,7 +29849,7 @@
29766
29849
  * Returns the current version as a string. For example `'1.0.0'`.
29767
29850
  */
29768
29851
  function version() {
29769
- return "2.1.0";
29852
+ return "2.2.0";
29770
29853
  }
29771
29854
 
29772
29855
  var PipsendChartsModule = /*#__PURE__*/Object.freeze({
@@ -29876,6 +29959,7 @@
29876
29959
  customSeriesDefaultOptions: customSeriesDefaultOptions,
29877
29960
  defaultHorzScaleBehavior: defaultHorzScaleBehavior,
29878
29961
  getPipConfig: getPipConfig,
29962
+ hideSeriesPaint: hideSeriesPaint,
29879
29963
  isBusinessDay: isBusinessDay,
29880
29964
  isUTCTimestamp: isUTCTimestamp,
29881
29965
  setSeriesVolumes: setSeriesVolumes,
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @license
3
- * Pipsend Charts v2.1.0
3
+ * Pipsend Charts v2.2.0
4
4
  * Copyright (c) 2026 Pipsend
5
5
  * Licensed under MIT License
6
6
  * Built on TradingView Lightweight Charts™ (Apache 2.0)
@@ -15913,6 +15913,85 @@ function hasSeriesVolumes(series) {
15913
15913
  return volumes !== undefined && volumes.size > 0;
15914
15914
  }
15915
15915
 
15916
+ const TRANSPARENT = 'rgba(0, 0, 0, 0)';
15917
+ /**
15918
+ * Take a series off the screen without hiding it.
15919
+ *
15920
+ * `visible: false` takes down everything hung off the series as well: its
15921
+ * price lines, primitives and price-axis label stop rendering. A transform
15922
+ * that only wants the bars themselves out of the way — Heikin Ashi drawing
15923
+ * over its source — needs the series to stay visible to the engine, so its
15924
+ * paint is made transparent instead and the last-value label and price line
15925
+ * are switched off. Custom series have no known colours; those fall back to
15926
+ * `visible: false`.
15927
+ *
15928
+ * @param series - Series to blank out.
15929
+ * @returns Puts back the options the series had when it was blanked.
15930
+ */
15931
+ function hideSeriesPaint(series) {
15932
+ switch (series.seriesType()) {
15933
+ case 'Candlestick':
15934
+ return blank(series, {
15935
+ upColor: TRANSPARENT,
15936
+ downColor: TRANSPARENT,
15937
+ borderVisible: false,
15938
+ wickVisible: false,
15939
+ });
15940
+ case 'Bar':
15941
+ return blank(series, {
15942
+ upColor: TRANSPARENT,
15943
+ downColor: TRANSPARENT,
15944
+ });
15945
+ case 'Line':
15946
+ return blank(series, {
15947
+ color: TRANSPARENT,
15948
+ crosshairMarkerVisible: false,
15949
+ pointMarkersVisible: false,
15950
+ });
15951
+ case 'Area':
15952
+ return blank(series, {
15953
+ lineColor: TRANSPARENT,
15954
+ topColor: TRANSPARENT,
15955
+ bottomColor: TRANSPARENT,
15956
+ crosshairMarkerVisible: false,
15957
+ pointMarkersVisible: false,
15958
+ });
15959
+ case 'Baseline':
15960
+ return blank(series, {
15961
+ topLineColor: TRANSPARENT,
15962
+ topFillColor1: TRANSPARENT,
15963
+ topFillColor2: TRANSPARENT,
15964
+ bottomLineColor: TRANSPARENT,
15965
+ bottomFillColor1: TRANSPARENT,
15966
+ bottomFillColor2: TRANSPARENT,
15967
+ crosshairMarkerVisible: false,
15968
+ pointMarkersVisible: false,
15969
+ });
15970
+ case 'Histogram':
15971
+ return blank(series, {
15972
+ color: TRANSPARENT,
15973
+ });
15974
+ default:
15975
+ return blank(series, { visible: false });
15976
+ }
15977
+ }
15978
+ function blank(series, paint) {
15979
+ const patch = {
15980
+ ...paint,
15981
+ lastValueVisible: false,
15982
+ priceLineVisible: false,
15983
+ };
15984
+ const before = series.options();
15985
+ const snapshot = {};
15986
+ for (const key of Object.keys(patch)) {
15987
+ snapshot[key] = before[key];
15988
+ }
15989
+ series.applyOptions(patch);
15990
+ return () => {
15991
+ series.applyOptions(snapshot);
15992
+ };
15993
+ }
15994
+
15916
15995
  /**
15917
15996
  * Pins a bounded indicator (RSI, Stochastic…) to a fixed price range.
15918
15997
  *
@@ -17609,9 +17688,9 @@ function calculateHeikinAshi(bars) {
17609
17688
  * Draw a source series as Heikin Ashi candles.
17610
17689
  *
17611
17690
  * The source series is left in place holding its real prices — it is only
17612
- * hidden — so indicators bound to it keep computing on the true OHLC, and
17613
- * `remove()` puts the chart back exactly as it was. That makes this usable as a
17614
- * chart-type toggle:
17691
+ * painted transparent — so indicators bound to it keep computing on the true
17692
+ * OHLC, its price lines and primitives stay on screen, and `remove()` puts the
17693
+ * chart back exactly as it was. That makes this usable as a chart-type toggle:
17615
17694
  *
17616
17695
  * ```js
17617
17696
  * const ha = applyHeikinAshi(candleSeries, chart);
@@ -17653,10 +17732,16 @@ function applyHeikinAshi(series, chart, options = {}) {
17653
17732
  priceScaleId: sourceOptions.priceScaleId,
17654
17733
  priceFormat: sourceOptions.priceFormat,
17655
17734
  }, resolved.paneIndex);
17656
- const sourceWasVisible = sourceOptions.visible;
17657
- if (resolved.hideSource === true) {
17658
- series.applyOptions({ visible: false });
17659
- }
17735
+ let restoreSourcePaint = null;
17736
+ const blankSource = (blank) => {
17737
+ if (blank && restoreSourcePaint === null) {
17738
+ restoreSourcePaint = hideSeriesPaint(series);
17739
+ }
17740
+ else if (!blank && restoreSourcePaint !== null) {
17741
+ restoreSourcePaint();
17742
+ restoreSourcePaint = null;
17743
+ }
17744
+ };
17660
17745
  const runtime = bindIndicator({
17661
17746
  _internal_source: series,
17662
17747
  _internal_chart: chart,
@@ -17680,9 +17765,7 @@ function applyHeikinAshi(series, chart, options = {}) {
17680
17765
  wickUpColor: current.wickUpColor,
17681
17766
  wickDownColor: current.wickDownColor,
17682
17767
  });
17683
- series.applyOptions({
17684
- visible: current.hideSource === true ? false : sourceWasVisible,
17685
- });
17768
+ blankSource(current.hideSource === true);
17686
17769
  },
17687
17770
  });
17688
17771
  const handle = {
@@ -17692,10 +17775,10 @@ function applyHeikinAshi(series, chart, options = {}) {
17692
17775
  recalculate: runtime.recalculate,
17693
17776
  remove: () => {
17694
17777
  runtime.remove();
17695
- // The source outlives the indicator, so its visibility is ours to put
17778
+ // The source outlives the indicator, so its paint is ours to put
17696
17779
  // back — otherwise removing a Heikin Ashi overlay leaves a blank chart.
17697
17780
  try {
17698
- series.applyOptions({ visible: sourceWasVisible });
17781
+ blankSource(false);
17699
17782
  }
17700
17783
  catch (error) {
17701
17784
  // The series may already be gone if the chart was disposed
@@ -29763,7 +29846,7 @@ const customSeriesDefaultOptions = {
29763
29846
  * Returns the current version as a string. For example `'1.0.0'`.
29764
29847
  */
29765
29848
  function version() {
29766
- return "2.1.0";
29849
+ return "2.2.0";
29767
29850
  }
29768
29851
 
29769
- export { areaSeries as AreaSeries, ArrowTool, barSeries as BarSeries, baselineSeries as BaselineSeries, BrushTool, candlestickSeries as CandlestickSeries, CircleTool, ColorType, CrossLineTool, CrosshairMode, DEFAULT_SESSIONS, DraggablePriceLine, DrawingToolsManager, EXTENDED_FIBONACCI_RATIOS, FibonacciCalculator, FibonacciExtensionTool, FibonacciFanTool, FibonacciTool, GanttTool, histogramSeries as HistogramSeries, HorizontalLineTool, InteractiveLineManager, LastPriceAnimationMode, lineSeries as LineSeries, LineStyle, LineType, MismatchDirection, ParallelChannelTool, PitchforkTool, PolygonTool, PositionCalculator, PositionMarkersManager, PositionTool, PriceLineSource, PriceScaleMode, RectangleTool, RulerCalculator, RulerTool, STANDARD_FIBONACCI_RATIOS, TextTool, TickMarkType, TrackingModeExitMode, TradingSessionsIndicator, TrendLineTool, VerticalLineTool, VolumeProfileIndicator, applyADX, applyATR, applyBollingerBands, applyCCI, applyDonchianChannels, applyEMA, applyHeikinAshi, applyIchimoku, applyKeltnerChannels, applyMACD, applyMFI, applyOBV, applyParabolicSAR, applyPivotPoints, applyRSI, applySMA, applyStochastic, applySuperTrend, applyVWAP, applyVolume, applyWMA, applyWilliamsR, calculateHeikinAshi, calculatePipConfig, coordinateFromTime, createArrowTool, createBrushTool, createChart, createChartEx, createCircleTool, createCrossLineTool, createFibonacciExtensionTool, createFibonacciFanTool, createFibonacciTool, createGanttTool, createHorizontalLineTool, createImageWatermark, createInteractiveLineManager, createOptionsChart, createParallelChannelTool, createPitchforkTool, createPolygonTool, createPositionMarkers, createPositionTool, createRectangleTool, createRulerTool, createSeriesMarkers, createTextTool, createTextWatermark, createTradingLine, createTradingSessionsIndicator, createTrendLineTool, createUpDownMarkers, createVerticalLineTool, createVolumeProfileIndicator, createYieldCurveChart, customSeriesDefaultOptions, defaultHorzScaleBehavior, getPipConfig, isBusinessDay, isUTCTimestamp, setSeriesVolumes, setVolumeProfileData, timeFromCoordinate, version };
29852
+ export { areaSeries as AreaSeries, ArrowTool, barSeries as BarSeries, baselineSeries as BaselineSeries, BrushTool, candlestickSeries as CandlestickSeries, CircleTool, ColorType, CrossLineTool, CrosshairMode, DEFAULT_SESSIONS, DraggablePriceLine, DrawingToolsManager, EXTENDED_FIBONACCI_RATIOS, FibonacciCalculator, FibonacciExtensionTool, FibonacciFanTool, FibonacciTool, GanttTool, histogramSeries as HistogramSeries, HorizontalLineTool, InteractiveLineManager, LastPriceAnimationMode, lineSeries as LineSeries, LineStyle, LineType, MismatchDirection, ParallelChannelTool, PitchforkTool, PolygonTool, PositionCalculator, PositionMarkersManager, PositionTool, PriceLineSource, PriceScaleMode, RectangleTool, RulerCalculator, RulerTool, STANDARD_FIBONACCI_RATIOS, TextTool, TickMarkType, TrackingModeExitMode, TradingSessionsIndicator, TrendLineTool, VerticalLineTool, VolumeProfileIndicator, applyADX, applyATR, applyBollingerBands, applyCCI, applyDonchianChannels, applyEMA, applyHeikinAshi, applyIchimoku, applyKeltnerChannels, applyMACD, applyMFI, applyOBV, applyParabolicSAR, applyPivotPoints, applyRSI, applySMA, applyStochastic, applySuperTrend, applyVWAP, applyVolume, applyWMA, applyWilliamsR, calculateHeikinAshi, calculatePipConfig, coordinateFromTime, createArrowTool, createBrushTool, createChart, createChartEx, createCircleTool, createCrossLineTool, createFibonacciExtensionTool, createFibonacciFanTool, createFibonacciTool, createGanttTool, createHorizontalLineTool, createImageWatermark, createInteractiveLineManager, createOptionsChart, createParallelChannelTool, createPitchforkTool, createPolygonTool, createPositionMarkers, createPositionTool, createRectangleTool, createRulerTool, createSeriesMarkers, createTextTool, createTextWatermark, createTradingLine, createTradingSessionsIndicator, createTrendLineTool, createUpDownMarkers, createVerticalLineTool, createVolumeProfileIndicator, createYieldCurveChart, customSeriesDefaultOptions, defaultHorzScaleBehavior, getPipConfig, hideSeriesPaint, isBusinessDay, isUTCTimestamp, setSeriesVolumes, setVolumeProfileData, timeFromCoordinate, version };