Lawrence Cooke
Lawrence Cooke

Reputation: 1597

Flot JS - first bar border is thinner than others

I am using Flot JS to create a bar graph.

The graph is working but the border around the first bar is thinner on the left hand side than the other bars, is there any way to fix this so all the bars have the same width borders?

I think it is in some way related to having the grid turned off.

$.plot(placeholder, data, {
            series: {
                bars:{
                    show: true,
                    lineWidth: 2,
                    align:'center'
                }
            },
grid: {
    hoverable: false,
    clickable: false,

    show:false,

},legend: {
    show: false
},label: {
    show: false
}

        });

Flot Bar Graph

Upvotes: 1

Views: 97

Answers (1)

Raidri
Raidri

Reputation: 17560

The leftmost bar is at the edge of the chart and half of the left border is outside the chart. You can

  1. Set the minimum value for the x axis a little more to the left.
  2. Set the autoscaleMargin of the x axis to a value other than null (e.g. 0.02 as is the default for the y axis).

See the documentation for more help.

Upvotes: 1

Related Questions