All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.gsi.chart.ui.ResizableCanvas Maven / Gradle / Ivy

Go to download

This charting library ${project.artifactId}- is an extension in the spirit of Oracle's XYChart and performance/time-proven JDataViewer charting functionalities. Emphasis was put on plotting performance for both large number of data points and real-time displays, as well as scientific accuracies leading to error bar/surface plots, and other scientific plotting features (parameter measurements, fitting, multiple axes, zoom, ...).

There is a newer version: 11.2.7
Show newest version
package de.gsi.chart.ui;

import javafx.scene.canvas.Canvas;

/**
 * extended default Canvas class to be embeddable and resizable within a
 * StackPane or Region
 *
 * @author rstein
 */
public class ResizableCanvas extends Canvas {
    public ResizableCanvas() {
        super();
    }

    @Override
    public double minHeight(final double width) {
        return 1;
    }

    @Override
    public double maxHeight(final double width) {
        return Double.MAX_VALUE;
    }

    @Override
    public double prefHeight(final double width) {
        return getHeight();
    }

    @Override
    public double minWidth(final double height) {
        return 1;
    }

    @Override
    public double maxWidth(final double height) {
        return Double.MAX_VALUE;
    }

    @Override
    public double prefWidth(final double height) {
        return this.getWidth();
    }

    @Override
    public void resize(final double w, final double h) {
        super.resize(w, h);
        setWidth(w);
        setHeight(h);
        // System.err.println("canvas resize to = " + String.format("%fx%f",
        // getWidth(), getHeight()));
    }

    @Override
    public boolean isResizable() {
        return true;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy