react-native-pure-chart icon indicating copy to clipboard operation
react-native-pure-chart copied to clipboard

LineChart: How to fit dynamic data in the graph

Open luatnd opened this issue 6 years ago • 1 comments

I have a chart showing daily data with ~40 points And yearly data with 175 points And I try to make the data fit on the screen so that users don't need to scroll to see the hidden data.

Is there any configuration to support this case?


As #21 : I can use <PureChart gap={gapSize} /> props but gapSize need to dynamically calculated. And the new problem is: label is very close with each other, label text was broken when gapSize is too small.

luatnd avatar Jun 19 '19 07:06 luatnd

I believe what you are trying to do is not possible on the current version. But if you are interested I have made the change on my fork in develop branch.

To solve this I have added these props: showEveryNthXaxisLabel - specify int of every how many data you want to show X label. e.g. 3 xAxisTextLength - length of how long each of your xAxis label would be. e.g. 60

for gap prop value I suggest you use something like - (Dimensions.get('window').width/lengthOfYourDataPoints) - (50/lengthOfYourDataPoints)

I didn't make pull request for this because I think I can reimplement this much better If I have time

wjsoft08 avatar Jun 27 '19 23:06 wjsoft08