plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

tickvals and ticktext showing same values

Open suribabu39 opened this issue 9 years ago • 6 comments

Hi, I am trying to plot charts using plotly js but when axis labels are tool long they are going out, overlapping with titles so I tried to use tickvals. After using tickvals both (on hover and while plotting axis labels it is showing ticktext). I am new to to plotly and got stuck here. Thank you in advance Codepen link: http://codepen.io/suribabu_95/pen/egLGgB

suribabu39 avatar Feb 09 '17 10:02 suribabu39

Hmm. I'm not sure I understand your question. Looks like your tickvals / ticktext solution is working properly. What is the desired behavior in your mind?

etpinard avatar Feb 09 '17 15:02 etpinard

Tickvals should be shown on hovering over the chart and ticktext should be displayed as axis labels. In my case ( http://codepen.io/suribabu_95/pen/egLGgB ) D1, D2, so on should be shown on x-axis while plotting(which it is showing) but on hovering over the chart also it is showing D1, D2, so on but I want to show tickvals which are Domain1, Domain2, so on on hovering over chart. Let me know if it is still not clear. Thank you

suribabu39 avatar Feb 10 '17 05:02 suribabu39

Does http://codepen.io/anon/pen/MJLvqV do what you want?

rpaskowitz avatar Feb 14 '17 06:02 rpaskowitz

Yes that is exactly what I needed. Thank You very much I have a small doubt though, Suppose If a had legends(whose values are long) also and I want to show them on too on hovering. Should I append them to x-axis values and put in "text" field ? My question is If I had anything which I want to show on hovering should I add to "text" field and put in "hoverinfo" ?

suribabu39 avatar Feb 14 '17 11:02 suribabu39

For the hoverinfo, you can simply add more content to the 'text' array. hoverinfo itself only accepts a few specific items to control what it shows, see https://plot.ly/javascript/reference/#bar-hoverinfo

Regarding the legend, it will be the series name shown and not information related to the data points. Plotly will try to size the chart and legend to fit the series names, but if the series name grows too long, you may encounter some issues. For that reason, you may want to truncate series names ahead of time, and then toss a custom tooltip on the legend so people can get the full name.

Here's an example with more text shown on hover, and a moderately long series name in the legend. Add more text to the series name to see why you may want to truncate to a fixed length. http://codepen.io/rpaskowitz/pen/PWVLvv

rpaskowitz avatar Feb 14 '17 17:02 rpaskowitz

Closing as this issue won't directly lead to a patch.

@suribabu39 questions of the likes are better asked on https://community.plot.ly/ to let other users comment and offer solutions. Thanks for using plotly.js :+1:

etpinard avatar Feb 15 '17 16:02 etpinard