jfreechart-swt: Issue with missing tooltips in XYLineChart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
kahlep
Posts: 1
Joined: Fri Aug 04, 2017 9:18 am
antibot: No, of course not.

jfreechart-swt: Issue with missing tooltips in XYLineChart

Post by kahlep » Fri Aug 04, 2017 9:25 am

Hi,
I am using jfreechart-swt with SWT 4.5 and I can't get the tooltips in the chart to work as expected.
This affects both Linux x64 and Windows x64.

What I need is a XYLineChart with two XYSeries. The data changes when the user selects different items from a table. However the tooltip behavior is quite erratically, i.e. sometimes they do not show at all, only on portions of the plot or after reentering the chart with the mouse. I could not really find a regularity yet.

In the SelectionChangedListener of the TableViewer this code is executed:

Code: Select all

XYSeriesCollection dataset = new XYSeriesCollection();
// adding my two XYSeries here...
JfreeChart chart = ChartFactory.createXYLineChart("Graph", "Y-Axis Label", "X-Axis Label", dataset,
				PlotOrientation.VERTICAL, true, true, false);
XYPlot plot = (XYPlot) chart.getPlot();
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
DecimalFormat pctFormat = new DecimalFormat("#%");
rangeAxis.setNumberFormatOverride(pctFormat);
rangeAxis.setRange(0.0, 1.0);
plot.getRenderer().setSeriesPaint(0, Color.BLUE);
if (thisDataSet.hasSecondDataSeries) {
	plot.getRenderer().setSeriesPaint(1, Color.RED);
}
jFreeChartComp.setChart(chart);
chart.fireChartChanged();
Additionally, I tried to add a Resize Listener to the Shell that does chart.fireChartChanged() each time the user changes the window's size. This seems to help a bit but does not solve the issues completely.

Can anyone give me a hint on how to make this work?

Help is much appreciated!

Thanks and best regards,
Philip

Locked