Percentage price scale
by TradingView
HTML
<script src="https://unpkg.com/lightweight-charts@4.0/dist/lightweight-charts.standalone.production.js"></script>
JavaScript
var chart = LightweightCharts.createChart(document.body, {
width: 600,
height: 300,
rightPriceScale: {
scaleMargins: {
top: 0.1,
bottom: 0.1,
},
mode: LightweightCharts.PriceScaleMode.Percentage,
borderColor: 'rgba(197, 203, 206, 0.4)',
},
timeScale: {
borderColor: 'rgba(197, 203, 206, 0.4)',
},
layout: {
background: {
type: 'solid',
color: '#100841',
},
textColor: '#ffffff',
},
grid: {
vertLines: {
color: 'rgba(197, 203, 206, 0.4)',
style: LightweightCharts.LineStyle.Dotted,
},
horzLines: {
color: 'rgba(197, 203, 206, 0.4)',
style: LightweightCharts.LineStyle.Dotted,
},
},
});
var areaSeries = chart.addAreaSeries({
topColor: 'rgba(67, 83, 254, 0.7)',
bottomColor: 'rgba(67, 83, 254, 0.3)',
lineColor: 'rgba(67, 83, 254, 1)',
lineWidth: 2,
});
var extraSeries = chart.addAreaSeries({
topColor: 'rgba(255, 192, 0, 0.7)',
bottomColor: 'rgba(255, 192, 0, 0.3)',
lineColor: 'rgba(255, 192, 0, 1)',
lineWidth: 2,
});
areaSeries.setData([
{ time: '2018-10-19', value: 219.31 },
{ time: '2018-10-22', value: 220.65 },
{ time: '2018-10-23', value: 222.73 },
{ time: '2018-10-24', value: 215.09 },
{ time: '2018-10-25', value: 219.8 },
{ time: '2018-10-26', value: 216.3 },
{ time: '2018-10-29', value: 212.24 },
{ time: '2018-10-30', value: 213.3 },
{ time: '2018-10-31', value: 218.86 },
{ time: '2018-11-01', value: 222.22 },
{ time: '2018-11-02', value: 207.48 },
{ time: '2018-11-05', value: 201.59 },
{ time: '2018-11-06', value: 203.77 },
{ time: '2018-11-07', value: 209.95 },
{ time: '2018-11-08', value: 208.49 },
{ time: '2018-11-09', value: 204.47 },
{ time: '2018-11-12', value: 194.17 },
{ time: '2018-11-13', value: 192.23 },
{ time: '2018-11-14', value: 186.8 },
{ time: '2018-11-15', value: 191.41 },
{ time: '2018-11-16', value: 193.53 },
{ time: '2018-11-19', value: 185.86 },
{ time: '2018-11-20', value: 176.98 },
{ time: '2018-11-21', value: 176.78...