Search in sources :

Example 11 with NumberAxis

use of javafx.scene.chart.NumberAxis in project jvarkit by lindenb.

the class MapqChartFactory method build.

@Override
public LineChart<Number, Number> build() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setLabel("MAPQ");
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setLabel("Count");
    final XYChart.Series<Number, Number> serie = new XYChart.Series<Number, Number>();
    serie.setName(xAxis.getLabel());
    for (int g = 0; g <= 100; ++g) {
        serie.getData().add(new XYChart.Data<Number, Number>(g, this.mapq2count.count(g)));
    }
    final LineChart<Number, Number> sbc = new LineChart<Number, Number>(xAxis, yAxis);
    sbc.setTitle(this.getName());
    sbc.getData().add(serie);
    sbc.setCreateSymbols(false);
    sbc.setLegendVisible(false);
    return sbc;
}
Also used : NumberAxis(javafx.scene.chart.NumberAxis) XYChart(javafx.scene.chart.XYChart) LineChart(javafx.scene.chart.LineChart)

Example 12 with NumberAxis

use of javafx.scene.chart.NumberAxis in project jvarkit by lindenb.

the class ReadQualityChartFactory method build.

@Override
public LineChart<Number, Number> build() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setLabel("Quality");
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setLabel("Count");
    final XYChart.Series<Number, Number> serie = new XYChart.Series<Number, Number>();
    serie.setName(xAxis.getLabel());
    for (int g = 0; g <= 100; ++g) {
        serie.getData().add(new XYChart.Data<Number, Number>(g, this.quality2count.count(g)));
    }
    final LineChart<Number, Number> sbc = new LineChart<Number, Number>(xAxis, yAxis);
    sbc.setTitle(this.getName());
    sbc.getData().add(serie);
    sbc.setCreateSymbols(false);
    sbc.setLegendVisible(false);
    return sbc;
}
Also used : NumberAxis(javafx.scene.chart.NumberAxis) XYChart(javafx.scene.chart.XYChart) LineChart(javafx.scene.chart.LineChart)

Example 13 with NumberAxis

use of javafx.scene.chart.NumberAxis in project jvarkit by lindenb.

the class TiTvChartFactory method build.

@Override
public Chart build() {
    final CategoryAxis xAxis = new CategoryAxis();
    xAxis.setLabel("Sample");
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setLabel("Count");
    final List<XYChart.Series<String, Number>> type2count = new ArrayList<>(3);
    for (int i = 0; i < 2; ++i) {
        final XYChart.Series<String, Number> serie = new XYChart.Series<String, Number>();
        serie.setName(i == 0 ? "Transition" : "Transversion");
        type2count.add(serie);
        if (this.sample2titv.isEmpty()) {
            serie.getData().add(new XYChart.Data<String, Number>("ALL", (i == 0 ? all.transition : all.transvertion)));
        } else {
            for (final String sampleName : this.sample2titv.keySet()) {
                final TiTv titv = this.sample2titv.get(sampleName);
                serie.getData().add(new XYChart.Data<String, Number>(sampleName, (i == 0 ? titv.transition : titv.transvertion)));
            }
        }
    }
    final StackedBarChart<String, Number> sbc = new StackedBarChart<String, Number>(xAxis, yAxis);
    sbc.setTitle(this.getName());
    sbc.getData().addAll(type2count);
    sbc.setCategoryGap(0.2);
    return sbc;
}
Also used : NumberAxis(javafx.scene.chart.NumberAxis) ArrayList(java.util.ArrayList) StackedBarChart(javafx.scene.chart.StackedBarChart) CategoryAxis(javafx.scene.chart.CategoryAxis) XYChart(javafx.scene.chart.XYChart)

Example 14 with NumberAxis

use of javafx.scene.chart.NumberAxis in project Gargoyle by callakrsos.

the class GoogleTrendExam method start.

/* (non-Javadoc)
	 * @see javafx.application.Application#start(javafx.stage.Stage)
	 */
@Override
public void start(Stage primaryStage) throws Exception {
    URL url = new URL(createUrl());
    String jsonString = RequestUtil.requestSSL(url, requestHandler);
    //		String source = ValueUtil.toString(GoogleTrendExam.class.getResourceAsStream("GoogleTrendSample.json"));
    BaseGoogleTrendChart root = new BaseGoogleTrendChart(jsonString, new CategoryAxis(), new NumberAxis(0, 100, 10));
    root.setVerticalGridLinesVisible(false);
    root.addEventFilter(GoogleTrendChartEvent.GOOGLE_CHART_INTERSECT_NODE_CLICK, ev -> {
        System.out.println(ev.getContents());
    });
    root.addEventHandler(GoogleTrendChartEvent.GOOGLE_CHART_INTERSECT_NODE_CLICK, ev -> {
        System.out.println(ev.getContents());
    });
    primaryStage.setScene(new Scene(root));
    primaryStage.show();
}
Also used : NumberAxis(javafx.scene.chart.NumberAxis) CategoryAxis(javafx.scene.chart.CategoryAxis) BaseGoogleTrendChart(com.kyj.fx.voeditor.visual.component.chart.service.BaseGoogleTrendChart) Scene(javafx.scene.Scene) URL(java.net.URL)

Example 15 with NumberAxis

use of javafx.scene.chart.NumberAxis in project bitsquare by bitsquare.

the class TradesChartsView method createCharts.

///////////////////////////////////////////////////////////////////////////////////////////
// Chart
///////////////////////////////////////////////////////////////////////////////////////////
private void createCharts() {
    priceSeries = new XYChart.Series<>();
    priceAxisX = new NumberAxis(0, model.maxTicks + 1, 1);
    priceAxisX.setTickUnit(1);
    priceAxisX.setMinorTickCount(0);
    priceAxisX.setForceZeroInRange(false);
    priceAxisX.setTickLabelFormatter(getTimeAxisStringConverter());
    priceAxisY = new NumberAxis();
    priceAxisY.setForceZeroInRange(false);
    priceAxisY.setAutoRanging(true);
    priceAxisY.setTickLabelFormatter(new StringConverter<Number>() {

        @Override
        public String toString(Number object) {
            if (CurrencyUtil.isCryptoCurrency(model.getCurrencyCode())) {
                final double value = MathUtils.scaleDownByPowerOf10((double) object, 8);
                return formatter.formatRoundedDoubleWithPrecision(value, 8);
            } else
                return formatter.formatPrice(Fiat.valueOf(model.getCurrencyCode(), MathUtils.doubleToLong((double) object)));
        }

        @Override
        public Number fromString(String string) {
            return null;
        }
    });
    priceChart = new CandleStickChart(priceAxisX, priceAxisY, new StringConverter<Number>() {

        @Override
        public String toString(Number object) {
            if (CurrencyUtil.isCryptoCurrency(model.getCurrencyCode())) {
                final double value = MathUtils.scaleDownByPowerOf10((long) object, 8);
                return formatter.formatRoundedDoubleWithPrecision(value, 8);
            } else {
                return formatter.formatPrice(Fiat.valueOf(model.getCurrencyCode(), (long) object));
            }
        }

        @Override
        public Number fromString(String string) {
            return null;
        }
    });
    priceChart.setMinHeight(198);
    priceChart.setPrefHeight(198);
    priceChart.setMaxHeight(300);
    priceChart.setLegendVisible(false);
    priceChart.setData(FXCollections.observableArrayList(priceSeries));
    volumeSeries = new XYChart.Series<>();
    volumeAxisX = new NumberAxis(0, model.maxTicks + 1, 1);
    volumeAxisX.setTickUnit(1);
    volumeAxisX.setMinorTickCount(0);
    volumeAxisX.setForceZeroInRange(false);
    volumeAxisX.setTickLabelFormatter(getTimeAxisStringConverter());
    volumeAxisY = new NumberAxis();
    volumeAxisY.setForceZeroInRange(true);
    volumeAxisY.setAutoRanging(true);
    volumeAxisY.setLabel("Volume in BTC");
    volumeAxisY.setTickLabelFormatter(new StringConverter<Number>() {

        @Override
        public String toString(Number object) {
            return formatter.formatCoin(Coin.valueOf(MathUtils.doubleToLong((double) object)));
        }

        @Override
        public Number fromString(String string) {
            return null;
        }
    });
    volumeChart = new VolumeChart(volumeAxisX, volumeAxisY, new StringConverter<Number>() {

        @Override
        public String toString(Number object) {
            return formatter.formatCoinWithCode(Coin.valueOf((long) object));
        }

        @Override
        public Number fromString(String string) {
            return null;
        }
    });
    volumeChart.setData(FXCollections.observableArrayList(volumeSeries));
    volumeChart.setMinHeight(148);
    volumeChart.setPrefHeight(148);
    volumeChart.setMaxHeight(200);
    volumeChart.setLegendVisible(false);
}
Also used : VolumeChart(io.bitsquare.gui.main.market.trades.charts.volume.VolumeChart) NumberAxis(javafx.scene.chart.NumberAxis) XYChart(javafx.scene.chart.XYChart) StringConverter(javafx.util.StringConverter) CandleStickChart(io.bitsquare.gui.main.market.trades.charts.price.CandleStickChart)

Aggregations

NumberAxis (javafx.scene.chart.NumberAxis)32 XYChart (javafx.scene.chart.XYChart)25 CategoryAxis (javafx.scene.chart.CategoryAxis)15 StackedBarChart (javafx.scene.chart.StackedBarChart)7 BarChart (javafx.scene.chart.BarChart)6 LineChart (javafx.scene.chart.LineChart)6 ArrayList (java.util.ArrayList)5 TreeSet (java.util.TreeSet)4 Node (javafx.scene.Node)4 Path (javafx.scene.shape.Path)3 CandleData (bisq.desktop.main.market.trades.charts.CandleData)2 PedFile (com.github.lindenb.jvarkit.tools.vcfviewgui.PedFile)2 CandleData (io.bitsquare.gui.main.market.trades.charts.CandleData)2 Insets (javafx.geometry.Insets)2 Scene (javafx.scene.Scene)2 StackPane (javafx.scene.layout.StackPane)2 StringConverter (javafx.util.StringConverter)2 CandleStickChart (bisq.desktop.main.market.trades.charts.price.CandleStickChart)1 VolumeChart (bisq.desktop.main.market.trades.charts.volume.VolumeChart)1 GraphDataBean (com.canoo.dp.impl.platform.projector.graph.GraphDataBean)1