Java Code Examples for javafx.scene.chart.NumberAxis#setForceZeroInRange()

The following examples show how to use javafx.scene.chart.NumberAxis#setForceZeroInRange() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AdvScatterLiveChartSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
protected ScatterChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setForceZeroInRange(false);
    final NumberAxis yAxis = new NumberAxis(-100,100,10);
    final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
    // setup chart
    sc.setId("liveScatterChart");
    sc.setTitle("Animated Sine Wave ScatterChart");
    xAxis.setLabel("X Axis");
    xAxis.setAnimated(false);
    yAxis.setLabel("Y Axis");
    yAxis.setAutoRanging(false);
    // add starting data
    series = new ScatterChart.Series<Number,Number>();
    series.setName("Sine Wave");
    series.getData().add(new ScatterChart.Data<Number, Number>(5d, 5d));
    sc.getData().add(series);
    return sc;
}
 
Example 2
Source File: AdvScatterLiveChartSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
protected ScatterChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setForceZeroInRange(false);
    final NumberAxis yAxis = new NumberAxis(-100,100,10);
    final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
    // setup chart
    sc.setId("liveScatterChart");
    sc.setTitle("Animated Sine Wave ScatterChart");
    xAxis.setLabel("X Axis");
    xAxis.setAnimated(false);
    yAxis.setLabel("Y Axis");
    yAxis.setAutoRanging(false);
    // add starting data
    series = new ScatterChart.Series<Number,Number>();
    series.setName("Sine Wave");
    series.getData().add(new ScatterChart.Data<Number, Number>(5d, 5d));
    sc.getData().add(series);
    return sc;
}
 
Example 3
Source File: ChartAdvancedScatterLive.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected ScatterChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setForceZeroInRange(false);
    final NumberAxis yAxis = new NumberAxis(-100,100,10);
    final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
    // setup chart
    sc.setId("liveScatterChart");
    sc.setTitle("Animated Sine Wave ScatterChart");
    xAxis.setLabel("X Axis");
    xAxis.setAnimated(false);
    yAxis.setLabel("Y Axis");
    yAxis.setAutoRanging(false);
    // add starting data
    series = new ScatterChart.Series<Number,Number>();
    series.setName("Sine Wave");
    series.getData().add(new ScatterChart.Data<Number, Number>(5d, 5d));
    sc.getData().add(series);
    return sc;
}
 
Example 4
Source File: NumberAxisBuilder.java    From constellation with Apache License 2.0 5 votes vote down vote up
@Override
public Axis<Number> build() {
    final NumberAxis axis = new NumberAxis();
    axis.setAutoRanging(true);
    axis.setForceZeroInRange(false);
    return axis;
}
 
Example 5
Source File: ChartUtil.java    From DevToolBox with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static XYChart.Series getSeries(LineChart chart, Double dt, String name) {
    NumberAxis na = (NumberAxis) chart.getYAxis();
    na.setAutoRanging(true);
    na.setForceZeroInRange(false);
    XYChart.Series s = new XYChart.Series();
    s.setName(name);
    return s;
}
 
Example 6
Source File: AdvancedStockLineChartSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
protected LineChart<Number, Number> createChart() {
    xAxis = new NumberAxis(0,24,3);
    final NumberAxis yAxis = new NumberAxis(0,100,10);
    final LineChart<Number,Number> lc = new LineChart<Number,Number>(xAxis,yAxis);
    // setup chart
    lc.setId("lineStockDemo");
    lc.setCreateSymbols(false);
    lc.setAnimated(false);
    lc.setLegendVisible(false);
    lc.setTitle("ACME Company Stock");
    xAxis.setLabel("Time");
    xAxis.setForceZeroInRange(false);
    yAxis.setLabel("Share Price");
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,"$",null));
    // add starting data
    hourDataSeries = new XYChart.Series<Number,Number>();
    hourDataSeries.setName("Hourly Data");
    minuteDataSeries = new XYChart.Series<Number,Number>();
    minuteDataSeries.setName("Minute Data");
    // create some starting data
    hourDataSeries.getData().add(new XYChart.Data<Number,Number>(timeInHours,prevY));
    minuteDataSeries.getData().add(new XYChart.Data<Number,Number>(timeInHours,prevY));
    for (double m=0; m<(60); m++) {
        nextTime();
        plotTime();
    }
    lc.getData().add(minuteDataSeries);
    lc.getData().add(hourDataSeries);
    return lc;
}
 
Example 7
Source File: AdvancedStockLineChartSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
protected LineChart<Number, Number> createChart() {
    xAxis = new NumberAxis(0,24,3);
    final NumberAxis yAxis = new NumberAxis(0,100,10);
    final LineChart<Number,Number> lc = new LineChart<Number,Number>(xAxis,yAxis);
    // setup chart
    lc.setId("lineStockDemo");
    lc.setCreateSymbols(false);
    lc.setAnimated(false);
    lc.setLegendVisible(false);
    lc.setTitle("ACME Company Stock");
    xAxis.setLabel("Time");
    xAxis.setForceZeroInRange(false);
    yAxis.setLabel("Share Price");
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,"$",null));
    // add starting data
    hourDataSeries = new XYChart.Series<Number,Number>();
    hourDataSeries.setName("Hourly Data");
    minuteDataSeries = new XYChart.Series<Number,Number>();
    minuteDataSeries.setName("Minute Data");
    // create some starting data
    hourDataSeries.getData().add(new XYChart.Data<Number,Number>(timeInHours,prevY));
    minuteDataSeries.getData().add(new XYChart.Data<Number,Number>(timeInHours,prevY));
    for (double m=0; m<(60); m++) {
        nextTime();
        plotTime();
    }
    lc.getData().add(minuteDataSeries);
    lc.getData().add(hourDataSeries);
    return lc;
}
 
Example 8
Source File: ChartAdvancedStockLine.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected LineChart<Number, Number> createChart() {
    xAxis = new NumberAxis(0,24,3);
    final NumberAxis yAxis = new NumberAxis(0,100,10);
    final LineChart<Number,Number> lc = new LineChart<Number,Number>(xAxis,yAxis);
    // setup chart
    lc.setId("lineStockDemo");
    lc.setCreateSymbols(false);
    lc.setAnimated(false);
    lc.setLegendVisible(false);
    lc.setTitle("ACME Company Stock");
    xAxis.setLabel("Time");
    xAxis.setForceZeroInRange(false);
    yAxis.setLabel("Share Price");
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,"$",null));
    // add starting data
    hourDataSeries = new XYChart.Series<Number,Number>();
    hourDataSeries.setName("Hourly Data");
    minuteDataSeries = new XYChart.Series<Number,Number>();
    minuteDataSeries.setName("Minute Data");
    // create some starting data
    hourDataSeries.getData().add(new XYChart.Data<Number,Number>(timeInHours,prevY));
    minuteDataSeries.getData().add(new XYChart.Data<Number,Number>(timeInHours,prevY));
    for (double m=0; m<(60); m++) {
        nextTime();
        plotTime();
    }
    lc.getData().add(minuteDataSeries);
    lc.getData().add(hourDataSeries);
    return lc;
}
 
Example 9
Source File: BreakingNewsDemoView.java    From htm.java-examples with GNU Affero General Public License v3.0 5 votes vote down vote up
public LineChart<String, Number> createChart(LabelledRadiusPane pane) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    
    chart = new LineChart<>(xAxis, yAxis);
    chart.setTitle("Tweet Trend Analysis");
    chart.setCreateSymbols(false);
    chart.setLegendVisible(false);

    xAxis.setLabel("Time of Tweet");
    yAxis.setUpperBound(1.0);
    yAxis.setLowerBound(0.0);
    yAxis.setLabel("Anomaly\n  Score");
    yAxis.setForceZeroInRange(true);
    
    series = new XYChart.Series<>();
    series.setName("Tweet Data");
    chart.getData().add(series);
    chartSeriesProperty.set(series);
    
    Node line = series.getNode().lookup(".chart-series-line");
    line.setStyle("-fx-stroke: rgb(20, 164, 220)");
    
    chart.setPrefWidth(1200);
    chart.setPrefHeight(275);
    chart.setLayoutY(pane.labelHeightProperty().get() + 10);
    
    return chart;
}
 
Example 10
Source File: VisualizerPresenter.java    From HdrHistogramVisualizer with Apache License 2.0 5 votes vote down vote up
void initializeIntervalChartAxes() {
    final NumberAxis xAxis = (NumberAxis) intervalChart.getXAxis();
    xAxis.setForceZeroInRange(false);

    // Bind X Tick label formatter to choice-box
    intervalXTickLabel.getItems().addAll(IntervalTickFormatter.values());
    intervalXTickLabel.getSelectionModel().select(0);
    ObjectBinding<StringConverter<Number>> intervalXLabelConverter = Bindings.createObjectBinding(
            () -> intervalXTickLabel.getSelectionModel().getSelectedItem().getConverter(),
            intervalXTickLabel.getSelectionModel().selectedItemProperty()
    );
    xAxis.tickLabelFormatterProperty().bind(intervalXLabelConverter);

}
 
Example 11
Source File: SupplyView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void configureYAxis(NumberAxis axis) {
    configureAxis(axis);

    axis.setForceZeroInRange(true);
    axis.setTickLabelGap(5);
    axis.setSide(Side.RIGHT);
}
 
Example 12
Source File: SupplyView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void configureAxis(NumberAxis axis) {
    axis.setForceZeroInRange(false);
    axis.setAutoRanging(true);
    axis.setTickMarkVisible(false);
    axis.setMinorTickVisible(false);
    axis.setTickLabelGap(6);
}
 
Example 13
Source File: OfferBookChartView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void createChart() {
    xAxis = new NumberAxis();
    xAxis.setForceZeroInRange(false);
    xAxis.setAutoRanging(false);
    xAxis.setTickLabelGap(6);
    xAxis.setTickMarkVisible(false);
    xAxis.setMinorTickVisible(false);

    NumberAxis yAxis = new NumberAxis();
    yAxis.setForceZeroInRange(false);
    yAxis.setSide(Side.RIGHT);
    yAxis.setAutoRanging(true);
    yAxis.setTickMarkVisible(false);
    yAxis.setMinorTickVisible(false);
    yAxis.setTickLabelGap(5);
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis, "", " " + Res.getBaseCurrencyCode()));

    seriesBuy = new XYChart.Series<>();
    seriesSell = new XYChart.Series<>();

    areaChart = new AreaChart<>(xAxis, yAxis);
    areaChart.setLegendVisible(false);
    areaChart.setAnimated(false);
    areaChart.setId("charts");
    areaChart.setMinHeight(270);
    areaChart.setPrefHeight(270);
    areaChart.setCreateSymbols(true);
    areaChart.setPadding(new Insets(0, 10, 0, 10));
    areaChart.getData().addAll(List.of(seriesBuy, seriesSell));

    chartPane = new AnchorPane();
    chartPane.getStyleClass().add("chart-pane");

    AnchorPane.setTopAnchor(areaChart, 15d);
    AnchorPane.setBottomAnchor(areaChart, 10d);
    AnchorPane.setLeftAnchor(areaChart, 10d);
    AnchorPane.setRightAnchor(areaChart, 0d);

    chartPane.getChildren().add(areaChart);
}
 
Example 14
Source File: FinanceUI.java    From StockInference-Spark with Apache License 2.0 4 votes vote down vote up
private void init(Stage primaryStage) {
        instance = this;

        xAxis = new NumberAxis();
        xAxis.setForceZeroInRange(false);
        xAxis.setAutoRanging(true);
        xAxis.setLabel("Time");

        xAxis.setTickLabelsVisible(false);
        xAxis.setTickMarkVisible(true);
        xAxis.setMinorTickVisible(false);

        yAxis = new NumberAxis();        
        yAxis.setAutoRanging(false);
        yAxis.setForceZeroInRange(false);
        //yAxis.setLowerBound(210.4);
        //yAxis.setUpperBound(212);
        
        yAxis.setLabel("Stock Price ($)");

        //-- Chart
        final LineChart<Number, Number> sc = new LineChart<Number, Number>(xAxis, yAxis) {
            // Override to remove symbols on each data point
            @Override
            protected void dataItemAdded(Series<Number, Number> series, int itemIndex, Data<Number, Number> item) {

            }
        };
        sc.setCursor(Cursor.CROSSHAIR);
        sc.setAnimated(false);
        sc.setId("stockChart");
//        sc.setTitle("Stock Price");


        //-- Chart Series
        stockPriceSeries = new XYChart.Series<Number, Number>();
        stockPriceSeries.setName("Last Close");

        emaPriceSeries = new XYChart.Series<Number, Number>();
        emaPriceSeries.setName("Med Avg");

        predictionSeries = new XYChart.Series<Number, Number>();
        predictionSeries.setName("Predicted Med Avg.");


        sc.getData().addAll(stockPriceSeries, emaPriceSeries, predictionSeries);
        sc.getStylesheets().add("style.css");
        sc.applyCss();

        primaryStage.setScene(new Scene(sc));
    }
 
Example 15
Source File: FinanceUI.java    From StockPrediction with Apache License 2.0 4 votes vote down vote up
private void init(Stage primaryStage) {
        instance = this;

        xAxis = new NumberAxis();
        xAxis.setForceZeroInRange(false);
        xAxis.setAutoRanging(true);
        xAxis.setLabel("Time");

        xAxis.setTickLabelsVisible(false);
        xAxis.setTickMarkVisible(true);
        xAxis.setMinorTickVisible(false);

        yAxis = new NumberAxis();        
        yAxis.setAutoRanging(false);
        yAxis.setForceZeroInRange(false);
        //yAxis.setLowerBound(210.4);
        //yAxis.setUpperBound(212);
        
        yAxis.setLabel("Stock Price ($)");

        //-- Chart
        final LineChart<Number, Number> sc = new LineChart<Number, Number>(xAxis, yAxis) {
            // Override to remove symbols on each data point
            @Override
            protected void dataItemAdded(Series<Number, Number> series, int itemIndex, Data<Number, Number> item) {

            }
        };
        sc.setCursor(Cursor.CROSSHAIR);
        sc.setAnimated(false);
        sc.setId("stockChart");
//        sc.setTitle("Stock Price");


        //-- Chart Series
        stockPriceSeries = new XYChart.Series<Number, Number>();
        stockPriceSeries.setName("Last Close");

        emaPriceSeries = new XYChart.Series<Number, Number>();
        emaPriceSeries.setName("Med Avg");

        predictionSeries = new XYChart.Series<Number, Number>();
        predictionSeries.setName("Predicted Med Avg.");


        sc.getData().addAll(stockPriceSeries, emaPriceSeries, predictionSeries);
        sc.getStylesheets().add("style.css");
        sc.applyCss();

        primaryStage.setScene(new Scene(sc));
    }