Using a stackedXYBarRenderer to convey expected vs actual data

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Post Reply
tobermory
Posts: 8
Joined: Thu Jul 06, 2017 8:11 pm
antibot: No, of course not.

Using a stackedXYBarRenderer to convey expected vs actual data

Post by tobermory » Thu Sep 20, 2018 12:08 am

I have a data set which can be generalized to a number of trials, where each trial has a desired (commanded) and actual outcome, and the desired and actual outcomes are comparable, i.e. one is bigger than the other. Example: do 100 trials of 'throw a ball up to a some height X meters (desired). The value of X can change throughout the trials. For each trial, the ball actually achieves a height of Y meters, where X < Y or X > Y or, rarely, X = Y.

I thought that JFreeChart's StackedXYBarRenderer would be ideal here. Our domain (x axis) is just the trial number. Then, for the range (y axis), say we color the X (the desired outcome) in GREEN and the Y (actual outcome) in RED. Then when Y > X, I get a RED bar on top of (ie above) a GREEN one, and the height of the RED bar is the 'overshoot'. If we 'underthrow' and Y < X, we'd have the opposite color pattern: the GREEN would be stacked above the RED, and the height of the GREEN bar would show the 'undershoot'.

What I want to achieve can't be done with a single dataset and StackedXYBarRenderer. I am wondering if I split the data into TWO series, and used TWO renderers, based on overshoot or undershoot, that the 'combined' plot will give me the effect I want.

I have plotted my data using the ClusteredXYBarRenderer but feel like this 'wastes too many pixels', since your eye has to now compare bar widths in addition to bar heights, and only the heights, or actually the DIFFERENCE in heights, are relevant. Further, there's two 'components' to the x axis: there's the trial separation AND the bar separation within a trial, and these factors clutter the plot (to me at least).

Or perhaps I am going about this all wrong and a completely different renderer is more suitable. If so, please advise.

Cheers

Stu

Post Reply