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

Line in chart not showing

Open laura-chacon opened this issue 8 years ago • 6 comments

On OS X El Capitan version 10.11.5 (15F34)

node --version v6.0.0 nam --v v6.2.2 react-native-cli: 1.0.0 react-native: 0.28.0 watchman --v 4.5.0 xcode 7.3.1

I have this code using react-native-chart:

const styles = StyleSheet.create({
  parent: {
    flex: 1,
    backgroundColor: colors.MAIN_BACKGROUND_COLOR
  },
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  chart: {
    width: 300,
    height: 300
  }
});
progression = [[0,1], [1,3], [3,7], [4,9], [5, -10]];
    return (
      <View style={styles.parent}>
        <View style={styles.container}>
          <Chart
            style={styles.chart}
            data={progression}
            type="line"
            />
        </View>
      </View>);

The problem is that the axis are displayed fine but the line with the progression is not displayed. If I change the type to "bar" or "pie" works fine, but not for "line".

laura-chacon avatar Jul 27 '16 14:07 laura-chacon

Still having this problem. I'm using react-native-chart version 1.0.8-beta.

When I have line type this is the result of the chart (no line showing): line_progression

But if I change to bar type, this is the result: bar_progression

laura-chacon avatar Aug 03 '16 08:08 laura-chacon

+1, i'm having the same issue.

anthonyalayo avatar Aug 07 '16 22:08 anthonyalayo

Hey Laura,

After looking at other open issues I found something that works!

      <Chart
        style={styles.chart}
        data={data}
        verticalGridStep={5}
        showDataPoint={true}
        type="line"
        />

Looks like showDataPoint is false by default, if you set it to true explicitly it'll render on iOS. It'll be a good workaround for now

anthonyalayo avatar Aug 07 '16 22:08 anthonyalayo

I'll be on a plane tomorrow, so I'll have time to investigate these issues. Thanks.

tomauty avatar Aug 08 '16 00:08 tomauty

@anthonyalayo it's working with showDataPoint={true} as you said so thank you very much. @tomauty thank you for your work in this project

laura-chacon avatar Aug 08 '16 10:08 laura-chacon

As a generic FYI — I am no longer able to maintain this library. I recommend checking out victory-native as it's much more maintained.

tomauty avatar Jul 07 '17 20:07 tomauty