apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/candlestick/CandleStickChartApp.java

Print this page




  36 import javafx.collections.ObservableList;
  37 import javafx.scene.Parent;
  38 import javafx.scene.Scene;
  39 import javafx.scene.chart.NumberAxis;
  40 import javafx.scene.chart.XYChart;
  41 import javafx.stage.Stage;
  42 
  43 /**
  44  * A custom candlestick chart. This sample shows how to extend XYChart base class
  45  * to create your own two axis chart type.
  46  *
  47  * @sampleName Candle Stick Chart
  48  * @preview preview.png
  49  * @see javafx.scene.chart.NumberAxis
  50  * @see javafx.scene.chart.XYChart
  51  * @docUrl http://docs.oracle.com/javafx/2/charts/jfxpub-charts.htm Using JavaFX Charts Tutorial
  52  * @related /Charts/Scatter/Scatter Chart
  53  * @related /Charts/Scatter/Advanced Scatter Chart
  54  * @highlight
  55  * @playground chart.data
  56  * 
  57  * @playground - (name="xAxis")
  58  * @playground xAxis.autoRanging
  59  * @playground xAxis.forceZeroInRange
  60  * @playground xAxis.lowerBound (min=-100,max=100,step=1)
  61  * @playground xAxis.upperBound (step=1)
  62  * @playground xAxis.tickUnit (step=0.5)
  63  * @playground xAxis.minorTickCount (max=16)
  64  * @playground xAxis.minorTickLength (max=15)
  65  * @playground xAxis.minorTickVisible
  66  * 
  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  * 
  77  * @playground - (name="yAxis")
  78  * @playground yAxis.autoRanging
  79  * @playground yAxis.forceZeroInRange
  80  * @playground yAxis.lowerBound (min=-100,max=30,step=1)
  81  * @playground yAxis.upperBound (step=1)
  82  * @playground yAxis.tickUnit (step=0.5)
  83  * @playground yAxis.minorTickCount (max=16)
  84  * @playground yAxis.minorTickLength (max=15)
  85  * @playground yAxis.minorTickVisible
  86  * 
  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  * 
  97  * @playground - (name="chart")
  98  * @playground chart.horizontalGridLinesVisible
  99  * @playground chart.horizontalZeroLineVisible
 100  * @playground chart.verticalGridLinesVisible
 101  * @playground chart.verticalZeroLineVisible
 102  * 
 103  * @playground chart.animated
 104  * @playground chart.legendSide
 105  * @playground chart.legendVisible
 106  * @playground chart.title
 107  * @playground chart.titleSide
 108  */
 109 public class CandleStickChartApp extends Application {
 110     
 111     // DAY, OPEN, CLOSE, HIGH, LOW, AVERAGE
 112     private static double[][] data = new double[][]{
 113             {1,  25, 20, 32, 16, 20},
 114             {2,  26, 30, 33, 22, 25},
 115             {3,  30, 38, 40, 20, 32},
 116             {4,  24, 30, 34, 22, 30},
 117             {5,  26, 36, 40, 24, 32},
 118             {6,  28, 38, 45, 25, 34},
 119             {7,  36, 30, 44, 28, 39},
 120             {8,  30, 18, 36, 16, 31},
 121             {9,  40, 50, 52, 36, 41},
 122             {10, 30, 34, 38, 28, 36},




  36 import javafx.collections.ObservableList;
  37 import javafx.scene.Parent;
  38 import javafx.scene.Scene;
  39 import javafx.scene.chart.NumberAxis;
  40 import javafx.scene.chart.XYChart;
  41 import javafx.stage.Stage;
  42 
  43 /**
  44  * A custom candlestick chart. This sample shows how to extend XYChart base class
  45  * to create your own two axis chart type.
  46  *
  47  * @sampleName Candle Stick Chart
  48  * @preview preview.png
  49  * @see javafx.scene.chart.NumberAxis
  50  * @see javafx.scene.chart.XYChart
  51  * @docUrl http://docs.oracle.com/javafx/2/charts/jfxpub-charts.htm Using JavaFX Charts Tutorial
  52  * @related /Charts/Scatter/Scatter Chart
  53  * @related /Charts/Scatter/Advanced Scatter Chart
  54  * @highlight
  55  * @playground chart.data

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

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

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

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

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

  97  * @playground chart.animated
  98  * @playground chart.legendSide
  99  * @playground chart.legendVisible
 100  * @playground chart.title
 101  * @playground chart.titleSide
 102  */
 103 public class CandleStickChartApp extends Application {
 104     
 105     // DAY, OPEN, CLOSE, HIGH, LOW, AVERAGE
 106     private static double[][] data = new double[][]{
 107             {1,  25, 20, 32, 16, 20},
 108             {2,  26, 30, 33, 22, 25},
 109             {3,  30, 38, 40, 20, 32},
 110             {4,  24, 30, 34, 22, 30},
 111             {5,  26, 36, 40, 24, 32},
 112             {6,  28, 38, 45, 25, 34},
 113             {7,  36, 30, 44, 28, 39},
 114             {8,  30, 18, 36, 16, 31},
 115             {9,  40, 50, 52, 36, 41},
 116             {10, 30, 34, 38, 28, 36},