Price lines with titles
by Jon Eyrick
HTML
<script src="https://unpkg.com/[email protected]/dist/lightweight-charts.standalone.production.js"></script>
JavaScript
var chartElement = document.createElement('div');
var chart = LightweightCharts.createChart(chartElement, {
width:600,
height: 300,
layout: {
textColor: '#d1d4dc',
backgroundColor: '#000000',
},
rightPriceScale: {
scaleMargins: {
top: 0.3,
bottom: 0.25,
},
},
crosshair: {
vertLine: {
width: 4,
color: 'rgba(224, 227, 235, 0.1)',
style: 0,
},
horzLine: {
visible: false,
labelVisible: false,
},
},
grid: {
vertLines: {
color: 'rgba(42, 46, 57, 0)',
},
horzLines: {
color: 'rgba(42, 46, 57, 0)',
},
},
handleScroll: {
vertTouchDrag: false,
},
});
document.body.appendChild(chartElement);
var series = chart.addLineSeries({
color: 'rgb(0, 120, 255)',
lineWidth: 2,
crosshairMarkerVisible: false,
lastValueVisible: false,
priceLineVisible: false,
});
var data = [
{time: { year: 2018 ,month: 1 ,day: 1 }, value: 27.58405298746434},
{time: { year: 2018 ,month: 1 ,day: 2 }, value: 31.74088841431117},
{time: { year: 2018 ,month: 1 ,day: 3 }, value: 35.892978753808926},
{time: { year: 2018 ,month: 1 ,day: 4 }, value: 39.63642029045179},
{time: { year: 2018 ,month: 1 ,day: 5 }, value: 40.79167357702531},
{time: { year: 2018 ,month: 1 ,day: 6 }, value: 47.691740220947764},
{time: { year: 2018 ,month: 1 ,day: 7 }, value: 49.377161099825415},
{time: { year: 2018 ,month: 1 ,day: 8 }, value: 52.47379203136591},
{time: { year: 2018 ,month: 1 ,day: 9 }, value: 50.40209743179448},
{time: { year: 2018 ,month: 1 ,day: 10 }, value: 61.47316837848548},
{time: { year: 2018 ,month: 1 ,day: 11 }, value: 58.22831552141069},
{time: { year: 2018 ,month: 1 ,day: 12 }, value: 59.36868132891698},
{time: { year: 2018 ,month: 1 ,day: 13 }, value: 62.10845687168416},
{time: { year: 2018 ,month: 1 ,day: 14 }, value: 51.259701958506724},
{time: { year: 2018 ,month: 1 ,day: 15 }, value: 56.247578870411644},
{time: { year: 2018 ,month: 1 ,day: 16 }, value:...