How to make the edges of a graph of type Stacked Bar?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
amusarra
Posts: 2
Joined: Wed Sep 12, 2012 9:26 am
antibot: No, of course not.

How to make the edges of a graph of type Stacked Bar?

Post by amusarra » Wed Sep 12, 2012 9:33 am

Make the edges on the series is simple, but on how to make the graph shown in Figure 2 I did not find any example. The code shown to follow generates the graph shown in Figure 1. I would like to find a way to get the one shown in Figure 2.

Some of you has ever happened to this need? Is there an easy way to get the result?

Figura 1
Image

Figura 2
Image

Thank you very much.

remiohead
Posts: 201
Joined: Fri Oct 02, 2009 3:53 pm
antibot: No, of course not.

Re: How to make the edges of a graph of type Stacked Bar?

Post by remiohead » Wed Sep 12, 2012 5:08 pm

Someone correct me if I'm wrong but I don't think that's possible out of the box.

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: How to make the edges of a graph of type Stacked Bar?

Post by John Matthews » Thu Sep 13, 2012 6:20 pm

Cross-posted here. There's a suggestion to override getItemOutlinePaint() and getItemOutlineStroke(), as suggested in the StackedBarRenderer API, but I haven't tried it.

remiohead
Posts: 201
Joined: Fri Oct 02, 2009 3:53 pm
antibot: No, of course not.

Re: How to make the edges of a graph of type Stacked Bar?

Post by remiohead » Thu Sep 13, 2012 7:24 pm

That draws the outline around the entire item.

Easiest way to get what you want is to extend StandardBarPainter and override paintBar(). Where it does the outline stuff in the original you just need to draw the left and right border for all items, and for the first row you also draw the bottom border and for the last row you also draw the top border.

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: How to make the edges of a graph of type Stacked Bar?

Post by John Matthews » Fri Sep 14, 2012 9:42 pm

Given a suggestion to override getItemOutlinePaint() and getItemOutlineStroke()
That draws the outline around the entire item.
D'oh! Thanks for clarifying, remiohead, and for pointing to the BarPainter.

amusarra
Posts: 2
Joined: Wed Sep 12, 2012 9:26 am
antibot: No, of course not.

Re: How to make the edges of a graph of type Stacked Bar?

Post by amusarra » Mon Sep 17, 2012 10:16 pm

Thank you all for your suggestions, I will try to do a short test. I will keep you informed.

Bye,
Antonio.

Locked