Reputation: 6783
I'm creating a XYStepChart using JFreeChart and my dataset is as sent to me as (TimeStamp, X1, X2). I'm required to plot X1 for a given timestamp, however I would want to use the value of X2 as the label for the given point.
Can someone please guide me in achieving this? I tried the following:
XYItemLabelGenerator itemLabelGenerator = new StandardXYItemLabelGenerator();
plot.getRenderer().setBaseItemLabelGenerator(itemLabelGenerator);
plot.getRenderer().setSeriesItemLabelsVisible(0, true);
But this just shows the value of X1 as labels. Any suggestions?
Upvotes: 1
Views: 3181
Reputation: 205775
For most cases, you can use the ArgumentIndex values recognized by the StandardXYItemLabelGenerator
, as shown here. For finer control, you can override generateLabel()
in a subclass.
Upvotes: 2