How to plot graph (Line chart) with custom x-axis ,y-axis in jqplot?

76 views
Skip to first unread message

Samadhan Kshirsagar

unread,
Mar 11, 2016, 4:34:37 AM3/11/16
to jqplot-dev
Hi All,

     I want to create line chart report using jqplot library.I have taken custom x-axis and y-axis.I have taken 2 arrays with same size. I have written following code for it.


$(document).ready(function(){

var arrOfValueYaxis=[0,0,0,25,0,0,0,0,0,0,0,0,0,0,0,50,0,74,0,0];


var ticks=[26,24,22,20,18,16,14,12,10,8,6,4,2,0,-2,-4,-6,-8,-10,-11];


  var plot2 = $.jqplot ('chart2', [arrOfValueYaxis], {
      // Give the plot a title.
      title: 'Plot With Options',
      // You can specify options for all axes on the plot at once with
      // the axesDefaults object.  Here, we're using a canvas renderer
      // to draw the axis label which allows rotated text.
      axesDefaults: {
        labelRenderer: $.jqplot.CanvasAxisLabelRenderer
      },
      // Likewise, seriesDefaults specifies default options for all
      // series in a plot.  Options specified in seriesDefaults or
      // axesDefaults can be overridden by individual series or
      // axes options.
      // Here we turn on smoothing for the line.
      seriesDefaults: {
          rendererOptions: {
              smooth: true
          }
      },
      // An axes object holds options for all axes.
      // Allowable axes are xaxis, x2axis, yaxis, y2axis, y3axis, ...
      // Up to 9 y axes are supported.
      axes: {
        // options for each axis are specified in seperate option objects.
        xaxis: {
          label: "X Axis",
  ticks:ticks,
          // Turn off "padding".  This will allow data point to lie on the
          // edges of the grid.  Default padding is 1.2 and will keep all
          // points inside the bounds of the grid.
          pad: 0
        },
        yaxis: {
          label: "Y Axis"
        }
      }
    });
});



But actually issue is that this graph is showing wrong line chart.

I have 2 arrays i.e

var arrOfValueYaxis=[0,0,0,25,0,0,0,0,0,0,0,0,0,0,0,50,0,74,0,0];


var ticks=[26,24,22,20,18,16,14,12,10,8,6,4,2,0,-2,-4,-6,-8,-10,-11];

still its plotting with wrong points.

PFB screenshot.

Please anybody has suggestions on it then please share.

Thanks In Advance.


Samadhan Kshirsagar

unread,
Mar 11, 2016, 4:35:38 AM3/11/16
to jqplot-dev
Reply all
Reply to author
Forward
0 new messages