Staked bar with different colors in each bar

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
wanderson_wbs
Posts: 1
Joined: Tue May 24, 2016 2:36 am
antibot: No, of course not.

Staked bar with different colors in each bar

Post by wanderson_wbs » Tue May 24, 2016 2:57 am

Hi, I need to create a graph using stakedbar, but I need to use different colors in each stackedbar. How to do it?
I want to create bars independent from each other.

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: Staked bar with different colors in each bar

Post by paradoxoff » Tue May 24, 2016 6:07 pm

Subclass the StackedBarRenderer and override getItemPaint(int row, int column), or create your own BarPainter by e. g. extending StandardBarPainter, and use whatever color you like in the paintBar-method.

Locked