react-timeseries-charts
react-timeseries-charts copied to clipboard
Label in EventChart
❔Question
Is there a prop/setting/approach to display the label of an EventChart at all times instead of just on mouse over? I am utilizing the EventChart very similar to the Outage Events sample on your site.
pondjs: "0.8.10" react-timeseries-charts: "0.15.5"
Your Environment
| Software | Name/Version |
|---|---|
| react-timeseries-charts | 0.15.5 |
| Browser | Chrome |
| Operating System | windows 10 |
I want to switch from english to portuguese, any help?
@ctcoder5 Any luck in the meantime? I'm currently running into the same necessity and I'm still looking for a solution.
@alexandresebrao I added a suggestion to your topic in #413
the label is displayed here:
https://github.com/esnet/react-timeseries-charts/blob/c36d4034fd219101be1e52d9240aeeff8c124c42/src/components/EventChart.js#L124-L134
but that only gets set if isHover:
https://github.com/esnet/react-timeseries-charts/blob/c36d4034fd219101be1e52d9240aeeff8c124c42/src/components/EventChart.js#L112-L114
so i don't think this is possible with the current API
The documentation says "experimental state" so I assume the EventChart will feature such options when its complete.
For the time being I'm looking into workarounds. Thanks for the code line in that regard.
@pjm17971 what if the label prop, as a function, took both the event and state? then, you could remove the if (isHover) block highlighted in my last comment.
that way, you could still only show labels on hover if you'd like, but it would support @ctcoder5's use case as well.
this also mirrors the parameters passed to the style prop on EventChart.
https://github.com/esnet/react-timeseries-charts/blob/c36d4034fd219101be1e52d9240aeeff8c124c42/src/components/EventChart.js#L89
i'd be happy to send a PR, if you like this idea.
@brandly I think that would work, so long as if the label prop was not a function it behaves the way it does now. Can you send a PR? Thanks!