react-stockcharts icon indicating copy to clipboard operation
react-stockcharts copied to clipboard

Annotations falling off chart

Open moonlight16 opened this issue 6 years ago • 1 comments

I'm using a modified version of BarAnnotations (react-stockcharts/src/annotation/BarAnnotation.js) but the annotations are falling off the chart canvas. Any idea on what I need to adjust so that not only the candlesticks, but also the annotations, stay on the chart?

Here's a screenshot (notice the bottom annotations are falling off the chart): screen shot 2018-12-18 at 11 41 16 pm

Or let me ask it this way...

How does the native code ensure the candlesticks remain visible on the screen?

moonlight16 avatar Dec 19 '18 06:12 moonlight16

Ok, I think I have my answer. The <Chart/> object takes a parm yExtents. In many of the example it does things like: yExtents={d => [d.high, d.low]}. This defines the high and low edges for the chart on the yscale. So I would need to find a way to add some arbitrary padding OR more correctly calculate how much extra room above/below is needed if there's annotations being added.

moonlight16 avatar Dec 19 '18 17:12 moonlight16