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;
}
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;
}
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;
}
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();
}
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);
}
Aggregations