本文整理汇总了Java中javafx.scene.chart.AreaChart.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java AreaChart.setTitle方法的具体用法?Java AreaChart.setTitle怎么用?Java AreaChart.setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.chart.AreaChart
的用法示例。
在下文中一共展示了AreaChart.setTitle方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChart
import javafx.scene.chart.AreaChart; //导入方法依赖的package包/类
protected AreaChart<Number, Number> createChart() {
NumberAxis xAxis = new NumberAxis();
NumberAxis yAxis = new NumberAxis();
AreaChart<Number,Number> ac = new AreaChart<Number,Number>(xAxis,yAxis);
// setup chart
ac.setTitle("Area Chart Example");
xAxis.setLabel("X Axis");
yAxis.setLabel("Y Axis");
// add starting data
for (int s=0;s<3;s++) {
XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
series.setName("Data Series "+s);
double x = 0;
while (x<95) {
series.getData().add(new XYChart.Data<Number,Number>(x, Math.random()*99));
x += 5 + (15*Math.random());
}
series.getData().add(new XYChart.Data<Number,Number>(99d, Math.random()*99));
ac.getData().add(series);
}
return ac;
}
示例2: createChart
import javafx.scene.chart.AreaChart; //导入方法依赖的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;
}
示例3: createObject
import javafx.scene.chart.AreaChart; //导入方法依赖的package包/类
protected Chart createObject(Axis x_axis, Axis y_axis, double width, double height) {
Series s1 = new Series( FXCollections.observableArrayList(
new XYChart.Data(1,4),
new XYChart.Data(2,5),
new XYChart.Data(3,6)
));
s1.setName("Set 1");
Series s2 = new Series( FXCollections.observableArrayList(
new XYChart.Data(4,4),
new XYChart.Data(5,3),
new XYChart.Data(6,2)
));
s2.setName("Set 2");
Series s3 = new Series( FXCollections.observableArrayList(
new XYChart.Data(7,4),
new XYChart.Data(8,6),
new XYChart.Data(9,8)
));
s3.setName("Set 3");
ObservableList data = FXCollections.observableArrayList(s1, s2, s3);
AreaChart chart = new AreaChart(x_axis, y_axis, data);
chart.setMaxSize(width, height);
chart.setPrefSize(width, height);
chart.setTitle("AreaChart");
chart.setStyle("-fx-border-color: darkgray;");
return chart;
}
示例4: start
import javafx.scene.chart.AreaChart; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("java-buddy.blogspot.com");
Group root = new Group();
final CategoryAxis xAxis = new CategoryAxis();
final NumberAxis yAxis = new NumberAxis();
xAxis.setLabel("Month");
yAxis.setLabel("Value");
final AreaChart<String,Number> areaChart = new AreaChart<String,Number>(xAxis,yAxis);
areaChart.setTitle("AreaChart");
XYChart.Series series = new XYChart.Series();
series.setName("XYChart.Series");
series.getData().add(new XYChart.Data("January", 100));
series.getData().add(new XYChart.Data("February", 200));
series.getData().add(new XYChart.Data("March", 50));
series.getData().add(new XYChart.Data("April", 75));
series.getData().add(new XYChart.Data("May", 110));
series.getData().add(new XYChart.Data("June", 300));
series.getData().add(new XYChart.Data("July", 111));
series.getData().add(new XYChart.Data("August", 30));
series.getData().add(new XYChart.Data("September", 75));
series.getData().add(new XYChart.Data("October", 55));
series.getData().add(new XYChart.Data("November", 225));
series.getData().add(new XYChart.Data("December", 99));
areaChart.getData().add(series);
root.getChildren().add(areaChart);
primaryStage.setScene(new Scene(root, 500, 400));
primaryStage.show();
}
示例5: start
import javafx.scene.chart.AreaChart; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
if (stage == null) {
return;
}
stage.setTitle("Area Chart Sample");
final NumberAxis xAxis = new NumberAxis(1, 31, 1);
final NumberAxis yAxis = new NumberAxis();
final AreaChart<Number,Number> ac = new AreaChart<>(xAxis,yAxis);
ac.setTitle("Temperature Monitoring (in Degrees C)");
XYChart.Series seriesApril= new XYChart.Series();
seriesApril.setName("April");
seriesApril.getData().add(new XYChart.Data(1, 4));
seriesApril.getData().add(new XYChart.Data(3, 10));
seriesApril.getData().add(new XYChart.Data(6, 15));
seriesApril.getData().add(new XYChart.Data(9, 8));
seriesApril.getData().add(new XYChart.Data(12, 5));
seriesApril.getData().add(new XYChart.Data(15, 18));
seriesApril.getData().add(new XYChart.Data(18, 15));
seriesApril.getData().add(new XYChart.Data(21, 13));
seriesApril.getData().add(new XYChart.Data(24, 19));
seriesApril.getData().add(new XYChart.Data(27, 21));
seriesApril.getData().add(new XYChart.Data(30, 21));
XYChart.Series seriesMay = new XYChart.Series();
seriesMay.setName("May");
seriesMay.getData().add(new XYChart.Data(1, 20));
seriesMay.getData().add(new XYChart.Data(3, 15));
seriesMay.getData().add(new XYChart.Data(6, 13));
seriesMay.getData().add(new XYChart.Data(9, 12));
seriesMay.getData().add(new XYChart.Data(12, 14));
seriesMay.getData().add(new XYChart.Data(15, 18));
seriesMay.getData().add(new XYChart.Data(18, 25));
seriesMay.getData().add(new XYChart.Data(21, 25));
seriesMay.getData().add(new XYChart.Data(24, 23));
seriesMay.getData().add(new XYChart.Data(27, 26));
seriesMay.getData().add(new XYChart.Data(31, 26));
Scene scene = new Scene(ac,800,600);
ac.getData().addAll(seriesApril, seriesMay);
stage.setScene(scene);
stage.show();
}
示例6: getNewChart
import javafx.scene.chart.AreaChart; //导入方法依赖的package包/类
public AreaChart getNewChart() {
AreaChart chart = new AreaChart(axis1, axis2);
chart.setTitle("AreaChart");
chart.setStyle("-fx-border-color: darkgray;");
return chart;
}
示例7: createChart
import javafx.scene.chart.AreaChart; //导入方法依赖的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;
}
示例8: initialize
import javafx.scene.chart.AreaChart; //导入方法依赖的package包/类
private void initialize(Stage primaryStage)
{
logger = Logger.getLogger(getClass().getName());
xAxis = new NumberAxis(0,MAX_DATA_POINTS,MAX_DATA_POINTS/10);
xAxis.setForceZeroInRange(false);
xAxis.setAutoRanging(false);
NumberAxis yAxis = new NumberAxis();
yAxis.setAutoRanging(true);
// Chart
final AreaChart<Number, Number> sc = new AreaChart<Number, Number>(xAxis, yAxis)
{
@Override
protected void dataItemAdded(Series<Number, Number> series, int itemIndex, Data<Number, Number> item)
{
; // This method is overriden with empty statement, to remove symbols on each data point.
}
};
sc.setAnimated(false);
sc.setId("liveAreaChart");
sc.setTitle("Lizard Enclosure Sensor Readings");
// internal temperature Series
internalTemperatureSeries = new AreaChart.Series<Number, Number>();
internalTemperatureSeries.setName("Internal Temperature");
sc.getData().add(internalTemperatureSeries);
externalTemperatureSeries = new AreaChart.Series<Number, Number>();
externalTemperatureSeries.setName("External Temperature");
sc.getData().add(externalTemperatureSeries);
internalHumiditySeries = new AreaChart.Series<Number, Number>();
internalHumiditySeries.setName("Internal Humidity");
sc.getData().add(internalHumiditySeries);
primaryStage.setScene(new Scene(sc));
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>()
{
@Override
public void handle(WindowEvent t)
{
Platform.exit();
System.exit(0);
}
});
}