A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
Harry Plotter ;-)
- Posts: 12
- Joined: Thu Aug 04, 2005 2:56 pm
- Location: Oldenburg - Germany
Post
by Harry Plotter ;-) » Thu Sep 08, 2005 10:38 am
I have two Charts and I want to set the Width of one Chart relative to the width of the other chart.
with
I get the needed information, but how do I position the other chart with this information?
I tried
Code: Select all
Rectangle2D area = chartpanel.getScreenDataArea();
chartpanel2.getChartRenderingInfo().setPlotArea(area);
But this does not work.
Any hints?
Thanks for your help
Peter
-
Harry Plotter ;-)
- Posts: 12
- Joined: Thu Aug 04, 2005 2:56 pm
- Location: Oldenburg - Germany
Post
by Harry Plotter ;-) » Thu Sep 08, 2005 12:46 pm
perhaps it gets more clear what I mean with this code-snippet:
Code: Select all
Rectangle2D area = chartpanel.getChartRenderingInfo().getPlotInfo().getDataArea();
Rectangle2D area2 = chartpanel2.getChartRenderingInfo().getPlotInfo().getDataArea();
double xRec = area2.getX();
double yRec= area2.getY();
double wRec = area.getWidth();
double hRec = area.getHeight();
Rectangle2D area3 = new Rectangle2D.Double(xRec,yRec,wRec,hRec);
chartpanel2.getChartRenderingInfo().getPlotInfo().setDataArea(area3);
System.out.println(chartpanel.getChartRenderingInfo().getPlotInfo().getDataArea().getWidth());
System.out.println(chartpanel2.getChartRenderingInfo().getPlotInfo().getDataArea().getWidth());
println call gives back exactly the same width but on the screen the second chart has not changed its position or width.