H_Scroll bar to the ChartComposite

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
raghavan_26
Posts: 59
Joined: Fri Oct 13, 2006 11:35 am
Contact:

H_Scroll bar to the ChartComposite

Post by raghavan_26 » Thu Feb 07, 2008 6:49 am

Hi all,

I added SWT.H_Scroll to the chart composite... After adding that X- axis label is not visible..

If i replace SWT.H_Scroll with SWT.NONE while instantiating the Chart Composite, then X_ axis label is visible..

How can I manage both to be visible....

Thanks,
Raghavan

heprom
Posts: 91
Joined: Sat May 27, 2006 4:25 am
Location: Paris

Post by heprom » Sun Feb 10, 2008 8:51 am

Hi Raghavan,

This behaviour is not ideal since to draw the chart the bounds of the composite are used and do not take into account the scroll bar. Thus the bottom part of the chart is masked. I'm considering to switch to a Canvas instead of Composite as suggested by someone on this forum.

in the meantime, there is an easy way around this, embed the chart composite in another composite which will have the H_SCROLL style:

Code: Select all

Composite c = new Composite(shell, SWT.H_SCROLL);
c.setLayout(new FillLayout());
ChartComposite frame = new ChartComposite(c, SWT.NONE, chart, true);
Regards
Henry

Locked