apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/scatter/chart/ScatterChartApp.java

Print this page




  40 import javafx.scene.Scene;
  41 import javafx.scene.chart.ScatterChart;
  42 import javafx.scene.chart.XYChart;
  43 import javafx.scene.chart.NumberAxis;
  44 import javafx.stage.Stage;
  45 
  46 
  47 /**
  48  * A chart that displays plotted symbols for a series of data points. Useful
  49  * for viewing the distribution of data to see if there is any pattern,
  50  * indicating a correlation.
  51  *
  52  * @sampleName Scatter Chart
  53  * @preview preview.png 
  54  * @see javafx.scene.chart.ScatterChart
  55  * @see javafx.scene.chart.NumberAxis
  56  * @related /Charts/Line/Line Chart
  57  * @related /Charts/Area/Area Chart
  58  * @docUrl http://docs.oracle.com/javafx/2/charts/jfxpub-charts.htm Using JavaFX Charts Tutorial
  59  * @playground chart.data
  60  * 
  61  * @playground - (name="xAxis")
  62  * @playground xAxis.autoRanging
  63  * @playground xAxis.forceZeroInRange
  64  * @playground xAxis.lowerBound (min=-10, max=10, step=0.25)
  65  * @playground xAxis.upperBound (max=20, step=0.25)
  66  * @playground xAxis.tickUnit (max=10, step=0.25)
  67  * @playground xAxis.minorTickCount (max=16)
  68  * @playground xAxis.minorTickLength (max=15)
  69  * @playground xAxis.minorTickVisible
  70  * 
  71  * @playground xAxis.animated
  72  * @playground xAxis.label
  73  * @playground xAxis.side
  74  * @playground xAxis.tickLabelFill
  75  * @playground xAxis.tickLabelGap
  76  * @playground xAxis.tickLabelRotation (min=-180,max=180,step=1)
  77  * @playground xAxis.tickLabelsVisible
  78  * @playground xAxis.tickLength
  79  * @playground xAxis.tickMarkVisible
  80  * 
  81  * @playground - (name="yAxis")
  82  * @playground yAxis.autoRanging
  83  * @playground yAxis.forceZeroInRange
  84  * @playground yAxis.lowerBound (min=-5,max=5,step=0.25)
  85  * @playground yAxis.upperBound (max=10,step=0.25)
  86  * @playground yAxis.tickUnit (max=10,step=0.25)
  87  * @playground yAxis.minorTickCount (max=16)
  88  * @playground yAxis.minorTickLength (max=15)
  89  * @playground yAxis.minorTickVisible
  90  * 
  91  * @playground yAxis.animated
  92  * @playground yAxis.label
  93  * @playground yAxis.side
  94  * @playground yAxis.tickLabelFill
  95  * @playground yAxis.tickLabelGap
  96  * @playground yAxis.tickLabelRotation (min=-180,max=180,step=1)
  97  * @playground yAxis.tickLabelsVisible
  98  * @playground yAxis.tickLength
  99  * @playground yAxis.tickMarkVisible
 100  * 
 101  * @playground - (name="chart")
 102  * @playground chart.horizontalGridLinesVisible
 103  * @playground chart.horizontalZeroLineVisible
 104  * @playground chart.verticalGridLinesVisible
 105  * @playground chart.verticalZeroLineVisible
 106  * 
 107  * @playground chart.animated
 108  * @playground chart.legendSide
 109  * @playground chart.legendVisible
 110  * @playground chart.title
 111  * @playground chart.titleSide
 112  * @embedded
 113  */
 114 public class ScatterChartApp extends Application {
 115     
 116     private ScatterChart chart;
 117     private NumberAxis xAxis;
 118     private NumberAxis yAxis;
 119 
 120     public Parent createContent() {
 121         xAxis = new NumberAxis("X-Axis", 0d, 8.0d, 1.0d);
 122         yAxis = new NumberAxis("Y-Axis", 0.0d, 5.0d, 1.0d);
 123         ObservableList<XYChart.Series> data = FXCollections.observableArrayList(
 124             new ScatterChart.Series("Series 1", FXCollections.<ScatterChart.Data>observableArrayList(
 125                 new XYChart.Data(0.2, 3.5),
 126                 new XYChart.Data(0.7, 4.6),




  40 import javafx.scene.Scene;
  41 import javafx.scene.chart.ScatterChart;
  42 import javafx.scene.chart.XYChart;
  43 import javafx.scene.chart.NumberAxis;
  44 import javafx.stage.Stage;
  45 
  46 
  47 /**
  48  * A chart that displays plotted symbols for a series of data points. Useful
  49  * for viewing the distribution of data to see if there is any pattern,
  50  * indicating a correlation.
  51  *
  52  * @sampleName Scatter Chart
  53  * @preview preview.png 
  54  * @see javafx.scene.chart.ScatterChart
  55  * @see javafx.scene.chart.NumberAxis
  56  * @related /Charts/Line/Line Chart
  57  * @related /Charts/Area/Area Chart
  58  * @docUrl http://docs.oracle.com/javafx/2/charts/jfxpub-charts.htm Using JavaFX Charts Tutorial
  59  * @playground chart.data

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

  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  * @playground - (name="yAxis")
  79  * @playground yAxis.autoRanging
  80  * @playground yAxis.forceZeroInRange
  81  * @playground yAxis.lowerBound (min=-5,max=5,step=0.25)
  82  * @playground yAxis.upperBound (max=10,step=0.25)
  83  * @playground yAxis.tickUnit (max=10,step=0.25)
  84  * @playground yAxis.minorTickCount (max=16)
  85  * @playground yAxis.minorTickLength (max=15)
  86  * @playground yAxis.minorTickVisible

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

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

 101  * @playground chart.animated
 102  * @playground chart.legendSide
 103  * @playground chart.legendVisible
 104  * @playground chart.title
 105  * @playground chart.titleSide
 106  * @embedded
 107  */
 108 public class ScatterChartApp extends Application {
 109     
 110     private ScatterChart chart;
 111     private NumberAxis xAxis;
 112     private NumberAxis yAxis;
 113 
 114     public Parent createContent() {
 115         xAxis = new NumberAxis("X-Axis", 0d, 8.0d, 1.0d);
 116         yAxis = new NumberAxis("Y-Axis", 0.0d, 5.0d, 1.0d);
 117         ObservableList<XYChart.Series> data = FXCollections.observableArrayList(
 118             new ScatterChart.Series("Series 1", FXCollections.<ScatterChart.Data>observableArrayList(
 119                 new XYChart.Data(0.2, 3.5),
 120                 new XYChart.Data(0.7, 4.6),