Skip to content

Commit cd354e8

Browse files
authored
Merge pull request #156 from kumarharsh/docs/154
docs: address issue with multi-dataset charts - closes #154
2 parents 8c2abe0 + e610d7e commit cd354e8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,13 @@ Looks for the element under the event point, then returns all elements from that
207207
}
208208
```
209209

210+
### Working with Multiple Datasets
211+
212+
You will find that any event which causes the chart to re-render, such as hover tooltips, etc., will cause the first dataset to be copied over to other datasets, causing your lines and bars to merge together. This is because to track changes in the dataset series, the library needs a `key` to be specified - if none is found, it can't tell the difference between the datasets while updating. To get around this issue, you can take these two approaches:
213+
214+
1. Add a `label` property on each dataset. By default, this library uses the `label` property as the key to distinguish datasets.
215+
2. Specify a different property to be used as a key by passing a `datasetKeyProvider` prop to your chart component, which would return a unique string value for each dataset.
216+
210217
## Development (`src`, `lib` and the build process)
211218

212219
**NOTE:** The source code for the component is in `src`. A transpiled CommonJS version (generated with Babel) is available in `lib` for use with node.js, browserify and webpack. A UMD bundle is also built to `dist`, which can be included without the need for any build system.

0 commit comments

Comments
 (0)