forked from tradingview/lightweight-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: marker positioning (tradingview#1538)
* fix: marker positioning
- Loading branch information
Showing
6 changed files
with
106 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
tests/e2e/graphics/test-cases/series-markers/series-markers-all-above.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
function generateData() { | ||
const res = []; | ||
const time = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 0)); | ||
for (let i = 0; i < 30; ++i) { | ||
res.push({ | ||
time: time.getTime() / 1000, | ||
value: i, | ||
}); | ||
|
||
time.setUTCDate(time.getUTCDate() + 1); | ||
} | ||
return res; | ||
} | ||
|
||
function runTestCase(container) { | ||
const chart = window.chart = LightweightCharts.createChart(container); | ||
|
||
const mainSeries = chart.addHistogramSeries(); | ||
|
||
const data = generateData(); | ||
mainSeries.setData(data); | ||
|
||
const markers = [ | ||
{ time: data[0].time, position: 'aboveBar', color: 'red', shape: 'arrowUp' }, | ||
{ time: data[1].time, position: 'aboveBar', color: 'red', shape: 'arrowUp' }, | ||
|
||
]; | ||
|
||
mainSeries.setMarkers(markers); | ||
} |
29 changes: 29 additions & 0 deletions
29
tests/e2e/graphics/test-cases/series-markers/series-markers-all-below.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function generateData() { | ||
const res = []; | ||
const time = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 0)); | ||
for (let i = 0; i < 30; ++i) { | ||
res.push({ | ||
time: time.getTime() / 1000, | ||
value: i, | ||
}); | ||
|
||
time.setUTCDate(time.getUTCDate() + 1); | ||
} | ||
return res; | ||
} | ||
|
||
function runTestCase(container) { | ||
const chart = window.chart = LightweightCharts.createChart(container); | ||
|
||
const mainSeries = chart.addHistogramSeries(); | ||
|
||
const data = generateData(); | ||
mainSeries.setData(data); | ||
|
||
const markers = [ | ||
{ time: data[data.length - 3].time, position: 'belowBar', color: 'red', shape: 'arrowUp' }, | ||
{ time: data[data.length - 2].time, position: 'belowBar', color: 'red', shape: 'arrowUp' }, | ||
]; | ||
|
||
mainSeries.setMarkers(markers); | ||
} |
29 changes: 29 additions & 0 deletions
29
tests/e2e/graphics/test-cases/series-markers/series-markers-all-inbar.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function generateData() { | ||
const res = []; | ||
const time = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 0)); | ||
for (let i = 0; i < 30; ++i) { | ||
res.push({ | ||
time: time.getTime() / 1000, | ||
value: i, | ||
}); | ||
|
||
time.setUTCDate(time.getUTCDate() + 1); | ||
} | ||
return res; | ||
} | ||
|
||
function runTestCase(container) { | ||
const chart = window.chart = LightweightCharts.createChart(container); | ||
|
||
const mainSeries = chart.addHistogramSeries(); | ||
|
||
const data = generateData(); | ||
mainSeries.setData(data); | ||
|
||
const markers = [ | ||
{ time: data[data.length - 3].time, position: 'inBar', color: 'red', shape: 'arrowUp' }, | ||
{ time: data[data.length - 2].time, position: 'inBar', color: 'red', shape: 'arrowUp' }, | ||
]; | ||
|
||
mainSeries.setMarkers(markers); | ||
} |