Beginner
Beginner

Reputation: 29533

Jqplot - How to have vertical lines and make xaxis go up in plotted values?

I have plotted a line graph using jqplot.

What i would like is vertical lines and to start from 3 and go up in the plotted values along the bottom. so 3, 6, 9, 12 , 15, 29, 36 Also a dash marker along the left.

This is what i have at the moment:

$(document).ready(function(){
    $.jqplot('chart2', [[[3, @(Model.LearnerWeek[0])], [6, @(Model.LearnerWeek[1])], [9, @(Model.LearnerWeek[2])],
                       [12, @(Model.LearnerWeek[3])], [15, @(Model.LearnerWeek[4])], [29, @(Model.LearnerWeek[5])], [36, @(Model.LearnerWeek[6])]],
                       [[3, @(Model.ManagerWeek[0])], [6, @(Model.ManagerWeek[1])], [9, @(Model.ManagerWeek[2])],
                       [12, @(Model.ManagerWeek[3])], [15, @(Model.ManagerWeek[4])], [29, @(Model.ManagerWeek[5])], [36, @(Model.ManagerWeek[6])]]],
        {
            axes: {
                yaxis: { tickOptions: { show: false}, min: 0, max: 100, label: 'Participation Rate', labelRenderer: $.jqplot.CanvasAxisLabelRenderer },
                xaxis: { min: 3, max: 36, label: 'Week', tickOptions: { formatString: '%d' } }
            },
            seriesDefaults: {
                showMarker: false ,
                rendererOptions: {
                    diameter: undefined, // diameter of pie, auto computed by default.
                    padding: 10,        // padding between pie and neighboring legend or plot margin.
                    fill: true,         // render solid (filled) slices.
                    shadowOffset: 2,    // offset of the shadow from the chart.
                    shadowDepth: 15,     // Number of strokes to make when drawing shadow.  Each stroke
                    // offset by shadowOffset from the last.
                    shadowAlpha: 1   // Opacity of the shadow
                }
            },
            seriesColors: ['#3591cf', '#ef4058', '#73C774', '#C7754C', '#17BDB8']
    });
});

I have played around with render options and xasis but cant seem to work it out

edit:

example:

http://jsfiddle.net/uzi002/y4YKY/

Upvotes: 1

Views: 724

Answers (1)

user180100
user180100

Reputation:

Here's a fork of you fiddle for axes tick values using:

axes: {
    yaxis: { numberTicks: 5, /* ...*/ }, 
    xaxis: { renderer:$.jqplot.CategoryAxisRenderer, rendererOptions:{sortMergedLabels:true}, /* ... */}
},

Revelant parts of the doc can be found here

Upvotes: 1

Related Questions