Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javafx snapshot of defined size

Tags:

javafx

Hello I would like to save my line chart to an image of predefined dimensions (x, y). Is there an easy way to do so? I could not find any suitable Snapshot parameter.

    WritableImage image = lineChart.snapshot(new SnapshotParameters(), null);

Thanx

like image 374
klajmajk Avatar asked Oct 14 '13 20:10

klajmajk


1 Answers

It's a bit late, but you should try with the scale of your line chart like this :

SnapshotParameters sp =  new SnapshotParameters();
sp.setTransform(Transform.scale(5, 5));
WritableImage image = lineChart.snapshot(sp,null);

This set a scale on your linechart of 5. This may improve your image definition too.

like image 129
MaxD Avatar answered Oct 06 '22 00:10

MaxD