5

I plot data with jqPlot using logAxisRenderer to have two logarithmic axes.

Everything is fine except of two problems:

  1. jqPlot creates a lot of empty space between 0 and 1.

  2. There are two zeros on the x-axis, since I format the numbers to "%'i" (one for 0.0 and one for 0.5).

I tried to use min:1 and max:100000 in order to hide the empty space and the zeros. But this didn't work. The resulting plot has no line and all x-axis labels are on the same spot on the left side of the axis.

Here is the code I use to create this plot:

$.jqplot(divId, [ line ], {
    title : title,
    series:[{showMarker:false}],
    axes : {
        xaxis : {
            label:'Users',
            renderer : $.jqplot.LogAxisRenderer,
            tickOptions:{
                tickDistribution: "power",
                formatString: "%'i"
            },
            labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
        },
        yaxis : {
            label:'Frequency',
            renderer : $.jqplot.LogAxisRenderer,
            tickOptions:{
                tickDistribution:"power",
                formatString: "%'i"
            },
            labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
        },
    },
});
Adinia
  • 3,722
  • 5
  • 40
  • 58

1 Answers1

2

You can use force ticks to solve this problem:

$.jqplot(divId, [ line ], {
    title : title,
    series:[{showMarker:false}],
    axes : {
        xaxis : {
            label:'Users',
            renderer : $.jqplot.LogAxisRenderer,
            ticks: [1, 10, 100, 1000, 10000],
            tickOptions:{
                tickDistribution: "power",
                formatString: "%'i"
            },
            labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
        },
        // ...
    },
});

This does not really solve your problem in a general way, but it does help. For me (jqPlot 1.0.4r1121) setting "min: 1" results in the behaviour you described. Settings both "min: 1" and "max: 10000" works for me but does not set power distributed ticks but even spaced ones.

Martin Becker
  • 3,331
  • 3
  • 22
  • 25