lightweight-charts-react-wrapper icon indicating copy to clipboard operation
lightweight-charts-react-wrapper copied to clipboard

Is it possible to add HTML to the top left of charts?

Open wozhendeai opened this issue 2 years ago • 3 comments

For example, see here: https://tradingview.github.io/lightweight-charts/tutorials/customization/finishing-touches image

wozhendeai avatar Aug 26 '23 18:08 wozhendeai

Yes. You can start with "legend" or "moving everage" examples on the demo page

trash-and-fire avatar Aug 28 '23 17:08 trash-and-fire

Oh I should update the examples in the code-sandbox to match version 4.0.0 =(

trash-and-fire avatar Aug 28 '23 18:08 trash-and-fire

So the idea is to wrap the chart component in a relative div and place whatever you want on the chart using absolute position.

            <div className={styles.container}>
                <Chart height={300} width={600}>
                    <AreaSeries data={data}/>
                </Chart>
                <div className={styles.legend}>{legend}</div>
            </div>
.container {
   position: relative;
}

.legend {
   position: absolute;
   left: 12px;
   top: 12px;
   z-index: 1;
   font-size: 12px;
   line-height: 18px;
   font-weight: 300;
}

trash-and-fire avatar Aug 28 '23 18:08 trash-and-fire