JesperLekland / react-native-svg-charts

📈 One library to rule all charts for React Native 📊
MIT License
2.35k stars 404 forks source link

xAxis with grouped BarChart #382

Open CesarDenis opened 5 years ago

CesarDenis commented 5 years ago

What is the problem?

Is it possible to make chAssis with the grouped bar chart? I'm trying to do it and I can't.

@JesperLekland is there any example?

What platform?

React Native version: 0.60.5 react-native-svg-charts-version: 5.30

purplegamba commented 4 years ago

Try this with the grouped bar chart example:

<XAxis data={ barData[0].data } scale={ scale.scaleBand } formatLabel={ ( index ) => index }
svg={{ fontSize: 8, fill: 'black' }} />

(You will also need to add to imports at the top: import * as scale from 'd3-scale' )

purplegamba commented 4 years ago

While my solution above works fine for simple examples, it's not ideal. If your two sets of data are different lengths, you may have a problem. The same issue applies to the YAxis if the range of values is different.

As far as I can tell, the grouped chart functionality is relatively new and there are no corresponding grouped axis that would handle this data properly. Maybe this can be considered a feature request?