apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/area/stacked/StackedAreaChartApp.java

Print this page




  35 import javafx.application.Application;
  36 import javafx.collections.FXCollections;
  37 import javafx.collections.ObservableList;
  38 import javafx.scene.Parent;
  39 import javafx.scene.Scene;
  40 import javafx.scene.chart.StackedAreaChart;
  41 import javafx.scene.chart.NumberAxis;
  42 import javafx.stage.Stage;
  43 
  44 
  45 /**
  46  * A sample that displays data in a stacked area chart.
  47  *
  48  * @sampleName Stacked Area Chart
  49  * @preview preview.png
  50  * @see javafx.scene.chart.StackedAreaChart
  51  * @see javafx.scene.chart.NumberAxis
  52  * @related /Charts/Area/Area Chart
  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.forceZeroInRange
  59  * @playground xAxis.lowerBound (min=-10, max=10,step=1)
  60  * @playground xAxis.upperBound (min=-10, max=10,step=1)
  61  * @playground xAxis.tickUnit (max=10)
  62  * @playground xAxis.minorTickCount (max=16)
  63  * @playground xAxis.minorTickLength (max=15)
  64  * @playground xAxis.minorTickVisible
  65  * 
  66  * @playground xAxis.animated
  67  * @playground xAxis.label
  68  * @playground xAxis.side
  69  * @playground xAxis.tickLabelFill
  70  * @playground xAxis.tickLabelGap
  71  * @playground xAxis.tickLabelRotation (min=-180,max=180,step=1)
  72  * @playground xAxis.tickLabelsVisible
  73  * @playground xAxis.tickLength
  74  * @playground xAxis.tickMarkVisible
  75  * 
  76  * @playground - (name="yAxis")
  77  * @playground yAxis.autoRanging
  78  * @playground yAxis.forceZeroInRange
  79  * @playground yAxis.lowerBound (min=-10, max=20,step=1)
  80  * @playground yAxis.upperBound (min=-10, max=40,step=1)
  81  * @playground yAxis.tickUnit (max=10)
  82  * @playground yAxis.minorTickCount (max=16)
  83  * @playground yAxis.minorTickLength (max=15)
  84  * @playground yAxis.minorTickVisible
  85  * 
  86  * @playground yAxis.animated
  87  * @playground yAxis.label
  88  * @playground yAxis.side
  89  * @playground yAxis.tickLabelFill
  90  * @playground yAxis.tickLabelGap
  91  * @playground yAxis.tickLabelRotation (min=-180,max=180,step=1)
  92  * @playground yAxis.tickLabelsVisible
  93  * @playground yAxis.tickLength
  94  * @playground yAxis.tickMarkVisible
  95  * 
  96  * @playground - (name="chart")
  97  * @playground chart.horizontalGridLinesVisible
  98  * @playground chart.horizontalZeroLineVisible
  99  * @playground chart.verticalGridLinesVisible
 100  * @playground chart.verticalZeroLineVisible
 101  * 
 102  * @playground chart.animated
 103  * @playground chart.legendSide
 104  * @playground chart.legendVisible
 105  * @playground chart.title
 106  * @playground chart.titleSide
 107  * @highlight
 108  */
 109 public class StackedAreaChartApp extends Application {
 110     
 111     private StackedAreaChart chart;
 112     private NumberAxis xAxis;
 113     private NumberAxis yAxis;
 114 
 115     public Parent createContent() {
 116         xAxis = new NumberAxis("X Values", 1.0d, 9.0d, 2.0d);
 117         yAxis = new NumberAxis("Y Values", 0.0d, 30.0d, 2.0d);
 118                 
 119         ObservableList<StackedAreaChart.Series> areaChartData = FXCollections.observableArrayList(
 120                 new StackedAreaChart.Series("Series 1",FXCollections.observableArrayList(
 121                     new StackedAreaChart.Data(0,4),




  35 import javafx.application.Application;
  36 import javafx.collections.FXCollections;
  37 import javafx.collections.ObservableList;
  38 import javafx.scene.Parent;
  39 import javafx.scene.Scene;
  40 import javafx.scene.chart.StackedAreaChart;
  41 import javafx.scene.chart.NumberAxis;
  42 import javafx.stage.Stage;
  43 
  44 
  45 /**
  46  * A sample that displays data in a stacked area chart.
  47  *
  48  * @sampleName Stacked Area Chart
  49  * @preview preview.png
  50  * @see javafx.scene.chart.StackedAreaChart
  51  * @see javafx.scene.chart.NumberAxis
  52  * @related /Charts/Area/Area Chart
  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.forceZeroInRange
  58  * @playground xAxis.lowerBound (min=-10, max=10,step=1)
  59  * @playground xAxis.upperBound (min=-10, max=10,step=1)
  60  * @playground xAxis.tickUnit (max=10)
  61  * @playground xAxis.minorTickCount (max=16)
  62  * @playground xAxis.minorTickLength (max=15)
  63  * @playground xAxis.minorTickVisible

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

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

  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  * @playground - (name="chart")
  92  * @playground chart.horizontalGridLinesVisible
  93  * @playground chart.horizontalZeroLineVisible
  94  * @playground chart.verticalGridLinesVisible
  95  * @playground chart.verticalZeroLineVisible

  96  * @playground chart.animated
  97  * @playground chart.legendSide
  98  * @playground chart.legendVisible
  99  * @playground chart.title
 100  * @playground chart.titleSide
 101  * @highlight
 102  */
 103 public class StackedAreaChartApp extends Application {
 104     
 105     private StackedAreaChart chart;
 106     private NumberAxis xAxis;
 107     private NumberAxis yAxis;
 108 
 109     public Parent createContent() {
 110         xAxis = new NumberAxis("X Values", 1.0d, 9.0d, 2.0d);
 111         yAxis = new NumberAxis("Y Values", 0.0d, 30.0d, 2.0d);
 112                 
 113         ObservableList<StackedAreaChart.Series> areaChartData = FXCollections.observableArrayList(
 114                 new StackedAreaChart.Series("Series 1",FXCollections.observableArrayList(
 115                     new StackedAreaChart.Data(0,4),