本文整理汇总了Java中javafx.scene.chart.StackedAreaChart类的典型用法代码示例。如果您正苦于以下问题:Java StackedAreaChart类的具体用法?Java StackedAreaChart怎么用?Java StackedAreaChart使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StackedAreaChart类属于javafx.scene.chart包,在下文中一共展示了StackedAreaChart类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: StackedAreaChartClass
import javafx.scene.chart.StackedAreaChart; //导入依赖的package包/类
/**
* the constructor is responsible for initialize the chart (lower and upper buonds, name, colors)
* @param stackedAreaChart is the type of chart for battery performance
*/
public StackedAreaChartClass(StackedAreaChart stackedAreaChart){
NumberAxis yaxis = (NumberAxis) stackedAreaChart.getYAxis();
//getter and setting proprieties for y and x axes
xAxis = (NumberAxis) stackedAreaChart.getXAxis();
xAxis.setLowerBound(0);
xAxis.setUpperBound(10);
xAxis.setAutoRanging(false);
xAxis.setTickLabelsVisible(false); //hide numbers on x axis
stackedAreaChart.setVerticalGridLinesVisible(false);//hide vertical lines
stackedAreaChart.animatedProperty().setValue(false);
yaxis.setAutoRanging(false);
yaxis.setLowerBound(0);
yaxis.setUpperBound(100);
//set series of content to draw chart
series = new XYChart.Series();
series.setName("Battery level");
stackedAreaChart.getData().add(series);
//setting colors of charts
Node fill = series.getNode().lookup(".chart-series-area-fill");
fill.setStyle("-fx-fill: #fff7ad;");
Node line = series.getNode().lookup(".chart-series-area-line");
line.setStyle("-fx-stroke: #8bc34a;" +
"-fx-stroke-width: 3px;"); // set width of line
stackedAreaChart.setStyle("CHART_COLOR_1: #8bc34a;"); //color of dots
}
示例2: getNewChartInstance
import javafx.scene.chart.StackedAreaChart; //导入依赖的package包/类
@Override
protected Chart getNewChartInstance() {
NumberAxis axis1 = new NumberAxis(0, 100, 10);
NumberAxis axis2 = new NumberAxis(0, 100, 10);
StackedAreaChart chart = new StackedAreaChart(axis1, axis2);
return chart;
}
示例3: createSymbolsPropertyTest
import javafx.scene.chart.StackedAreaChart; //导入依赖的package包/类
@Test(timeout = 60000)
public void createSymbolsPropertyTest() {
assertTrue(new AreaChart(new NumberAxis(), new NumberAxis()).getCreateSymbols());
assertTrue(new StackedAreaChart(new NumberAxis(), new NumberAxis()).getCreateSymbols());
populateChart();
checkTextFieldText(AreaTestsProperties.createSymbols, "true");
checkDotsCount(30);
setPropertyByToggleClick(SettingType.BIDIRECTIONAL, AreaTestsProperties.createSymbols, false);
checkTextFieldText(AreaTestsProperties.createSymbols, "false");
checkDotsCount(0);
setPropertyByToggleClick(SettingType.SETTER, AreaTestsProperties.createSymbols, true);
checkTextFieldText(AreaTestsProperties.createSymbols, "true");
checkDotsCount(30);
setPropertyByToggleClick(SettingType.UNIDIRECTIONAL, AreaTestsProperties.createSymbols, false);
checkTextFieldText(AreaTestsProperties.createSymbols, "false");
checkDotsCount(0);
removeFromIndex(2, 1, 0);
checkDotsCount(0);
setPropertyByToggleClick(SettingType.UNIDIRECTIONAL, AreaTestsProperties.createSymbols, true);
addSeries("Series C", 0, 100, 30);
checkDotsCount(30);
removeFromIndex(0);
checkDotsCount(0);
setPropertyByToggleClick(SettingType.UNIDIRECTIONAL, AreaTestsProperties.createSymbols, false);
checkDotsCount(0);
addSeries("Series C", 0, 100, 30);
checkDotsCount(0);
}
示例4: buildChart
import javafx.scene.chart.StackedAreaChart; //导入依赖的package包/类
@Override
protected XYChart<ZonedDateTime, Double> buildChart(ZonedDateTimeAxis xAxis, ValueAxis<Double> yAxis, BooleanProperty showSymbolsProperty) {
StackedAreaChart<ZonedDateTime, Double> newChart = new StackedAreaChart<>(xAxis, yAxis);
newChart.setCreateSymbols(false);
newChart.createSymbolsProperty().bindBidirectional(showSymbolsProperty);
return newChart;
}
示例5: testGetStackedAreaChartAdjuster
import javafx.scene.chart.StackedAreaChart; //导入依赖的package包/类
@Test
public void testGetStackedAreaChartAdjuster() {
Adjuster adjuster = Adjuster.getAdjuster(StackedAreaChart.class);
assertThat(adjuster, is(instanceOf(RegionAdjuster.class)));
assertThat(adjuster.getNodeClass(), is(sameInstance(Region.class)));
}
示例6: createXYChart
import javafx.scene.chart.StackedAreaChart; //导入依赖的package包/类
@Override
protected XYChart<String, Number> createXYChart() {
final CategoryAxis xAxis = new CategoryAxis();
final NumberAxis yAxis = new NumberAxis();
final XYChart<String, Number> chart = new StackedAreaChart<String, Number>(xAxis, yAxis);
chart.getStyleClass().add("chart-extension");
return chart;
}
示例7: StackedAreaChartSample
import javafx.scene.chart.StackedAreaChart; //导入依赖的package包/类
public StackedAreaChartSample() {
NumberAxis xAxis = NumberAxisBuilder.create()
.label("X Values")
.lowerBound(1.0d)
.upperBound(9.0d)
.tickUnit(2.0d).build();
NumberAxis yAxis = NumberAxisBuilder.create()
.label("Y Values")
.lowerBound(0.0d)
.upperBound(30.0d)
.tickUnit(2.0d).build();
ObservableList<StackedAreaChart.Series> areaChartData = FXCollections.observableArrayList(
new StackedAreaChart.Series("Series 1",FXCollections.observableArrayList(
new StackedAreaChart.Data(0,4),
new StackedAreaChart.Data(2,5),
new StackedAreaChart.Data(4,4),
new StackedAreaChart.Data(6,2),
new StackedAreaChart.Data(8,6),
new StackedAreaChart.Data(10,8)
)),
new StackedAreaChart.Series("Series 2", FXCollections.observableArrayList(
new StackedAreaChart.Data(0,8),
new StackedAreaChart.Data(2,2),
new StackedAreaChart.Data(4,9),
new StackedAreaChart.Data(6,7),
new StackedAreaChart.Data(8,5),
new StackedAreaChart.Data(10,7)
)),
new StackedAreaChart.Series("Series 3", FXCollections.observableArrayList(
new StackedAreaChart.Data(0,2),
new StackedAreaChart.Data(2,5),
new StackedAreaChart.Data(4,8),
new StackedAreaChart.Data(6,6),
new StackedAreaChart.Data(8,9),
new StackedAreaChart.Data(10,7)
))
);
StackedAreaChart chart = new StackedAreaChart(xAxis, yAxis, areaChartData);
getChildren().add(chart);
}
示例8: createObject
import javafx.scene.chart.StackedAreaChart; //导入依赖的package包/类
protected Chart createObject(Axis x_axis, Axis y_axis, double width, double height) {
Series s1 = new Series( FXCollections.observableArrayList(
new XYChart.Data(1,2),
new XYChart.Data(2,3),
new XYChart.Data(3,5),
new XYChart.Data(4,1),
new XYChart.Data(6,4),
new XYChart.Data(7,2),
new XYChart.Data(8,3),
new XYChart.Data(9,4)
));
s1.setName("Set 1");
Series s2 = new Series( FXCollections.observableArrayList(
new XYChart.Data(1,1),
new XYChart.Data(2,4),
new XYChart.Data(3,2),
new XYChart.Data(6,5),
new XYChart.Data(7,3),
new XYChart.Data(8,2),
new XYChart.Data(9,1)
));
s2.setName("Set 2");
Series s3 = new Series( FXCollections.observableArrayList(
new XYChart.Data(1,5),
new XYChart.Data(2,3),
new XYChart.Data(3,1),
new XYChart.Data(4,2),
new XYChart.Data(6,3),
new XYChart.Data(7,1),
new XYChart.Data(8,4)
));
s3.setName("Set 3");
ObservableList data = FXCollections.observableArrayList(s1, s2, s3);
StackedAreaChart chart = new StackedAreaChart(x_axis, y_axis, data);
chart.setMaxSize(width, height);
chart.setPrefSize(width, height);
chart.setTitle("StackedAreaChart");
chart.setStyle("-fx-border-color: darkgray;");
return chart;
}
示例9: getNewChart
import javafx.scene.chart.StackedAreaChart; //导入依赖的package包/类
public StackedAreaChart getNewChart() {
StackedAreaChart chart = new StackedAreaChart(axis1, axis2);
chart.setTitle("StackedAreaChart");
chart.setStyle("-fx-border-color: darkgray;");
return chart;
}