Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jqPlot and naming series

I'm trying out jqPlot, but I can't figure out how to set the name of the different series.

Currently, my code looks like this:

$(document).ready(function () {
    $.jqplot('chartdiv', [
        [[201201, 10], [201202, 20], [201203, 30], [201204, 60], [201205, 40]], 
        [[201201, 5], [201202, 10], [201203, 7], [201204, 8], [201205, 11]]
    ], {
        axes: {
            xaxis: {
                label: "Year/month",
                pad: 0
            },
            yaxis: {
                label: "Amount (Kr)"
            }
        },
        legend: {
            show: true
        }
    });
});

It renders the diagram, but the series are named series 1 and series 2. Is there any way that I can control the naming of the series?

like image 463
Pelle Avatar asked Jun 05 '12 10:06

Pelle


1 Answers

To have names for series you must set 'label' which is under 'series'. Please see here for documentation.

Example code presenting its use is available here.

like image 147
Boro Avatar answered Sep 20 '22 14:09

Boro