ChartViewer layout management

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
dbritton
Posts: 15
Joined: Fri Jun 06, 2003 12:47 am
Contact:

ChartViewer layout management

Post by dbritton » Fri Mar 06, 2015 7:21 pm

I have a BarChart that is based on the fx control ChartCanvas. I have been supplied a pane
object to put it in. This worked well and I used the following code to "layout" the chart
in the pane:

Code: Select all

canvas.widthProperty().bind(this.widthProperty());
canvas.heightProperty().bind(this.heightProperty());
I'm currently trying to modify the BarChart to use a ChartViewer. All works, but I cannot bind
to the pane. How can I set the layout for the ChartViewer in the pane? The demo example
sets the stage scene to a new scene containing the viewer. This scales as desired.

Thanks in advance,
David

dbritton
Posts: 15
Joined: Fri Jun 06, 2003 12:47 am
Contact:

Re: ChartViewer layout management

Post by dbritton » Fri Mar 06, 2015 7:21 pm

I solved this issue.

The problem is because teh width/heightProperty of the ChartViewer are of type "ReadOnlyDoubleProperty".
In the ChartCanvas, they are of type "DoubleProperty".

the following solves the problem:

Code: Select all

		viewer.prefWidthProperty().bind(this.widthProperty());
		viewer.prefHeightProperty().bind(this.heightProperty());


Locked