user2414932
user2414932

Reputation: 79

JQplot spacing between bars?

So i have a graph that contains some sample data (this is not the actual data, because then it will fill more than this page!)

 x      y
 3     foo;a
 4     foo;b
 5     bar;a
 6     bar;b 

enter image description here

now when i group the data into series, to make more sense of the graph like this

  x1       x2        y
  3        0        foo;a
  4        0        foo;b
  0        5        bar;a
  0        6        bar;b

enter image description here

As you can see, there is spacing between the bars for whatever reason. The general trend is the same, but with spacing. How can I remove the spacing?

here is a framework of my plot code

   title: some title,
    seriesDefaults: {
        renderer: $.jqplot.BarRenderer,
        shadow: false,        
        rendererOptions: {
            fillToZero: true,
            highlightColors: "#000000",
            shadowOffset: 0,
            shadowDepth: 0,
            barPadding: 0
        },
        pointLabels: {
            show: false
        }
    },
    grid: {
        shadow: false
    },
    highlighter: {
        showMarker: false,
        tooltipAxes: 'xy',
        showTooltip: true,
        show: true
    },
    axes: {
        xaxis: {
            renderer: $.jqplot.CategoryAxisRenderer,
            ticks: tick[i],
            tickOptions: {
                angle: -90,
                fontSize: '0pt',
                showMark: false,
                showGridline: true
            }
        },
        yaxis: {
            label: "Norm",
            tickInterval: 1
        }
    }
});

Upvotes: 1

Views: 3935

Answers (1)

AnthonyLeGovic
AnthonyLeGovic

Reputation: 2335

According to jQplot documentation about barRenderer, I think you can use barPadding and barMargin options to specify your needed space value (0px?)

Edit : barMargin seems to be what you needed as it allows you to specify number of pixels between groups of bars at adjacent axis values. (while barPadding allows you to specify number of pixels between adjacent bars at the same axis value).

Upvotes: 2

Related Questions