react-timeseries-charts icon indicating copy to clipboard operation
react-timeseries-charts copied to clipboard

Label in EventChart

Open ctcoder5 opened this issue 6 years ago • 6 comments

❔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

ctcoder5 avatar Jul 28 '19 18:07 ctcoder5

I want to switch from english to portuguese, any help?

alexandresebrao avatar Aug 07 '19 16:08 alexandresebrao

@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

molzahn-sio avatar Aug 14 '19 13:08 molzahn-sio

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

brandly avatar Aug 15 '19 12:08 brandly

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.

molzahn-sio avatar Aug 15 '19 13:08 molzahn-sio

@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 avatar Aug 24 '19 16:08 brandly

@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!

pjm17971 avatar Aug 26 '19 17:08 pjm17971