React-native-chart-kit: Any way to add multiple dataset in line chart?

Created on 21 Oct 2019  路  8Comments  路  Source: indiespirit/react-native-chart-kit

Is there anyway to add 2 different dataset in single line chart?

All 8 comments

data = { datasets: [ { data: [3, 5, 6], color: () => '#C7EBFF', strokeWidth: 4 }, { data: [2, 5, 7], color: () => '#ED7C33' }, ] };

thx i tried that same but i noticed that i am fetching same values as second data array. Lolll

Now i changed with yours, values were different so it worked nicely.

So can we add more data between 2 labels?

For example i want to add 3 data in January and 3 data in February?

Yeah you can add even 3 data. It works

i mean i want to add more values in X axis. Following first value.
I got 3 value from January but different times. I want to mention it that its coming from different days.
:( I guess its littlebit painful.

For example:
dot dot dot dot dot dot dot dot dot
January ------- February ------- March

adding values between labels.

I am bypassing this problem like that, so i am able to add more values between 2 labels:

data={{
labels: ["January","","February"],
datasets: [
{ data: [3, 5, 6], color: () => '#C7EBFF', strokeWidth: 4 },
{ data: [2, 5, 7], color: () => '#ED7C33' }
],
}}

but i am perfectionist so i need better way 馃拑

I think right now this is the way to do it. Although I understood when you said you wanted to show different days in January, maybe this is related to the scale you choose to your chart.

I mean, if the days were important why you just don't used a scale: days X value rather than month X value?

I don't know your use case, but I found myself between a problem like this and I just rethought the meaning of the chart. You can check the hidePointsAtIndex prop to, if you want to hide some of the dots.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carlojesuscponti picture carlojesuscponti  路  6Comments

LillyBrainy picture LillyBrainy  路  4Comments

bailih picture bailih  路  4Comments

vedika96 picture vedika96  路  4Comments

briaclg picture briaclg  路  4Comments