Nivo: Migrate @nivo/bar to TypeScript

Created on 5 Nov 2020  路  5Comments  路  Source: plouc/nivo

bar pinned typescript

All 5 comments

This might be unrelated and if so I'll make a new issue.

In the docs, you can use colorBy as a prop but in TypeScript it doesn't recognize the prop

Example

 <ResponsiveBar
                data={data}
                groupMode="grouped"
                reverse={reverse}
                maxValue={3}
                enableGridY={false}
                // @ts-ignore
                colorBy="indexValue"
                indexBy="id"
                colors={{ scheme: 'pastel1' }}
                role="figure"
            />

It should be just colors. colorBy was the old way so the docs will need updated.

Okay. Heads up the colorBy prop works.

I tried using colors like so

colors="indexValue"

and it turned everything black.

Gonna dig around in the type declarations/bar source code to see how to properly set it up. If you all want help rewriting some components to TypeScript I might be able to contribute

Not sure 100% what you are trying to achieve, but I think this is the same behavior. https://codesandbox.io/s/summer-cache-7f4bl

I was looking for that datum usage. Thank you @wyze

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tj picture tj  路  4Comments

knackjax picture knackjax  路  3Comments

gcloeval picture gcloeval  路  3Comments

barnapisti1994 picture barnapisti1994  路  3Comments

luisrudge picture luisrudge  路  3Comments