Page 1 of 1

Strange quetion

Posted: Tue Dec 01, 2015 3:58 pm
by 15354003
Can i render chart not throw SWT/AWT/Swing widget but directly to image?
I want use RAP ( https://www.eclipse.org/rap/ ) and need ready image only

Re: Strange quetion

Posted: Wed Dec 02, 2015 12:39 pm
by yeray
Hello,

I haven't tried it, but have you tried to export your chart as an image and use it in your RAP application?

Re: Strange quetion

Posted: Thu Dec 03, 2015 2:24 pm
by 15354003
hmmm
example pls
now new TChart(Composite , style)
but I want render chart without parent composite
How to do it?

Re: Strange quetion

Posted: Fri Dec 04, 2015 10:35 am
by yeray
Hello,

I can create a TChart without a parent and export it to an image with TeeChart Java Swing, so I guess you could do a similar thing in your RAP application:

Code: Select all

import java.io.IOException;

import com.steema.teechart.TChart;
import com.steema.teechart.styles.Bar;

public class Test {
	
	public static void main(String args[]) {
		TChart Chart1 = new TChart();
		
		Bar bar1 = new Bar(Chart1.getChart());
		bar1.fillSampleValues();
		
		try {
			Chart1.getExport().getImage().getPNG().save("E://tmp//SwingTest.png");
		} catch (IOException e) {
			e.printStackTrace();
		}		
	}
}
If you still find problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.

Re: Strange quetion

Posted: Mon Dec 07, 2015 4:00 pm
by 15354003
thank you
run to realize

Re: Strange quetion

Posted: Mon Dec 07, 2015 4:17 pm
by 15354003
How set size for export chart?

chart1.setSize(800, 600) is not working;

Re: Strange quetion

Posted: Mon Dec 07, 2015 6:59 pm
by 15354003
close last question

PNGFormat png = chart1.getExport().getImage().getPNG();
png.setWidth(parentTab.getSize().x - 10);
png.setHeight(parentTab.getSize().y - 100);