35 import javafx.application.Application; 36 import javafx.scene.Parent; 37 import javafx.scene.Scene; 38 import javafx.scene.chart.CategoryAxis; 39 import javafx.scene.chart.LineChart; 40 import javafx.scene.chart.NumberAxis; 41 import javafx.scene.chart.XYChart; 42 import javafx.stage.Stage; 43 44 45 /** 46 * A line chart demonstrating a CategoryAxis implementation. 47 * 48 * @sampleName Category Line Chart 49 * @preview preview.png 50 * @see javafx.scene.chart.CategoryAxis 51 * @see javafx.scene.chart.LineChart 52 * @see javafx.scene.chart.NumberAxis 53 * @docUrl http://docs.oracle.com/javafx/2/charts/jfxpub-charts.htm Using JavaFX Charts Tutorial 54 * @playground chart.data 55 * 56 * @playground - (name="xAxis") 57 * @playground xAxis.autoRanging 58 * @playground xAxis.gapStartAndEnd 59 * @playground xAxis.startMargin 60 * @playground xAxis.endMargin 61 * 62 * @playground xAxis.animated 63 * @playground xAxis.label 64 * @playground xAxis.side 65 * @playground xAxis.tickLabelFill 66 * @playground xAxis.tickLabelGap 67 * @playground xAxis.tickLabelRotation (min=-180,max=180,step=1) 68 * @playground xAxis.tickLabelsVisible 69 * @playground xAxis.tickLength 70 * @playground xAxis.tickMarkVisible 71 * 72 * @playground - (name="yAxis") 73 * @playground yAxis.autoRanging 74 * @playground yAxis.forceZeroInRange 75 * @playground yAxis.lowerBound (min=-100,step=1) 76 * @playground yAxis.upperBound (max=200,step=1) 77 * @playground yAxis.tickUnit (step=1) 78 * @playground yAxis.minorTickCount (max=16) 79 * @playground yAxis.minorTickLength (max=15) 80 * @playground yAxis.minorTickVisible 81 * 82 * @playground yAxis.animated 83 * @playground yAxis.label 84 * @playground yAxis.side 85 * @playground yAxis.tickLabelFill 86 * @playground yAxis.tickLabelGap 87 * @playground yAxis.tickLabelRotation (min=-180,max=180,step=1) 88 * @playground yAxis.tickLabelsVisible 89 * @playground yAxis.tickLength 90 * @playground yAxis.tickMarkVisible 91 * 92 * @playground - (name="chart") 93 * @playground chart.horizontalGridLinesVisible 94 * @playground chart.horizontalZeroLineVisible 95 * @playground chart.verticalGridLinesVisible 96 * @playground chart.verticalZeroLineVisible 97 * 98 * @playground chart.animated 99 * @playground chart.legendSide 100 * @playground chart.legendVisible 101 * @playground chart.title 102 * @playground chart.titleSide 103 */ 104 public class CategoryLineChartApp extends Application { 105 106 private static final String[] CATEGORIES = {"Alpha", "Beta", "RC1", "RC2", "1.0", "1.1"}; 107 private LineChart<String, Number> chart; 108 private CategoryAxis xAxis; 109 private NumberAxis yAxis; 110 111 public Parent createContent() { 112 xAxis = new CategoryAxis(); 113 yAxis = new NumberAxis(); 114 chart = new LineChart<>(xAxis, yAxis); 115 // setup chart 116 chart.setTitle("LineChart with Category Axis"); 117 xAxis.setLabel("X Axis"); | 35 import javafx.application.Application; 36 import javafx.scene.Parent; 37 import javafx.scene.Scene; 38 import javafx.scene.chart.CategoryAxis; 39 import javafx.scene.chart.LineChart; 40 import javafx.scene.chart.NumberAxis; 41 import javafx.scene.chart.XYChart; 42 import javafx.stage.Stage; 43 44 45 /** 46 * A line chart demonstrating a CategoryAxis implementation. 47 * 48 * @sampleName Category Line Chart 49 * @preview preview.png 50 * @see javafx.scene.chart.CategoryAxis 51 * @see javafx.scene.chart.LineChart 52 * @see javafx.scene.chart.NumberAxis 53 * @docUrl http://docs.oracle.com/javafx/2/charts/jfxpub-charts.htm Using JavaFX Charts Tutorial 54 * @playground chart.data 55 * @playground - (name="xAxis") 56 * @playground xAxis.autoRanging 57 * @playground xAxis.gapStartAndEnd 58 * @playground xAxis.startMargin 59 * @playground xAxis.endMargin 60 * @playground xAxis.animated 61 * @playground xAxis.label 62 * @playground xAxis.side 63 * @playground xAxis.tickLabelFill 64 * @playground xAxis.tickLabelGap 65 * @playground xAxis.tickLabelRotation (min=-180,max=180,step=1) 66 * @playground xAxis.tickLabelsVisible 67 * @playground xAxis.tickLength 68 * @playground xAxis.tickMarkVisible 69 * @playground - (name="yAxis") 70 * @playground yAxis.autoRanging 71 * @playground yAxis.forceZeroInRange 72 * @playground yAxis.lowerBound (min=-100,step=1) 73 * @playground yAxis.upperBound (max=200,step=1) 74 * @playground yAxis.tickUnit (step=1) 75 * @playground yAxis.minorTickCount (max=16) 76 * @playground yAxis.minorTickLength (max=15) 77 * @playground yAxis.minorTickVisible 78 * @playground yAxis.animated 79 * @playground yAxis.label 80 * @playground yAxis.side 81 * @playground yAxis.tickLabelFill 82 * @playground yAxis.tickLabelGap 83 * @playground yAxis.tickLabelRotation (min=-180,max=180,step=1) 84 * @playground yAxis.tickLabelsVisible 85 * @playground yAxis.tickLength 86 * @playground yAxis.tickMarkVisible 87 * @playground - (name="chart") 88 * @playground chart.horizontalGridLinesVisible 89 * @playground chart.horizontalZeroLineVisible 90 * @playground chart.verticalGridLinesVisible 91 * @playground chart.verticalZeroLineVisible 92 * @playground chart.animated 93 * @playground chart.legendSide 94 * @playground chart.legendVisible 95 * @playground chart.title 96 * @playground chart.titleSide 97 */ 98 public class CategoryLineChartApp extends Application { 99 100 private static final String[] CATEGORIES = {"Alpha", "Beta", "RC1", "RC2", "1.0", "1.1"}; 101 private LineChart<String, Number> chart; 102 private CategoryAxis xAxis; 103 private NumberAxis yAxis; 104 105 public Parent createContent() { 106 xAxis = new CategoryAxis(); 107 yAxis = new NumberAxis(); 108 chart = new LineChart<>(xAxis, yAxis); 109 // setup chart 110 chart.setTitle("LineChart with Category Axis"); 111 xAxis.setLabel("X Axis"); |