本文整理汇总了Java中javafx.scene.chart.AreaChart类的典型用法代码示例。如果您正苦于以下问题:Java AreaChart类的具体用法?Java AreaChart怎么用?Java AreaChart使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AreaChart类属于javafx.scene.chart包,在下文中一共展示了AreaChart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createChart
import javafx.scene.chart.AreaChart; //导入依赖的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: addDataToSeriesOriginal
import javafx.scene.chart.AreaChart; //导入依赖的package包/类
private void addDataToSeriesOriginal()
{
// add 20 numbers to the plot+
for(int i = 0; i < 20; i++)
{
if( internalTemperatureMessageQueue.isEmpty() )
{
break;
}
AreaChart.Data data = new AreaChart.Data(xSeriesData++, internalTemperatureMessageQueue.remove());
internalTemperatureSeries.getData().add(data);
}
// remove points to keep us at no more than MAX_DATA_POINTS
if(internalTemperatureSeries.getData().size() > MAX_DATA_POINTS)
{
internalTemperatureSeries.getData().remove(0, internalTemperatureSeries.getData().size() - MAX_DATA_POINTS);
}
// update
xAxis.setLowerBound(xSeriesData-MAX_DATA_POINTS);
xAxis.setUpperBound(xSeriesData-1);
}
示例5: addDataItem
import javafx.scene.chart.AreaChart; //导入依赖的package包/类
/**Add date item to chart
*@param AreaChart<Number,Number>
*@param String the sensor id
**/
public static void addDataItem(AreaChart<Number,Number> ac, String sensor)
{
ObservableList<XYChart.Series<Number, Number>> data = ac.getData();
if (!data.isEmpty())
{
for(int i=0;i<data.size();i++)
{
XYChart.Series<Number, Number> s = data.get(i);
if(s.getName().equals(sensor))
{
if(s!=null)
//not implemented yet
break;
}
}
}
}
示例6: AreaChartSample
import javafx.scene.chart.AreaChart; //导入依赖的package包/类
public AreaChartSample() {
NumberAxis xAxis = new NumberAxis("X Values", 1.0d, 9.0d, 2.0d);
xAxis.setTickLength(12.0f);
NumberAxis yAxis = new NumberAxis("Y Values", 0.0d, 10.0d, 2.0d);
ObservableList<AreaChart.Series> areaChartData = FXCollections.observableArrayList(
new AreaChart.Series("Series 1",FXCollections.observableArrayList(
new AreaChart.Data(0,4),
new AreaChart.Data(2,5),
new AreaChart.Data(4,4),
new AreaChart.Data(6,2),
new AreaChart.Data(8,6),
new AreaChart.Data(10,8)
)),
new AreaChart.Series("Series 2", FXCollections.observableArrayList(
new AreaChart.Data(0,8),
new AreaChart.Data(2,2),
new AreaChart.Data(4,9),
new AreaChart.Data(6,7),
new AreaChart.Data(8,5),
new AreaChart.Data(10,7)
)),
new AreaChart.Series("Series 3", FXCollections.observableArrayList(
new AreaChart.Data(0,2),
new AreaChart.Data(2,5),
new AreaChart.Data(4,8),
new AreaChart.Data(6,6),
new AreaChart.Data(8,9),
new AreaChart.Data(10,7)
))
);
AreaChart chart = new AreaChart(xAxis, yAxis, areaChartData);
getChildren().add(chart);
}
示例7: AreaChartControl
import javafx.scene.chart.AreaChart; //导入依赖的package包/类
public AreaChartControl(String name) {
super(name, FlashboardSendableType.AREACHART);
axisX = new NumberAxis();
axisX.setForceZeroInRange(false);
axisX.setAutoRanging(false);
axisX.setUpperBound(maxX);
axisX.setLowerBound(minX);
axisY = new NumberAxis();
axisY.setForceZeroInRange(false);
axisY.setAutoRanging(false);
axisY.setUpperBound(maxY);
axisY.setLowerBound(minY);
chart = new AreaChart<Number, Number>(axisX, axisY);
chart.setLegendVisible(false);
chart.setAnimated(false);
chartSeries = new AreaChart.Series<Number, Number>();
chart.setTitle(name);
chart.getData().add(chartSeries);
root = new VBox();
root.setAlignment(Pos.CENTER);
root.setMaxSize(WIDTH, HEIGHT);
root.getChildren().add(chart);
}
示例8: 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;
}
示例9: getNewChartInstance
import javafx.scene.chart.AreaChart; //导入依赖的package包/类
@Override
protected Chart getNewChartInstance() {
NumberAxis axis1 = new NumberAxis(0, 100, 10);
NumberAxis axis2 = new NumberAxis(0, 100, 10);
AreaChart chart = new AreaChart(axis1, axis2);
return chart;
}
示例10: createSymbolsPropertyTest
import javafx.scene.chart.AreaChart; //导入依赖的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);
}
示例11: GPXTrackviewer
import javafx.scene.chart.AreaChart; //导入依赖的package包/类
private GPXTrackviewer() {
myMapView = new MapView();
myMapView.setZoom(0);
myGPXWaypointLayer = new GPXWaypointLayer();
myMapView.addLayer(myGPXWaypointLayer);
myMapView.setVisible(false);
myMapView.setCursor(Cursor.CROSSHAIR);
final NumberAxis xAxis = new NumberAxis();
final NumberAxis yAxis = new NumberAxis();
myAreaChart = new AreaChart(xAxis, yAxis);
myAreaChart.setLegendVisible(false);
myAreaChart.setVisible(false);
myAreaChart.setCursor(Cursor.CROSSHAIR);
}
示例12: buildChart
import javafx.scene.chart.AreaChart; //导入依赖的package包/类
@Override
protected XYChart<ZonedDateTime, Double> buildChart(ZonedDateTimeAxis xAxis, ValueAxis<Double> yAxis, BooleanProperty showSymbolsProperty) {
AreaChart<ZonedDateTime, Double> newChart = new AreaChart<>(xAxis, yAxis);
newChart.setCreateSymbols(false);
newChart.createSymbolsProperty().bindBidirectional(showSymbolsProperty);
return newChart;
}
示例13: createElevationViewNode
import javafx.scene.chart.AreaChart; //导入依赖的package包/类
/**
* creates the Node that contans the elevation data.
*
* @return
*/
private Node createElevationViewNode() {
// in front of the label is the chart
NumberAxis xAxis = new NumberAxis();
xAxis.setForceZeroInRange(false);
xAxis.setAnimated(false);
NumberAxis yAxis = new NumberAxis();
yAxis.setForceZeroInRange(false);
yAxis.setAnimated(false);
elevationChart = new AreaChart<>(xAxis, yAxis);
elevationChart.setCreateSymbols(false);
// if the chart is set to animated, we get error message son the console when adding data
elevationChart.setAnimated(false);
return elevationChart;
}
示例14: testGetAreaChartAdjuster
import javafx.scene.chart.AreaChart; //导入依赖的package包/类
@Test
public void testGetAreaChartAdjuster() {
Adjuster adjuster = Adjuster.getAdjuster(AreaChart.class);
assertThat(adjuster, is(instanceOf(RegionAdjuster.class)));
assertThat(adjuster.getNodeClass(), is(sameInstance(Region.class)));
}
示例15: addDataToSeries
import javafx.scene.chart.AreaChart; //导入依赖的package包/类
private void addDataToSeries() {
for (int i = 0; i < 50; i++) {
if (stockDataQueue.isEmpty()) break;
stockPriceSeries.getData().add(new AreaChart.Data(xSeriesDataStock++, stockDataQueue.remove()));
if (predictionDataQueue.isEmpty() || emaDataQueue.isEmpty()) break;
predictionSeries.getData().add(new AreaChart.Data(xSeriesDataPrediction, predictionDataQueue.remove()));
emaPriceSeries.getData().add(new AreaChart.Data(xSeriesDataPrediction, emaDataQueue.remove()));
xSeriesDataPrediction++;
// series3.getData().add(new AreaChart.Data(xSeriesData++, dataQ3.remove()));
}
// remove points to keep us at no more than MAX_DATA_POINTS
if (stockPriceSeries.getData().size() > MAX_DATA_POINTS) {
stockPriceSeries.getData().remove(0, stockPriceSeries.getData().size() - MAX_DATA_POINTS);
}
if (predictionSeries.getData().size() > MAX_DATA_POINTS) {
predictionSeries.getData().remove(0, predictionSeries.getData().size() - MAX_DATA_POINTS);
}
if (emaPriceSeries.getData().size() > MAX_DATA_POINTS) {
emaPriceSeries.getData().remove(0, emaPriceSeries.getData().size() - MAX_DATA_POINTS);
}
xAxis.setLowerBound(xSeriesDataPrediction - MAX_DATA_POINTS);
xAxis.setUpperBound(xSeriesDataStock - 1);
}