本文整理匯總了Java中javafx.scene.chart.NumberAxis.setTickLabelFormatter方法的典型用法代碼示例。如果您正苦於以下問題:Java NumberAxis.setTickLabelFormatter方法的具體用法?Java NumberAxis.setTickLabelFormatter怎麽用?Java NumberAxis.setTickLabelFormatter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.chart.NumberAxis
的用法示例。
在下文中一共展示了NumberAxis.setTickLabelFormatter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createChart
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
protected AreaChart<Number,Number> createChart() {
final NumberAxis xAxis = new NumberAxis(0,128,8);
final NumberAxis yAxis = new NumberAxis(0,50,10);
final AreaChart<Number,Number> ac = new AreaChart<Number,Number>(xAxis,yAxis);
// setup chart
ac.setId("audioAreaDemo");
ac.setLegendVisible(false);
ac.setTitle("Live Audio Spectrum Data");
ac.setAnimated(false);
xAxis.setLabel("Frequency Bands");
yAxis.setLabel("Magnitudes");
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,null,"dB"));
// add starting data
XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
series.setName("Audio Spectrum");
//noinspection unchecked
series1Data = new XYChart.Data[(int)xAxis.getUpperBound()];
for (int i=0; i<series1Data.length; i++) {
series1Data[i] = new XYChart.Data<Number,Number>(i,50);
series.getData().add(series1Data[i]);
}
ac.getData().add(series);
return ac;
}
示例2: createChart
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
protected BarChart<String, Number> createChart() {
final CategoryAxis xAxis = new CategoryAxis();
final NumberAxis yAxis = new NumberAxis(0,50,10);
final BarChart<String,Number> bc = new BarChart<String,Number>(xAxis,yAxis);
bc.setId("barAudioDemo");
bc.setLegendVisible(false);
bc.setAnimated(false);
bc.setBarGap(0);
bc.setCategoryGap(1);
bc.setVerticalGridLinesVisible(false);
// setup chart
bc.setTitle("Live Audio Spectrum Data");
xAxis.setLabel("Frequency Bands");
yAxis.setLabel("Magnitudes");
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,null,"dB"));
// add starting data
XYChart.Series<String,Number> series1 = new XYChart.Series<String,Number>();
series1.setName("Data Series 1");
//noinspection unchecked
series1Data = new XYChart.Data[128];
String[] categories = new String[128];
for (int i=0; i<series1Data.length; i++) {
categories[i] = Integer.toString(i+1);
series1Data[i] = new XYChart.Data<String,Number>(categories[i],50);
series1.getData().add(series1Data[i]);
}
bc.getData().add(series1);
return bc;
}
示例3: createChart
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
private void createChart() {
xAxis = new NumberAxis();
xAxis.setForceZeroInRange(false);
xAxis.setAutoRanging(true);
NumberAxis yAxis = new NumberAxis();
yAxis.setForceZeroInRange(false);
yAxis.setAutoRanging(true);
yAxis.setLabel(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode()));
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis, "", ""));
seriesBuy = new XYChart.Series<>();
seriesSell = new XYChart.Series<>();
areaChart = new AreaChart<>(xAxis, yAxis);
areaChart.setLegendVisible(false);
areaChart.setAnimated(false);
areaChart.setId("charts");
areaChart.setMinHeight(300);
areaChart.setPrefHeight(300);
areaChart.setPadding(new Insets(0, 30, 0, 0));
areaChart.getData().addAll(seriesBuy, seriesSell);
}
示例4: initYAxis
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
private NumberAxis initYAxis() {
final NumberAxis yAxis = new NumberAxis();
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
@Override
public String toString(final Number object) {
return String.format("%6.2f", object);
}
});
yAxis.setTickLabelFont(Font.font("Arial", FontWeight.MEDIUM, 18));
yAxis.setPrefWidth(120);
yAxis.setAutoRanging(true);
yAxis.setLabel("Meters⁻²");
yAxis.setForceZeroInRange(false);
yAxis.setAnimated(true);
return yAxis;
}
示例5: initYAxis
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
private NumberAxis initYAxis() {
final NumberAxis yAxis = new NumberAxis();
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
@Override
public String toString(final Number object) {
return String.format("%6.2f", object);
}
});
yAxis.setTickLabelFont(Font.font("Arial", FontWeight.MEDIUM, 18));
yAxis.setPrefWidth(120);
yAxis.setAutoRanging(true);
yAxis.setLabel("m/s");
yAxis.setForceZeroInRange(false);
yAxis.setAnimated(false);
return yAxis;
}
示例6: initYAxis
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
private NumberAxis initYAxis() {
final NumberAxis yAxis = new NumberAxis();
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
@Override
public String toString(final Number object) {
return String.format("%6.2f", object);
}
});
yAxis.setTickLabelFont(Font.font("Arial", FontWeight.MEDIUM, 18));
yAxis.setPrefWidth(120);
yAxis.setAutoRanging(true);
yAxis.setLabel("Meters");
yAxis.setForceZeroInRange(false);
yAxis.setAnimated(true);
return yAxis;
}
示例7: initYAxis
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
private NumberAxis initYAxis() {
final NumberAxis yAxis = new NumberAxis();
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
@Override
public String toString(final Number object) {
return String.format("%6.2f", object);
}
});
yAxis.setTickLabelFont(Font.font("Arial", FontWeight.MEDIUM, 18));
yAxis.setPrefWidth(120);
yAxis.setAutoRanging(true);
yAxis.setLabel("factor");
yAxis.setForceZeroInRange(false);
yAxis.setAnimated(false);
return yAxis;
}
示例8: initYAxis
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
private NumberAxis initYAxis() {
final NumberAxis yAxis = new NumberAxis();
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
@Override
public String toString(final Number object) {
return String.format("%6.2f", object);
}
});
yAxis.setTickLabelFont(Font.font("Arial", FontWeight.MEDIUM, 18));
yAxis.setPrefWidth(120);
yAxis.setAutoRanging(true);
yAxis.setLabel("m/s^2");
yAxis.setForceZeroInRange(false);
yAxis.setAnimated(false);
return yAxis;
}
示例9: initYAxis
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
private NumberAxis initYAxis() {
final NumberAxis yAxis = new NumberAxis(800, 802, 0.1);
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
@Override
public String toString(final Number object) {
return String.format("%6.2f", object);
}
});
yAxis.setTickLabelFont(Font.font("Arial", FontWeight.MEDIUM, 18));
yAxis.setPrefWidth(120);
yAxis.setAutoRanging(false);
yAxis.setLabel("Meters");
yAxis.setForceZeroInRange(false);
yAxis.setAnimated(true);
return yAxis;
}
示例10: createChart
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
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;
}
示例11: createChart
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
protected BarChart<String, Number> createChart() {
final String[] years = {"2007", "2008", "2009"};
final CategoryAxis xAxis = new CategoryAxis();
final NumberAxis yAxis = new NumberAxis();
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,"$",null));
final BarChart<String,Number> bc = new BarChart<String,Number>(xAxis,yAxis);
// setup chart
bc.setTitle("Advanced Bar Chart");
xAxis.setLabel("Year");
xAxis.setCategories(FXCollections.<String>observableArrayList(Arrays.asList(years)));
yAxis.setLabel("Price");
// add starting data
XYChart.Series<String,Number> series1 = new XYChart.Series<String,Number>();
series1.setName("Data Series 1");
XYChart.Series<String,Number> series2 = new XYChart.Series<String,Number>();
series2.setName("Data Series 2");
XYChart.Series<String,Number> series3 = new XYChart.Series<String,Number>();
series3.setName("Data Series 3");
// create sample data
series1.getData().add(new XYChart.Data<String,Number>(years[0], 567));
series1.getData().add(new XYChart.Data<String,Number>(years[1], 1292));
series1.getData().add(new XYChart.Data<String,Number>(years[2], 2180));
series2.getData().add(new XYChart.Data<String,Number>(years[0], 956));
series2.getData().add(new XYChart.Data<String,Number>(years[1], 1665));
series2.getData().add(new XYChart.Data<String,Number>(years[2], 2450));
series3.getData().add(new XYChart.Data<String,Number>(years[0], 800));
series3.getData().add(new XYChart.Data<String,Number>(years[1], 1000));
series3.getData().add(new XYChart.Data<String,Number>(years[2], 2800));
bc.getData().add(series1);
bc.getData().add(series2);
bc.getData().add(series3);
return bc;
}
示例12: createIntegerTimingDiagram
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
/**
* Generates an integer timing diagram.
*
* @param concreteSpec the concrete specification which should be used to extract the needed
* information
* @param specIoVar the variable for which a diagram should be generated
* @param globalXAxis global x axis used for all diagrams
* @param selection selection that should be updated when hovering with mouse
* @param activated only update selection if true
* @return A {@link Pair} which holds a {@link TimingDiagramController} and a {@link NumberAxis}
*/
public static Pair<TimingDiagramController, Axis> createIntegerTimingDiagram(
ConcreteSpecification concreteSpec, ValidIoVariable specIoVar, NumberAxis globalXAxis,
Selection selection, BooleanProperty activated) {
NumberAxis yaxis = new NumberAxis(0, 10, 1);
yaxis.setPrefWidth(30);
yaxis.setSide(Side.LEFT);
yaxis.setTickLabelFormatter(new IntegerTickLabelConverter());
yaxis.setMinorTickVisible(false);
TimingDiagramController timingDiagramController = new TimingDiagramController(globalXAxis,
yaxis, concreteSpec, specIoVar, selection, activated);
return new ImmutablePair<>(timingDiagramController, yaxis);
}
示例13: setUpChart
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
@Override
public void setUpChart(XYChart<Number, Number> chart, ResourceBundle resources) {
NumberAxis xAxis = (NumberAxis) chart.getXAxis();
NumberAxis yAxis = (NumberAxis) chart.getYAxis();
xAxis.setLabel(resources.getString("photometricdata.period"));
xAxis.setAutoRanging(false);
xAxis.setTickUnit(0.25);
xAxis.setLowerBound(0);
xAxis.setUpperBound(1);
yAxis.setLabel(resources.getString("photometricdata.magnitude"));
yAxis.setAutoRanging(true);
yAxis.setTickLabelFormatter(invertedNegative(yAxis));
}
示例14: setUpChart
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
@Override
public void setUpChart(XYChart<Number, Number> chart, ResourceBundle resources) {
NumberAxis xAxis = (NumberAxis) chart.getXAxis();
NumberAxis yAxis = (NumberAxis) chart.getYAxis();
xAxis.setLabel(resources.getString("photometricdata.jd"));
xAxis.setAutoRanging(true);
xAxis.setTickUnit(1000);
yAxis.setLabel(resources.getString("photometricdata.magnitude"));
yAxis.setAutoRanging(true);
yAxis.setTickLabelFormatter(invertedNegative(yAxis));
}
示例15: createChart
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
private XYChart<Number, Number> createChart() {
final XYChart.Series<Number, Number> series = new XYChart.Series<>();
final double divisionWidth = (this.story.getRange().getLength() * 1.0) / (numDivisions * 1.0);
for (int i = 0; i < numDivisions; ++i) {
final TextRange range = new TextRange((int) Math.round(i * divisionWidth), (int) Math.round((i + 1) * divisionWidth));
final double count = getNumOverlaps(range, this.ranges);
series.getData().add(new Data<Number, Number>(range.getStartIndex(), count));
}
final StringConverter<Number> tickLabelFormatter = new StringConverter<Number>() {
@Override
public String toString(final Number n) {
return String.valueOf((int) Math.round(n.doubleValue()));
}
@Override
public Number fromString(final String string) {
return Double.valueOf(string);
}
};
final NumberAxis xAxis = new NumberAxis(0, this.story.getRange().getLength() - divisionWidth, divisionWidth);
xAxis.setLabel("Text Position");
xAxis.setTickLabelsVisible(true);
xAxis.setTickLabelFormatter(tickLabelFormatter);
final NumberAxis yAxis = new NumberAxis();
yAxis.setTickUnit(1);
yAxis.setLabel("# Found");
yAxis.setTickLabelsVisible(true);
yAxis.setTickLabelFormatter(tickLabelFormatter);
final AreaChart<Number, Number> chart = new AreaChart<>(xAxis, yAxis);
chart.setAnimated(false);
chart.getData().add(series);
chart.setLegendVisible(false);
chart.setPrefWidth(600);
chart.setPrefHeight(400);
chart.setTitle("Heat Map");
return chart;
}