apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/area/chart/AreaChartApp.java

Print this page




  38 import javafx.collections.ObservableList;
  39 import javafx.scene.Parent;
  40 import javafx.scene.Scene;
  41 import javafx.scene.chart.AreaChart;
  42 import javafx.scene.chart.NumberAxis;
  43 import javafx.stage.Stage;
  44 
  45 
  46 /**
  47  * A chart that fills in the area between a line of data points and the axes.
  48  * Good for comparing accumulated totals over time.
  49  *
  50  * @sampleName Area Chart
  51  * @preview preview.png
  52  * @see javafx.scene.chart.AreaChart
  53  * @see javafx.scene.chart.NumberAxis
  54  * @related /Charts/Line/Line Chart
  55  * @related /Charts/Scatter/Scatter Chart
  56  * @docUrl http://docs.oracle.com/javafx/2/charts/jfxpub-charts.htm Using JavaFX Charts Tutorial
  57  * @playground chart.data
  58  * 
  59  * @playground - (name="xAxis")
  60  * @playground xAxis.autoRanging
  61  * @playground xAxis.forceZeroInRange
  62  * @playground xAxis.lowerBound (min=-10, max=10, step=1)
  63  * @playground xAxis.upperBound (min=-10, max=10, step=1)
  64  * @playground xAxis.tickUnit (max=10, step=0.5)
  65  * @playground xAxis.minorTickCount (max=16)
  66  * @playground xAxis.minorTickLength (max=15)
  67  * @playground xAxis.minorTickVisible
  68  * 
  69  * @playground xAxis.animated
  70  * @playground xAxis.label
  71  * @playground xAxis.side
  72  * @playground xAxis.tickLabelFill
  73  * @playground xAxis.tickLabelGap
  74  * @playground xAxis.tickLabelRotation (min=-180,max=180,step=1)
  75  * @playground xAxis.tickLabelsVisible
  76  * @playground xAxis.tickLength
  77  * @playground xAxis.tickMarkVisible
  78  * 
  79  * @playground - (name="yAxis")
  80  * @playground yAxis.autoRanging
  81  * @playground yAxis.forceZeroInRange
  82  * @playground yAxis.lowerBound (min=-10, max=10, step=1)
  83  * @playground yAxis.upperBound (min=-10, max=10, step=1)
  84  * @playground yAxis.tickUnit (max=10, step=1)
  85  * @playground yAxis.minorTickCount (max=16)
  86  * @playground yAxis.minorTickLength (max=15)
  87  * @playground yAxis.minorTickVisible
  88  * 
  89  * @playground yAxis.animated
  90  * @playground yAxis.label
  91  * @playground yAxis.side
  92  * @playground yAxis.tickLabelFill
  93  * @playground yAxis.tickLabelGap
  94  * @playground yAxis.tickLabelRotation (min=-180,max=180)
  95  * @playground yAxis.tickLabelsVisible
  96  * @playground yAxis.tickLength
  97  * @playground yAxis.tickMarkVisible
  98  * 
  99  * @playground - (name="chart")
 100  * @playground chart.horizontalGridLinesVisible
 101  * @playground chart.horizontalZeroLineVisible
 102  * @playground chart.verticalGridLinesVisible
 103  * @playground chart.verticalZeroLineVisible
 104  * 
 105  * @playground chart.animated
 106  * @playground chart.legendSide
 107  * @playground chart.legendVisible
 108  * @playground chart.title
 109  * @playground chart.titleSide
 110  * @embedded 
 111  */
 112 public class AreaChartApp extends Application {
 113 
 114     private AreaChart chart;
 115     private NumberAxis xAxis;
 116     private NumberAxis yAxis;
 117 
 118     public Parent createContent() {
 119         xAxis = new NumberAxis();
 120         xAxis.setLabel("X Values");
 121         yAxis = new NumberAxis();
 122         yAxis.setLabel("Y Values");
 123         ObservableList<AreaChart.Series> areaChartData = FXCollections.observableArrayList(
 124                 new AreaChart.Series("Series 1",FXCollections.observableArrayList(




  38 import javafx.collections.ObservableList;
  39 import javafx.scene.Parent;
  40 import javafx.scene.Scene;
  41 import javafx.scene.chart.AreaChart;
  42 import javafx.scene.chart.NumberAxis;
  43 import javafx.stage.Stage;
  44 
  45 
  46 /**
  47  * A chart that fills in the area between a line of data points and the axes.
  48  * Good for comparing accumulated totals over time.
  49  *
  50  * @sampleName Area Chart
  51  * @preview preview.png
  52  * @see javafx.scene.chart.AreaChart
  53  * @see javafx.scene.chart.NumberAxis
  54  * @related /Charts/Line/Line Chart
  55  * @related /Charts/Scatter/Scatter Chart
  56  * @docUrl http://docs.oracle.com/javafx/2/charts/jfxpub-charts.htm Using JavaFX Charts Tutorial
  57  * @playground chart.data

  58  * @playground - (name="xAxis")
  59  * @playground xAxis.autoRanging
  60  * @playground xAxis.forceZeroInRange
  61  * @playground xAxis.lowerBound (min=-10, max=10, step=1)
  62  * @playground xAxis.upperBound (min=-10, max=10, step=1)
  63  * @playground xAxis.tickUnit (max=10, step=0.5)
  64  * @playground xAxis.minorTickCount (max=16)
  65  * @playground xAxis.minorTickLength (max=15)
  66  * @playground xAxis.minorTickVisible

  67  * @playground xAxis.animated
  68  * @playground xAxis.label
  69  * @playground xAxis.side
  70  * @playground xAxis.tickLabelFill
  71  * @playground xAxis.tickLabelGap
  72  * @playground xAxis.tickLabelRotation (min=-180,max=180,step=1)
  73  * @playground xAxis.tickLabelsVisible
  74  * @playground xAxis.tickLength
  75  * @playground xAxis.tickMarkVisible

  76  * @playground - (name="yAxis")
  77  * @playground yAxis.autoRanging
  78  * @playground yAxis.forceZeroInRange
  79  * @playground yAxis.lowerBound (min=-10, max=10, step=1)
  80  * @playground yAxis.upperBound (min=-10, max=10, step=1)
  81  * @playground yAxis.tickUnit (max=10, step=1)
  82  * @playground yAxis.minorTickCount (max=16)
  83  * @playground yAxis.minorTickLength (max=15)
  84  * @playground yAxis.minorTickVisible

  85  * @playground yAxis.animated
  86  * @playground yAxis.label
  87  * @playground yAxis.side
  88  * @playground yAxis.tickLabelFill
  89  * @playground yAxis.tickLabelGap
  90  * @playground yAxis.tickLabelRotation (min=-180,max=180)
  91  * @playground yAxis.tickLabelsVisible
  92  * @playground yAxis.tickLength
  93  * @playground yAxis.tickMarkVisible

  94  * @playground - (name="chart")
  95  * @playground chart.horizontalGridLinesVisible
  96  * @playground chart.horizontalZeroLineVisible
  97  * @playground chart.verticalGridLinesVisible
  98  * @playground chart.verticalZeroLineVisible

  99  * @playground chart.animated
 100  * @playground chart.legendSide
 101  * @playground chart.legendVisible
 102  * @playground chart.title
 103  * @playground chart.titleSide
 104  * @embedded 
 105  */
 106 public class AreaChartApp extends Application {
 107 
 108     private AreaChart chart;
 109     private NumberAxis xAxis;
 110     private NumberAxis yAxis;
 111 
 112     public Parent createContent() {
 113         xAxis = new NumberAxis();
 114         xAxis.setLabel("X Values");
 115         yAxis = new NumberAxis();
 116         yAxis.setLabel("Y Values");
 117         ObservableList<AreaChart.Series> areaChartData = FXCollections.observableArrayList(
 118                 new AreaChart.Series("Series 1",FXCollections.observableArrayList(