Closed JMPiechowiak closed 5 years ago
@JMPiechowiak, can you please setup a running example on codesandbox please? It's been very useful to solve several issue. Thank you
I'm closing this issue due to lack of response, feel free to comment if you can setup an example.
Actually after seting up an example on codesandbox legeds seem to appear normally with exact same code. What I've noticed is that in my project legeds do not display to any of the charts not only Line. Is there some way to use @nivo/legends directly? Without 'legends' props of the chart?
@JMPiechowiak, yes you can, but honestly, if you want to handle legends outside of the charts, you'd better use html. Also, as the package was designed to be used internally by others nivo components, you'll have to look at the code to see how it can be used. Might be a stupid question, but are you sure you used the same versions on codesandbox?
Okay I figured this out. The problem was i was importing ResponsiveLine from "nivo" not from "@nivo/line". Now everything seems to work perfectly.
This import statement was not obvious to be honest. I thought that nivo library contains everything.
I'm glad you solved your problem. nivo is the old (deprecated) all-in-one package. You don't want to import ~40 components with all their dependencies while you only use one :)
legends, defs, fill properties also don't work locally in <ResponsiveChoropleth />
. though import { ResponsiveChoropleth } from "@nivo/geo";
.
my problem solved when i updated my @nivo/bar from "^0.50.0" to "^0.80.0" version.
Hey, legend is not rendering for my ResponsiveLine chart component. I even set an anchor to center becouse I was suspecting that maybe it doesn't fit in a div, but still nothing. Here is my chart:
and here is the code: