Jqplot vertical axis label

A very simple question, but I could not figure it out ... I tried using jqplot to create a line graph with a vertical y-axis label. Based on the jqplot website example , all I need is to use this plugin jqplot.canvasAxisLabelRenderer.min.js. I tried it on the spot, but it didn't work. Can someone give me a hint of this? Below is a demonstration of my problem.

Below is my code:

$(document).ready(function(){
        $.jqplot.config.enablePlugins = true;
        var s1 = $.parseJSON($('#x_indi_val').text());    
        $.jqplot('chart1', [s1], {                
            seriesDefaults: { 
               showMarker:false,
               pointLabels: { show:false } ,
            },                
            series:[
               {label:'Individuals'}
            ],
            axes: {
                xaxis: {
                   label :'Time units',
                   pad: 0,
                },
                yaxis: {
                    label: 'Number of individuals',
                    //jqplot example indicated that use the following js file can give you a vertical label, I tried locally, but it did not work
                    //renderer: $.jqplot.canvasAxisLabelRenderer
                }
            },
            legend: {
                show: true,
                location: 'ne',
                placement: 'inside',
                fontSize: '11px'
            } 
        });   
    })​;
+5
source share
1 answer

You had a few minor but important issues in your code, as shown in the demo below:

  • You forgot to import the two scripts required by the label renderer:

    <script type="text/javascript" src="../src/plugins/jqplot.canvasTextRenderer.min.js"></script>

    <script type="text/javascript" src="../src/plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>

  • , :

    labelRenderer: $.jqplot.CanvasAxisLabelRenderer

, .

+8

All Articles