Black Lives Matter. Please consider donating to Black Girls Code today.

"Name" feature in not working when only one trace is left

I am using REST URL to get the traces and I have many traces usually comes from URL but some time I left with only one trace to plot the graph.

I wrote a code giving “name” for data/trace:

mydata[count] = {
x: xData,
y: yData,
name: name,
mode: ‘lines’,
type: ‘scatter’

and it is working with multiple traces in one graph but when only one trace left it is not showing the “name”. I need the title or name on side to show the graph title.

Please help with this or any work around which I can try it.

Try setting hoverinfo: 'x+y+name':

Very nice; it is working with “hoverinfo” but, the problem is trace name is too long and it is not showing full name and hiding with ellipsis. I want to show full name!!

When I have more than one trace then there is list of all the names with color at right-top corner of graph so, it is okay with half name and ellipsis but when I have only one trace then there is no option to show full name of graph!

I tried with “text” but it is good for only one trace; when I have more than one trace then it is showing twice like hoverinfo also and text both!!

Hi @Etienne thank you.

I found the answer, I did like this:

name: "Very loooooooooong name for graphhhhhhhh"
text: name,
hoverinfo: ‘x+y+text’,

Which worked very well with both the cases.

It’s not working for me :

name: “[k]”
text: name,
hoverinfo: ‘x+y+text’,