indiespirit / react-native-chart-kit

đź“ŠReact Native Chart Kit: Line Chart, Bezier Line Chart, Progress Ring, Bar chart, Pie chart, Contribution graph (heatmap)

Home Page:https://expo.io/@indiespirit/react-native-chart-kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get the real width of the line chart?

Demven opened this issue · comments

Hello, and thank you for this amazing library.

I'm developing my custom X-axis labels, and I need to know the width of the chart to display it correctly. For some reason, there's blank space around the chart, and I couldn't find any solution to get rid of it and let the chart fill all the space inside the provided container:

image

On different screens, the chart takes different % of the available container width, so I can't calculate reliably the necessary width for the labels:
image

Two questions:

  1. How to get the real width of the chart (excluding the empty space around)?
  2. How to get rid of the space and let the chart fill the container entirely?

Many many thanks! I will watch this thread until the answer is provided by the developers and community. At the moment I have to use crazy calculations...