-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1330 from luk707/master
fix: Add an option to disable crosshair (#749)
- Loading branch information
Showing
9 changed files
with
177 additions
and
9 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
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
62 changes: 62 additions & 0 deletions
62
tests/e2e/graphics/test-cases/applying-options/crosshair-mode-hidden-unhide.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,62 @@ | ||
function generateData() { | ||
const res = []; | ||
const time = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 0)); | ||
for (let i = 0; i < 500; ++i) { | ||
res.push({ | ||
time: time.getTime() / 1000, | ||
value: i, | ||
}); | ||
|
||
time.setUTCDate(time.getUTCDate() + 1); | ||
} | ||
return res; | ||
} | ||
|
||
/* | ||
Start with the crosshair hidden | ||
then hide it | ||
and then show it again. | ||
-> Should be visible. | ||
*/ | ||
function runTestCase(container) { | ||
const chart = window.chart = LightweightCharts.createChart(container, { | ||
crosshair: { | ||
vertLine: { | ||
color: '#FF0000', | ||
width: 5, | ||
visible: true, | ||
style: 0, // solid | ||
}, | ||
horzLine: { | ||
color: '#00FF00', | ||
width: 5, | ||
visible: true, | ||
style: 0, // solid | ||
}, | ||
mode: LightweightCharts.CrosshairMode.Normal, | ||
}, | ||
}); | ||
|
||
const mainSeries = chart.addLineSeries(); | ||
|
||
mainSeries.setData(generateData()); | ||
|
||
return new Promise(resolve => { | ||
setTimeout(() => { | ||
chart.applyOptions({ | ||
crosshair: { | ||
mode: LightweightCharts.CrosshairMode.Hidden, | ||
}, | ||
}); | ||
setTimeout(() => { | ||
chart.applyOptions({ | ||
crosshair: { | ||
mode: LightweightCharts.CrosshairMode.Normal, | ||
}, | ||
}); | ||
|
||
resolve(); | ||
}, 100); | ||
}, 100); | ||
}); | ||
} |
49 changes: 49 additions & 0 deletions
49
tests/e2e/graphics/test-cases/applying-options/crosshair-mode-hidden.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,49 @@ | ||
function generateData() { | ||
const res = []; | ||
const time = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 0)); | ||
for (let i = 0; i < 500; ++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, { | ||
crosshair: { | ||
vertLine: { | ||
color: '#FF0000', | ||
width: 5, | ||
visible: true, | ||
style: 0, // solid | ||
}, | ||
horzLine: { | ||
color: '#00FF00', | ||
width: 5, | ||
visible: true, | ||
style: 0, // solid | ||
}, | ||
mode: LightweightCharts.CrosshairMode.Normal, | ||
}, | ||
}); | ||
|
||
const mainSeries = chart.addLineSeries(); | ||
|
||
mainSeries.setData(generateData()); | ||
|
||
return new Promise(resolve => { | ||
setTimeout(() => { | ||
chart.applyOptions({ | ||
crosshair: { | ||
mode: LightweightCharts.CrosshairMode.Hidden, | ||
}, | ||
}); | ||
|
||
resolve(); | ||
}, 100); | ||
}); | ||
} |
37 changes: 37 additions & 0 deletions
37
tests/e2e/graphics/test-cases/initial-options/crosshair-mode-hidden.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,37 @@ | ||
function generateData() { | ||
const res = []; | ||
const time = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 0)); | ||
for (let i = 0; i < 500; ++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, { | ||
crosshair: { | ||
vertLine: { | ||
color: '#FF0000', | ||
width: 5, | ||
visible: true, | ||
style: 0, // solid | ||
}, | ||
horzLine: { | ||
color: '#00FF00', | ||
width: 5, | ||
visible: true, | ||
style: 0, // solid | ||
}, | ||
mode: LightweightCharts.CrosshairMode.Hidden, | ||
}, | ||
}); | ||
|
||
const mainSeries = chart.addLineSeries(); | ||
|
||
mainSeries.setData(generateData()); | ||
} |