/* * Copyright (c) 2017 by Gerrit Grunwald * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package eu.hansolo.fx.charts; import eu.hansolo.fx.charts.converter.Converter; import eu.hansolo.fx.charts.tools.Helper; import javafx.application.Application; import javafx.geometry.Insets; import javafx.geometry.Orientation; import javafx.scene.layout.AnchorPane; import javafx.stage.Stage; import javafx.scene.Scene; import static eu.hansolo.fx.charts.converter.Converter.Category.*; import static eu.hansolo.fx.charts.converter.Converter.UnitDefinition.*; /** * User: hansolo * Date: 22.07.17 * Time: 14:12 */ public class AxisTest extends Application { private static final double AXIS_WIDTH = 20; private Axis xAxisBottom; private Axis xAxisTop; private Axis yAxisLeft; private Axis yAxisRight; @Override public void init() { xAxisBottom = Helper.createBottomAxis(-20, 20, AXIS_WIDTH); xAxisTop = Helper.createTopAxis(0, 100, AXIS_WIDTH); yAxisLeft = Helper.createLeftAxis(-20, 20, AXIS_WIDTH); Converter tempConverter = new Converter(TEMPERATURE, CELSIUS); // Type Temperature with BaseUnit Celsius double tempFahrenheitMin = tempConverter.convert(-20, FAHRENHEIT); double tempFahrenheitMax = tempConverter.convert(20, FAHRENHEIT); yAxisRight = Helper.createRightAxis(tempFahrenheitMin, tempFahrenheitMax, false, AXIS_WIDTH); } @Override public void start(Stage stage) { AnchorPane pane = new AnchorPane(xAxisBottom, xAxisTop, yAxisLeft, yAxisRight); pane.setPadding(new Insets(10)); pane.setPrefSize(400, 400); Scene scene = new Scene(pane); stage.setTitle("Title"); stage.setScene(scene); stage.show(); } @Override public void stop() { System.exit(0); } public static void main(String[] args) { launch(args); } }