Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jqPlot - Horizontal legend

Tags:

jquery

css

jqplot

jqPlot has the ability to create a legend for a chart. The examples show only vertical legends. I would like to make a horizontal legend. For instance, I want:

X-Label1 X-Label2 X-Label3

And don't want:

X-Label1
X-Label2
X-Label3

Thanks

like image 855
user1032531 Avatar asked Sep 10 '12 12:09

user1032531


1 Answers

This is very easy to achieve using the EnhancedLegendRenderer plugin. Just include the plugin and use options similar to this.

legend:{
    renderer: $.jqplot.EnhancedLegendRenderer,
    show: true,
    rendererOptions: {
        numberRows: 1
    }
}

You just have to set the numberRows to 1, so the legend will be rendered with only 1 row.

like image 178
GayashanNA Avatar answered Sep 22 '22 09:09

GayashanNA