-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't shift chart when new data replaces existing whitespace (#1431)
* don't shift chart when new data replaces existing whitespace * add notes to e2e tests about expected result
- Loading branch information
1 parent
8311bfc
commit 71c1d83
Showing
5 changed files
with
69 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
44 changes: 44 additions & 0 deletions
44
tests/e2e/graphics/test-cases/time-scale/do-not-shift-range-when-replacing-whitespace.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,44 @@ | ||
const seriesOneData = [ | ||
{ time: '2019-04-11', value: 80.01 }, | ||
{ time: '2019-04-12', value: 96.63 }, | ||
{ time: '2019-04-13', value: 76.64 }, | ||
{ time: '2019-04-14', value: 81.89 }, | ||
{ time: '2019-04-15', value: 74.43 }, | ||
{ time: '2019-04-16', value: 80.01 }, | ||
]; | ||
|
||
const seriesTwoWhitespaceData = [ | ||
{ time: '2019-04-17' }, | ||
{ time: '2019-04-18' }, | ||
{ time: '2019-04-19' }, | ||
{ time: '2019-04-20' }, | ||
]; | ||
|
||
function runTestCase(container) { | ||
const chart = window.chart = LightweightCharts.createChart(container, { | ||
timeScale: { | ||
barSpacing: 30, | ||
rightOffset: 10, | ||
shiftVisibleRangeOnNewBar: true, | ||
shiftVisibleRangeWhenNewBarReplacesWhitespace: false, | ||
}, | ||
}); | ||
|
||
const s1 = chart.addLineSeries({ | ||
color: 'red', | ||
}); | ||
s1.setData(seriesOneData); | ||
|
||
return new Promise(resolve => { | ||
requestAnimationFrame(() => { | ||
const s2 = chart.addLineSeries({ | ||
color: 'blue', | ||
}); | ||
s2.setData(seriesTwoWhitespaceData); | ||
requestAnimationFrame(() => { | ||
s1.update({ time: '2019-04-17', value: 84.43 }); | ||
requestAnimationFrame(resolve); | ||
}); | ||
}); | ||
}); | ||
} |