capitalone / react-native-pathjs-charts

Android and iOS charts based on react-native-svg and paths-js
Apache License 2.0
879 stars 260 forks source link

Bar chart only support three colors? #148

Closed xwz1116 closed 7 years ago

xwz1116 commented 7 years ago

I want to show five colors in my Bar chart,but only show three colors,

marzolfb commented 7 years ago

Better documentation would help here but you want to use the pallete property to specify the colors you want to use. For example, I tweaked the "Bar (Column) - Basic" chart in the example app so that it looks like this:

image

I did this by adding data values for new columns named "orange" and "pear" and then I added the palette property to the Bar component like so:

<View style={styles.container}>
        <Bar
          data={data} options={options} accessorKey='v'
          pallete={
            [
              {'r':25,'g':99,'b':201},
              {'r':24,'g':175,'b':35},
              {'r':190,'g':31,'b':69},
              {'r':100,'g':36,'b':199},
              {'r':214,'g':207,'b':32},
              {'r':198,'g':84,'b':45}
            ]
          }
          />
      </View>

Does that help?

xwz1116 commented 7 years ago

oh,thank you very much,i get t.