Labels for data points in chart

Is there a way to show the same info you see in the X-trace for all points of a chart? Basically have a label at each point?

1 Like

I doubt this is going to work quite the way you want, but try this code as a starting point (in the configureChart function):

	from org.jfree.chart.labels import StandardXYItemLabelGenerator
	
	chart.getPlot().getRenderer().setItemLabelGenerator(StandardXYItemLabelGenerator())
	chart.getPlot().getRenderer().setBaseItemLabelsVisible(True)

1 Like

Thanks! This will for sure point me in the correct direction.

If I have 4 separate plots on a single chart, how would you apply these labels to every line in the chart? This code only adds the labels to the top line/plot but the other three remain unchanged.

Thanks!

Something like this (untested):

from org.jfree.chart.labels import StandardXYItemLabelGenerator

# handle charts with single or multiple plots
plots = getattr(chart.plot, "subplots", [chart.plot])
for plot in plots:
	plot.renderer.itemLabelGenerator = StandardXYItemLabelGenerator()
	plot.renderer.baseItemLabelsVisible = True
1 Like