user3188947
user3188947

Reputation: 1

Bar width in primefaces

I'm using primefaces 4.0 in my development project. One of modules assigned to me was creating a chart using bar chart. I'm already done with its main functionality.

My problem now is when the data that i'm graphing contains only one data. the bar chart's bar is too wide, because it has only one data to graph.

Can someone help me how to set the maximum width of the bar? Thank you so much!

Upvotes: 0

Views: 3405

Answers (1)

VulfCompressor
VulfCompressor

Reputation: 1410

Sure.

1) Set a extender to your <p:barChart>, like so: <p:barChart id="chart" extender="ext1"/>

2) In your JavaScript file (create one if you don't have any), add the following function:

function ext1() {
    this.cfg.seriesDefaults.rendererOptions = {
        barWidth : 30
    };
}

3) Change the barWidth value according to your needs.

Also, check out the jqPlot website for more chart options you can change: jqPlot Options

Upvotes: 1

Related Questions