SWT Gradient

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
MarioMarinato
Posts: 2
Joined: Thu May 03, 2012 4:08 pm
antibot: No, of course not.

SWT Gradient

Post by MarioMarinato » Mon Apr 13, 2015 6:37 pm

Hello.

I'm developing a SWT application here. I started my chart based on the StackedBarChartDemo4, tweaked it a little and tried to use it on an Eclipse RCP application.
But the gradients didn't show up.

After a few hours of countless tries, I discovered it's related to jFreeChart not being able to draw gradients on SWT. I reached this conclusion when I modified the StackedBarChartDemo4 as follows:

Code: Select all

    public StackedBarChartDemo4(final String title) {
        super(title);
        final CategoryDataset dataset = createDataset();
        final JFreeChart chart = createChart(dataset);
        final ChartPanel chartPanel = new ChartPanel(chart);
        chartPanel.setPreferredSize(new java.awt.Dimension(590, 350));
        setContentPane(chartPanel);

        Shell shell = new Shell( Display.getDefault());
        shell.setLayout( new FillLayout() );
        shell.setSize( 590, 350 );
        ChartComposite cmp = new ChartComposite( shell, SWT.None, chart );
        shell.open();
    }
As you can see the same chart is used on a Swing panel and on a SWT Shell. But the gradients don't show up on the SWT chart.

I really don't know what I might be doing wrong here. Can anyone help me, please?

Locked