-
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.
Merge pull request #1621 from tradingview/1620-improve-price-scale-la…
…bels-alignment 1620: Improve price scale labals alignment
- Loading branch information
Showing
3 changed files
with
96 additions
and
27 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
44 changes: 44 additions & 0 deletions
44
tests/e2e/graphics/test-cases/price-scale/improve-alignment.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 @@ | ||
function runTestCase(container) { | ||
const chartOptions = { | ||
height: 500, | ||
width: 600, | ||
rightPriceScale: { | ||
scaleMargins: { | ||
top: 0, | ||
bottom: 0, | ||
}, | ||
entireTextOnly: true, | ||
alignLabels: true, | ||
}, | ||
}; | ||
|
||
const chart = (window.chart = LightweightCharts.createChart( | ||
container, | ||
chartOptions | ||
)); | ||
|
||
const data1 = Array.from({ length: 10 }).map((_, index) => ({ time: index * 10000, value: 100 - index })); | ||
const data2 = Array.from({ length: 10 }).map((_, index) => ({ time: index * 10000, value: 108.3 - index * 2 })); | ||
const data3 = Array.from({ length: 10 }).map((_, index) => ({ time: index * 10000, value: 99 + index })); | ||
const data4 = Array.from({ length: 10 }).map((_, index) => ({ time: index * 10000, value: 92.8 + (index - 1) * 2 })); | ||
|
||
const series1 = chart.addLineSeries(); | ||
series1.setData(data1); | ||
|
||
const series2 = chart.addLineSeries({ | ||
color: 'green', | ||
}); | ||
series2.setData(data2); | ||
|
||
const series3 = chart.addLineSeries({ | ||
color: 'purple', | ||
}); | ||
series3.setData(data3); | ||
|
||
const series4 = chart.addLineSeries({ | ||
color: 'orange', | ||
}); | ||
series4.setData(data4); | ||
|
||
chart.timeScale().fitContent(); | ||
} |