simgineer
simgineer

Reputation: 1876

Bar Graph in jFreeChart w bars all start from a specific range

Is it possible to generate a bar graph in jFreeChart where bars all start around a particular value instead of the zero axis? Our team has interest in this view.

Here is an example where the default behavior has the bars all between the value and the origin. We want the bars to be between the value and the mean (average).

enter image description here

I suppose a workaround is we calculate the offset from the mean and plot them in respect to the origin and then hide the axis but then we are not able to show the axis to our users.

Upvotes: 1

Views: 115

Answers (1)

simgineer
simgineer

Reputation: 1876

Instead of having bar graphs stop at another value besides the origin we are just redefining the graph axis origin to be at the mean and offsetting everything. So instead of something like exposure level we now call the value axis distance from aggregate mean. Not exactly what I was originally looking in the OP but a cleaner solution overall. We'll let the user toggle between the two modes.

enter image description here

Upvotes: 1

Related Questions