marsant
marsant

Reputation: 1108

In jqPlot, how to remove the y-axis line?

I know this question is kind of duplicate to

jqPlot Styling - How to remove Y axis line?

But since that question did not get an confirmed answer (the one posted did not work for me), so I re-ask it here.

I had a simple example copied from jqPlot web page for bar chart example and want to remove the y-axis line without change it to $.jqplot.CategoryAxisRenderer (which can hide the axis line as for my x-axis).

http://jsfiddle.net/marsant/HndmB/3/

Code:

$(document).ready(function(){
    var s1 = [200, 600, 700, 1000, 600];
    // Can specify a custom tick Array.
    // Ticks should match up one for each y value (category) in the series.
    var ticks = ['May', 'June', 'July', 'August', 'September'];

    var plot1 = $.jqplot('chart1', [s1], {
        // The "seriesDefaults" option is an options object that will
        // be applied to all series in the chart.
        seriesDefaults:{
            renderer:$.jqplot.BarRenderer,
            rendererOptions: { barWidth: 20 },
            color:'blue',
            shadow: false,
        },  
        grid: {
            drawBorder: false,
            shadow: false,
        },  
        axes: {
            // Use a category axis on the x axis and use our custom ticks.
            xaxis: {
                renderer: $.jqplot.CategoryAxisRenderer,
                ticks: ticks,
                tickOptions: { showGridline: false, showMark: false  },  
                showTickMarks: false,
            },  
            // Pad the y axis just a little so bars can get close to, but 
            // not touch, the grid boundaries.  1.2 is the default padding.
            yaxis: {
                pad: 1.05,
                tickOptions: { formatString: '$%d', showMark: false },
                showTickMarks: false,
            }   
        }   
    }); 
});

update:

This code sample worked for me

yaxis: {
    renderer: $.jqplot.LinearAxisRenderer,
    rendererOptions: { drawBaseline: false, },
    ... ...
}

Upvotes: 1

Views: 2372

Answers (1)

Ovi Faur
Ovi Faur

Reputation: 528

You could try after the grid option and before the axes option to insert:

axesDefaults: {
    rendererOptions: {
       drawBaseline: false
    }
},

Hope it helps.

Upvotes: 5

Related Questions