React-native-svg-charts: ShowGrid doesn't do anything

Created on 10 Aug 2018  路  2Comments  路  Source: JesperLekland/react-native-svg-charts

ShowGrid not working

When does it happen?

All Charts

What platform?

  • [ ] iOS
  • [x] Android: 8.0

React Native version:0.56.0

Code to reproduce

```import React from 'react';
import { View } from 'react-native';
import { BarChart, Grid, XAxis } from 'react-native-svg-charts';

export default class BarChartExample extends React.PureComponent {

render() {
    const fill = 'rgb(134, 65, 244)';
    const data = [
      50, 10, 40, 95, 4, 24, 85, 0, 35, 53, 53, 24, 50, 20, 80
    ];

    return (
      <View style={{ paddingHorizontal: 20 }}>
        <BarChart
          style={{ height: 200 }}
          data={data}
          svg={{ fill }}
          showGrid={false}
          contentInset={{ top: 30, bottom: 30 }}
        >
          <Grid />
        </BarChart>
        <XAxis
          style={{ marginHorizontal: -10 }}
          data={data}
          formatLabel={(value) => data[value]}
          contentInset={{ left: 10, right: 10 }}
          svg={{ fontSize: 10, fill: 'black' }}
        />
      </View>
    );
}

}
```

Most helpful comment

The solution is to not render <Grid /> component!

All 2 comments

The solution is to not render <Grid /> component!

As @ghoshabhi said. As you render the Grid yourself, you can also just not render it. The showGrid prop is no longer supported (I might need to look through the documentation and remove it there as well)

Was this page helpful?
0 / 5 - 0 ratings