Viplime
Viplime

Reputation: 141

Setting BarWidth In Primefaces 3.5 [BarChart]

I want to set width of bars in barchart of primefaces.I tried this extender but didn't work :

this.cfg.seriesDefaults = {
    rendererOptions: {
      barWidth:10  
  }
};

How can i handle this?

Thanks.

Upvotes: 1

Views: 2205

Answers (2)

Le Sabbaghov Vert
Le Sabbaghov Vert

Reputation: 1

In case your are still looking for a solution, I would suggest trying the following:

this.cfg.seriesDefaults.rendererOptions= { barWidth:10
};

I slightly modified the syntax of your code. It worked fine with me.

Hope it helps.

Upvotes: 0

gokhansari
gokhansari

Reputation: 2439

You should set width of barchart dynamically by setting style attribute like below, component arrange bar width automatically;

style="height:720px; width:#{statisticBean.barChartWidth}px"

Set your barChart with on bean side by calculating barcount*barwidth+66 for example; Use 10 for barwidth. Multiply with chartItemCount and add 66 or something for bar label width.

public int getBarChartWidth() {
        return chartItemCount * 10 + 66;
    }

Good Luck!

Upvotes: 1

Related Questions