Noob needs a little help with graph legend.

57 views
Skip to first unread message

Jon Bennett

unread,
Jul 24, 2019, 8:50:16 AM7/24/19
to Flot graphs
OK, I'm kinda new to the whole web-dev thing, so if I've
done something stupid, it was not careless.

I have read the flot API spec several times, and have spent a few hours
googling to see if this was a common problem. I am quite certain that I am
doing something wrong, but after about 20 hours of thrashing I have not yet figured it out.

I am trying to use flot to display some data, but I am having two problems with the legend:
1) I am not able to make it go horizontal.
2) when I try to move it to a different container the graph quits drawing.

I have attached a file that demonstrates the problems that I am having.
You should be able to open it in any browser and it should demonstrate
the problems that I am having.

You should not even need to put it on a web site as it is a stand alone
html file.

Thanks in advance for your help, I really do appreciate you taking
the time to answer questions from the anonymous web.

--
Jon

jon_flot.html

MissyLaMotte

unread,
Jul 24, 2019, 9:32:02 AM7/24/19
to Flot graphs

Hi Jon,

it looks like the noColumns option for the legend is not supported anymore, which explains, why your legend is always a column instead of a row.

The reason your second plot is not drawing is that you don't use the container option correctly. It expects an object, not just an id. If you change your code to:

var container = document.getElementById('legend');
options = { legend: { show: true, position: "nw", container: container} };
$.plot("#graph2",  allSeries, options);

it should work.

Jutta

Jon Bennett

unread,
Jul 24, 2019, 9:44:46 AM7/24/19
to Flot graphs
Thanks so much for your help. Your suggestion worked perfectly, so I can incorporate the changes into my
actual page.

Also, it looks like I need to post a correction request regarding the API documentation.

Thanks again. I really do appreciate you taking the time to help me.

--
Jon
Reply all
Reply to author
Forward
0 new messages