Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed setting empty data to series (#267)
- Loading branch information
Showing
5 changed files
with
59 additions
and
24 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
41 changes: 41 additions & 0 deletions
41
tests/e2e/graphics/test-cases/series/set-empty-data-to-histogram.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,41 @@ | ||
function generateData() { | ||
var res = []; | ||
var time = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 0)); | ||
for (var i = 0; i < 30; ++i) { | ||
res.push({ | ||
time: time.getTime() / 1000, | ||
value: i, | ||
}); | ||
|
||
time.setUTCDate(time.getUTCDate() + 1); | ||
} | ||
return res; | ||
} | ||
|
||
function generateColoredData() { | ||
var data = generateData(); | ||
data.forEach((item, index) => { | ||
item.color = index % 2 === 0 ? 'rgba(0, 150, 136, 0.8)' : 'rgba(255,82,82, 0.8)'; | ||
}); | ||
|
||
return data; | ||
} | ||
|
||
// eslint-disable-next-line no-unused-vars | ||
function runTestCase(container) { | ||
var chart = LightweightCharts.createChart(container); | ||
|
||
var areaSeries = chart.addAreaSeries(); | ||
var volumeSeries = chart.addHistogramSeries(); | ||
|
||
areaSeries.setData(generateData()); | ||
|
||
volumeSeries.setData(generateColoredData()); | ||
|
||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
volumeSeries.setData([]); | ||
resolve(); | ||
}, 1000); | ||
}); | ||
} |
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