0

I try to create legends for jqPlot but they will just show the max and min values for y slope. Just like 'Max: 16 Min:2', but I can't figure out how. E.g, I tried giving labels as

var labels = [{'Max':16}, {'Min':2}];

But nothing seems to be working. Do you know any quick method or I should create my own special renderer for this? Thanks.

ufucuk
  • 475
  • 9
  • 21
  • Can you please give some more information about what do want the legend to look like and what isn't working exactly ? – Alon Adler Mar 05 '12 at 17:21

1 Answers1

0

ufucuk. I had the same problem and I solved it doing the following:

$("#hereGoesMyMinValue").text($("#myGraphId").
children(".jqplotxaxis").children(":first").text());
//first value shown
$("#hereGoesMyMaxValue").text($("#myGraphId").
children(".jqplot-xaxis").children(":last").text());
//last value shown

Note that this will be done only once. Here explains how to sync them

By the way, you also can do the following:

var title=$("#selecting_period").children(".jqplot-title").text();

var coolTitle=
 title+": Showing "+ $("#myGraphId").children(".jqplot-xaxis").
  children(":first").text()+" to "+$("#myGraphId").
   children(".jqplot-xaxis").children(":last").text();
     $("#myGraphId").children(".jqplot-title").text(coolTitle);
Community
  • 1
  • 1
rpxx
  • 1