I am currently working on a step line chart with a zoom and panning functionality. Since the amount of data I need to process is pretty large, i can not afford to recreate the whole path of the step line, every time layoutPlotChildren() is called. So my idea was to create the path element once and just transform it on zoom an pan events.
So far everything worked out as planned, but i am having a big problem when I'm trying to scale the path. Since the Path class is inherited from Shape, scaling on the Graph not only transforms the coordinates of the path, but also alters its thickness.
I created a minimal working example to present the problem:
public class Sandbox extends Application
{
@Override public void start(Stage primaryStage)
{
Path path = new Path();
path.getElements().add(new MoveTo(0, 0));
path.getElements().add(new LineTo(100, 0));
path.getElements().add(new LineTo(100, 100));
path.getElements().add(new LineTo(200, 100));
path.setScaleY(3);
Pane pane = new StackPane(path);
Scene scene = new Scene(pane, 800, 600);
primaryStage.setScene(scene);
primaryStage.show();
}
}
As you can see, the coordinates are scaled as intended, but all horizontal lines are three times as thick as before. I completely understand, why this is happening, but I can't think of any possibilities to prevent the thickening of the lines. Do you have any suggestions on how I could solve this problem while still assuring acceptable performance?