diff --git a/src/plugins/series-markers/primitive.ts b/src/plugins/series-markers/primitive.ts index 6be3acfb80..382451997d 100644 --- a/src/plugins/series-markers/primitive.ts +++ b/src/plugins/series-markers/primitive.ts @@ -32,18 +32,14 @@ class SeriesMarkersPrimitive implements ISeriesPrimitive, series: ISeriesApi) { - this._chart = chart; - this._series = series; - } - public attached(param: SeriesAttachedParameter): void { this._attached = param; - const series = param.series; this._recalculateMarkers(); - this._paneView = new SeriesMarkersPaneView(series, ensureNotNull(this._chart)); + this._chart = param.chart; + this._series = param.series; + this._paneView = new SeriesMarkersPaneView(this._series, ensureNotNull(this._chart)); this._requestUpdate = param.requestUpdate; - series.subscribeDataChanged((scope: DataChangedScope) => this._onDataChanged(scope)); + this._series.subscribeDataChanged((scope: DataChangedScope) => this._onDataChanged(scope)); this.requestUpdate(); } @@ -196,8 +192,6 @@ class SeriesMarkersPrimitive implements ISeriesPrimitive implements ISeriesPrimitive implements ISeriesPrimitive( series: ISeriesApi, - chart: IChartApiBase, markers?: SeriesMarker[] ): SeriesMarkersPrimitive { - const primitive = new SeriesMarkersPrimitive(chart, series); - + const primitive = new SeriesMarkersPrimitive(); if (markers) { primitive.setMarkers(markers); } - series.attachPrimitive(primitive); - return primitive; } diff --git a/tests/e2e/coverage/test-cases/series/markers.js b/tests/e2e/coverage/test-cases/series/markers.js index 5a24d39090..a2df75665f 100644 --- a/tests/e2e/coverage/test-cases/series/markers.js +++ b/tests/e2e/coverage/test-cases/series/markers.js @@ -17,7 +17,6 @@ function beforeInteractions(container) { mainSeries.setData(data); seriesMarkerPrimitives = LightweightCharts.createSeriesMarkersPrimitive( mainSeries, - chart, [ { time: data[data.length - 7].time, position: 'belowBar', color: 'rgb(255, 0, 0)', shape: 'arrowUp', text: 'test' }, { time: data[data.length - 5].time, position: 'aboveBar', color: 'rgba(255, 255, 0, 1)', shape: 'arrowDown', text: 'test' }, diff --git a/tests/e2e/graphics/test-cases/add-markers-with-autosize-enabled.js b/tests/e2e/graphics/test-cases/add-markers-with-autosize-enabled.js index 783e9bc755..2903831953 100644 --- a/tests/e2e/graphics/test-cases/add-markers-with-autosize-enabled.js +++ b/tests/e2e/graphics/test-cases/add-markers-with-autosize-enabled.js @@ -72,7 +72,6 @@ function runTestCase(container) { } LightweightCharts.createSeriesMarkersPrimitive( series, - chart, markers ); } diff --git a/tests/e2e/graphics/test-cases/api/series-markers.js b/tests/e2e/graphics/test-cases/api/series-markers.js index 1386eafc65..abc7814508 100644 --- a/tests/e2e/graphics/test-cases/api/series-markers.js +++ b/tests/e2e/graphics/test-cases/api/series-markers.js @@ -39,7 +39,6 @@ function runTestCase(container) { const markersPrimitive = LightweightCharts.createSeriesMarkersPrimitive( series, - chart, markers ); const seriesApiMarkers = markersPrimitive.markers(); diff --git a/tests/e2e/graphics/test-cases/applying-options/make-series-hidden.js b/tests/e2e/graphics/test-cases/applying-options/make-series-hidden.js index c2409dda05..6851630492 100644 --- a/tests/e2e/graphics/test-cases/applying-options/make-series-hidden.js +++ b/tests/e2e/graphics/test-cases/applying-options/make-series-hidden.js @@ -27,7 +27,6 @@ function runTestCase(container) { lineSeries.setData(data); LightweightCharts.createSeriesMarkersPrimitive( lineSeries, - chart, [ { time: data[data.length - 30].time, position: 'belowBar', color: 'orange', shape: 'arrowUp' }, { time: data[data.length - 30].time, position: 'belowBar', color: 'yellow', shape: 'arrowUp' }, diff --git a/tests/e2e/graphics/test-cases/applying-options/make-series-visible.js b/tests/e2e/graphics/test-cases/applying-options/make-series-visible.js index be66a1f9b3..962604f235 100644 --- a/tests/e2e/graphics/test-cases/applying-options/make-series-visible.js +++ b/tests/e2e/graphics/test-cases/applying-options/make-series-visible.js @@ -28,7 +28,6 @@ function runTestCase(container) { lineSeries.setData(data); LightweightCharts.createSeriesMarkersPrimitive( lineSeries, - chart, [ { time: data[data.length - 30].time, position: 'belowBar', color: 'orange', shape: 'arrowUp' }, { time: data[data.length - 30].time, position: 'belowBar', color: 'yellow', shape: 'arrowUp' }, diff --git a/tests/e2e/graphics/test-cases/data-validation.js b/tests/e2e/graphics/test-cases/data-validation.js index 2d26756036..d360e31686 100644 --- a/tests/e2e/graphics/test-cases/data-validation.js +++ b/tests/e2e/graphics/test-cases/data-validation.js @@ -32,7 +32,6 @@ function runTestCase(container) { try { LightweightCharts.createSeriesMarkersPrimitive( lineSeries, - chart, [ { time: 1 }, { time: 0, value: 0 }, @@ -99,7 +98,6 @@ function runTestCase(container) { // should pass - several markers could be on the same bar LightweightCharts.createSeriesMarkersPrimitive( lineSeries, - chart, [ { color: 'green', diff --git a/tests/e2e/graphics/test-cases/series-markers/marker-in-gap-from-left.js b/tests/e2e/graphics/test-cases/series-markers/marker-in-gap-from-left.js index de1f157383..a74067f0f4 100644 --- a/tests/e2e/graphics/test-cases/series-markers/marker-in-gap-from-left.js +++ b/tests/e2e/graphics/test-cases/series-markers/marker-in-gap-from-left.js @@ -27,7 +27,6 @@ function runTestCase(container) { ]); LightweightCharts.createSeriesMarkersPrimitive( lineSeries, - chart, [ { color: 'green', diff --git a/tests/e2e/graphics/test-cases/series-markers/marker-in-gap.js b/tests/e2e/graphics/test-cases/series-markers/marker-in-gap.js index 25032fabed..8c5395ee90 100644 --- a/tests/e2e/graphics/test-cases/series-markers/marker-in-gap.js +++ b/tests/e2e/graphics/test-cases/series-markers/marker-in-gap.js @@ -27,7 +27,6 @@ function runTestCase(container) { LightweightCharts.createSeriesMarkersPrimitive( lineSeries, - chart, [ { color: 'green', diff --git a/tests/e2e/graphics/test-cases/series-markers/series-arrow-markers.js b/tests/e2e/graphics/test-cases/series-markers/series-arrow-markers.js index 71df17bed7..49424c0355 100644 --- a/tests/e2e/graphics/test-cases/series-markers/series-arrow-markers.js +++ b/tests/e2e/graphics/test-cases/series-markers/series-arrow-markers.js @@ -32,7 +32,6 @@ function runTestCase(container) { LightweightCharts.createSeriesMarkersPrimitive( mainSeries, - chart, [ { time: data[data.length - 30].time, position: 'belowBar', color: 'orange', shape: 'arrowUp' }, { time: data[data.length - 30].time, position: 'belowBar', color: 'yellow', shape: 'arrowUp' }, diff --git a/tests/e2e/graphics/test-cases/series-markers/series-circle-markers.js b/tests/e2e/graphics/test-cases/series-markers/series-circle-markers.js index e0cbb58bce..a1ce3388ee 100644 --- a/tests/e2e/graphics/test-cases/series-markers/series-circle-markers.js +++ b/tests/e2e/graphics/test-cases/series-markers/series-circle-markers.js @@ -31,7 +31,6 @@ function runTestCase(container) { mainSeries.setData(data); LightweightCharts.createSeriesMarkersPrimitive( mainSeries, - chart, [ { time: data[data.length - 30].time, position: 'belowBar', color: 'orange', shape: 'circle' }, { time: data[data.length - 30].time, position: 'belowBar', color: 'yellow', shape: 'circle' }, diff --git a/tests/e2e/graphics/test-cases/series-markers/series-markers-aligned.js b/tests/e2e/graphics/test-cases/series-markers/series-markers-aligned.js index 85c9c0257e..f586c70b2b 100644 --- a/tests/e2e/graphics/test-cases/series-markers/series-markers-aligned.js +++ b/tests/e2e/graphics/test-cases/series-markers/series-markers-aligned.js @@ -17,7 +17,6 @@ function runTestCase(container) { LightweightCharts.createSeriesMarkersPrimitive( line, - chart, [ { time: '2017-04-10', position: 'inBar', color: 'orange', shape: 'circle' }, { time: '2017-04-16', position: 'inBar', color: 'orange', shape: 'circle' }, diff --git a/tests/e2e/graphics/test-cases/series-markers/series-markers-all-above.js b/tests/e2e/graphics/test-cases/series-markers/series-markers-all-above.js index 8ac8d6b5ca..2c4ae32cbb 100644 --- a/tests/e2e/graphics/test-cases/series-markers/series-markers-all-above.js +++ b/tests/e2e/graphics/test-cases/series-markers/series-markers-all-above.js @@ -22,7 +22,6 @@ function runTestCase(container) { LightweightCharts.createSeriesMarkersPrimitive( mainSeries, - chart, [ { time: data[0].time, position: 'aboveBar', color: 'red', shape: 'arrowUp' }, { time: data[1].time, position: 'aboveBar', color: 'red', shape: 'arrowUp' }, diff --git a/tests/e2e/graphics/test-cases/series-markers/series-markers-all-below.js b/tests/e2e/graphics/test-cases/series-markers/series-markers-all-below.js index 8f0ab04894..b44d5ef09a 100644 --- a/tests/e2e/graphics/test-cases/series-markers/series-markers-all-below.js +++ b/tests/e2e/graphics/test-cases/series-markers/series-markers-all-below.js @@ -22,7 +22,6 @@ function runTestCase(container) { LightweightCharts.createSeriesMarkersPrimitive( mainSeries, - chart, [ { time: data[data.length - 3].time, position: 'belowBar', color: 'red', shape: 'arrowUp' }, { time: data[data.length - 2].time, position: 'belowBar', color: 'red', shape: 'arrowUp' }, diff --git a/tests/e2e/graphics/test-cases/series-markers/series-markers-all-inbar.js b/tests/e2e/graphics/test-cases/series-markers/series-markers-all-inbar.js index 8461a4c3f7..a1cc6d5999 100644 --- a/tests/e2e/graphics/test-cases/series-markers/series-markers-all-inbar.js +++ b/tests/e2e/graphics/test-cases/series-markers/series-markers-all-inbar.js @@ -21,7 +21,6 @@ function runTestCase(container) { mainSeries.setData(data); LightweightCharts.createSeriesMarkersPrimitive( mainSeries, - chart, [ { time: data[data.length - 3].time, position: 'inBar', color: 'red', shape: 'arrowUp' }, { time: data[data.length - 2].time, position: 'inBar', color: 'red', shape: 'arrowUp' }, diff --git a/tests/e2e/graphics/test-cases/series-markers/series-markers-max-bar-spacing.js b/tests/e2e/graphics/test-cases/series-markers/series-markers-max-bar-spacing.js index 3a8452d81e..b4ada767aa 100644 --- a/tests/e2e/graphics/test-cases/series-markers/series-markers-max-bar-spacing.js +++ b/tests/e2e/graphics/test-cases/series-markers/series-markers-max-bar-spacing.js @@ -22,7 +22,6 @@ function runTestCase(container) { LightweightCharts.createSeriesMarkersPrimitive( mainSeries, - chart, [ { time: data[data.length - 4].time, position: 'inBar', color: 'red', shape: 'square' }, { time: data[data.length - 3].time, position: 'inBar', color: 'red', shape: 'circle' }, diff --git a/tests/e2e/graphics/test-cases/series-markers/series-markers-min-bar-spacing.js b/tests/e2e/graphics/test-cases/series-markers/series-markers-min-bar-spacing.js index 2b461a4488..ba15c92396 100644 --- a/tests/e2e/graphics/test-cases/series-markers/series-markers-min-bar-spacing.js +++ b/tests/e2e/graphics/test-cases/series-markers/series-markers-min-bar-spacing.js @@ -29,7 +29,6 @@ function runTestCase(container) { LightweightCharts.createSeriesMarkersPrimitive( mainSeries, - chart, markers ); chart.applyOptions({ diff --git a/tests/e2e/graphics/test-cases/series-markers/series-markers-object-business-day.js b/tests/e2e/graphics/test-cases/series-markers/series-markers-object-business-day.js index a12e64d98c..56f0c0dc4a 100644 --- a/tests/e2e/graphics/test-cases/series-markers/series-markers-object-business-day.js +++ b/tests/e2e/graphics/test-cases/series-markers/series-markers-object-business-day.js @@ -17,7 +17,6 @@ function runTestCase(container) { LightweightCharts.createSeriesMarkersPrimitive( line, - chart, [ { time: { year: 2017, month: 4, day: 11 }, position: 'inBar', color: 'orange', shape: 'circle' }, { time: { year: 2017, month: 4, day: 14 }, position: 'inBar', color: 'orange', shape: 'circle' }, diff --git a/tests/e2e/graphics/test-cases/series-markers/series-markers-out-of-visible-range.js b/tests/e2e/graphics/test-cases/series-markers/series-markers-out-of-visible-range.js index 70ca1d23fd..51a9e30c33 100644 --- a/tests/e2e/graphics/test-cases/series-markers/series-markers-out-of-visible-range.js +++ b/tests/e2e/graphics/test-cases/series-markers/series-markers-out-of-visible-range.js @@ -22,7 +22,6 @@ function runTestCase(container) { LightweightCharts.createSeriesMarkersPrimitive( mainSeries, - chart, [ { time: data[0].time, position: 'belowBar', color: 'red', shape: 'arrowUp' }, { time: data[data.length - 4].time, position: 'belowBar', color: 'red', shape: 'arrowUp' }, diff --git a/tests/e2e/graphics/test-cases/series-markers/series-markers-re-aligned.js b/tests/e2e/graphics/test-cases/series-markers/series-markers-re-aligned.js index edbcc76a62..2c7033d055 100644 --- a/tests/e2e/graphics/test-cases/series-markers/series-markers-re-aligned.js +++ b/tests/e2e/graphics/test-cases/series-markers/series-markers-re-aligned.js @@ -17,7 +17,6 @@ function runTestCase(container) { LightweightCharts.createSeriesMarkersPrimitive( line, - chart, [ { time: '2017-04-10', position: 'inBar', color: 'orange', shape: 'circle' }, { time: '2017-04-16', position: 'inBar', color: 'orange', shape: 'circle' }, diff --git a/tests/e2e/graphics/test-cases/series-markers/series-markers-update.js b/tests/e2e/graphics/test-cases/series-markers/series-markers-update.js index 486c3eb5e1..62129560a9 100644 --- a/tests/e2e/graphics/test-cases/series-markers/series-markers-update.js +++ b/tests/e2e/graphics/test-cases/series-markers/series-markers-update.js @@ -28,7 +28,6 @@ function runTestCase(container) { ]; const markerPrimitive = LightweightCharts.createSeriesMarkersPrimitive( mainSeries, - chart, markers ); diff --git a/tests/e2e/graphics/test-cases/series-markers/series-markers-with-text.js b/tests/e2e/graphics/test-cases/series-markers/series-markers-with-text.js index 539f0b7db9..15450196a0 100644 --- a/tests/e2e/graphics/test-cases/series-markers/series-markers-with-text.js +++ b/tests/e2e/graphics/test-cases/series-markers/series-markers-with-text.js @@ -39,7 +39,6 @@ function runTestCase(container) { mainSeries.setData(data); LightweightCharts.createSeriesMarkersPrimitive( mainSeries, - chart, [ { time: data[data.length - 50].time, position: 'belowBar', color: 'red', shape: 'arrowUp', text: 'test' }, { time: data[data.length - 50].time, position: 'belowBar', color: 'red', shape: 'arrowDown', text: 'test' }, diff --git a/tests/e2e/graphics/test-cases/series-markers/series-square-markers.js b/tests/e2e/graphics/test-cases/series-markers/series-square-markers.js index 533cb342d5..e9cdc52629 100644 --- a/tests/e2e/graphics/test-cases/series-markers/series-square-markers.js +++ b/tests/e2e/graphics/test-cases/series-markers/series-square-markers.js @@ -31,7 +31,6 @@ function runTestCase(container) { mainSeries.setData(data); LightweightCharts.createSeriesMarkersPrimitive( mainSeries, - chart, [ { time: data[data.length - 30].time, position: 'belowBar', color: 'orange', shape: 'square' }, { time: data[data.length - 30].time, position: 'belowBar', color: 'yellow', shape: 'square' }, diff --git a/tests/e2e/graphics/test-cases/series-markers/set-markers-before-series-data.js b/tests/e2e/graphics/test-cases/series-markers/set-markers-before-series-data.js index fcb1bb1a7d..61613d5330 100644 --- a/tests/e2e/graphics/test-cases/series-markers/set-markers-before-series-data.js +++ b/tests/e2e/graphics/test-cases/series-markers/set-markers-before-series-data.js @@ -5,7 +5,6 @@ function runTestCase(container) { LightweightCharts.createSeriesMarkersPrimitive( mainSeries, - chart, [ { time: '2019-04-09', diff --git a/tests/e2e/graphics/test-cases/series/series-visibility.js b/tests/e2e/graphics/test-cases/series/series-visibility.js index 9ad67e1677..2abdd8de23 100644 --- a/tests/e2e/graphics/test-cases/series/series-visibility.js +++ b/tests/e2e/graphics/test-cases/series/series-visibility.js @@ -47,7 +47,6 @@ function runTestCase(container) { lineSeries.setData(data); LightweightCharts.createSeriesMarkersPrimitive( lineSeries, - chart, [ { time: data[data.length - 30].time, position: 'belowBar', color: 'orange', shape: 'arrowUp' }, { time: data[data.length - 30].time, position: 'belowBar', color: 'yellow', shape: 'arrowUp' }, diff --git a/tests/e2e/interactions/test-cases/markers/text-hit-test.js b/tests/e2e/interactions/test-cases/markers/text-hit-test.js index d5f9d52bd4..fffc11ea59 100644 --- a/tests/e2e/interactions/test-cases/markers/text-hit-test.js +++ b/tests/e2e/interactions/test-cases/markers/text-hit-test.js @@ -51,7 +51,6 @@ function beforeInteractions(container) { mainSeries.setData(mainSeriesData); LightweightCharts.createSeriesMarkersPrimitive( mainSeries, - chart, [ { time: markerTime,