Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQPlot Legend outside of graph

I am using JQPlot and I have many graphs on one HTML page. Each of the graphs has the same legend.

My question is this: Is it possible to display a legend totally outside of the graph with its own position on the HTML page or in its own div?

like image 258
Garry Avatar asked Jan 22 '13 22:01

Garry


2 Answers

legend:{ 
                show:true,
                    renderer: $.jqplot.EnhancedLegendRenderer,
                    location: 's' ,
                    placement : "outside",
                    marginTop : "30px",
                    rendererOptions: {
                        numberRows: 1
                    }
                 },

You can use placement : "outside" like in the above code. And you can move it using marginTop,marginBottom,marginRight,marginLeft properties.

like image 170
DilanG Avatar answered Nov 02 '22 07:11

DilanG


Maybe you could hide the legend of the 2nd to the last graph, like this:

legend: { show:false}

and in the 1st graph, put something like:

 legend:{
        show:true, 
        placement: 'outside', 
        rendererOptions: {
            numberRows: 1
        }, 
        location:'n'

This way you will only show one legend at the top of the graphs.

like image 3
Pablo Claus Avatar answered Nov 02 '22 08:11

Pablo Claus