本文整理汇总了Java中javafx.scene.chart.AreaChart.setLegendVisible方法的典型用法代码示例。如果您正苦于以下问题:Java AreaChart.setLegendVisible方法的具体用法?Java AreaChart.setLegendVisible怎么用?Java AreaChart.setLegendVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.chart.AreaChart
的用法示例。
在下文中一共展示了AreaChart.setLegendVisible方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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);
}
示例3: draw
import javafx.scene.chart.AreaChart; //导入方法依赖的package包/类
@Override
public void draw() {
NumberAxis xAxis = new NumberAxis();
NumberAxis yAxis = new NumberAxis();
xAxis.setMinorTickVisible(false);
xAxis.setTickMarkVisible(false);
xAxis.setTickLabelsVisible(false);
xAxis.setAutoRanging(false);
yAxis.setMinorTickVisible(false);
yAxis.setTickMarkVisible(false);
yAxis.setLabel("MB");
XYChart.Series<Number, Long> capacitySeries = new XYChart.Series<>();
XYChart.Series<Number, Long> usageSeries = new XYChart.Series<>();
AreaChart<Number, Long> chart = new AreaChart(xAxis, yAxis, FXCollections.observableArrayList(capacitySeries, usageSeries));
chart.setAnimated(false);
chart.setLegendVisible(false);
chart.lookup(".series0").setStyle("-fx-fill: red; -fx-stroke: red;"); // capacity
chart.lookup(".series1").setStyle("-fx-fill: blue; -fx-stroke: blue;"); // usage
Stage stage = super.createStage(chart, "Metaspace usage");
for(LogData log : super.logdata){
long capacity;
long usage;
if(!super.shouldProcess(log) || (log.getTags().size() != 2) || !log.getTags().contains("metaspace")){
continue;
}
long gcid = super.getGcId();
Matcher matcher = METASPACE_USAGE_PATTERN.matcher(super.getLogBody());
if(!matcher.matches()){
continue;
}
usage = Long.parseLong(matcher.group(1)) / 1024; // in MB
capacity = Long.parseLong(matcher.group(2)) / 1024; // in MB
LogTimeValue logTimeValue = LogTimeValue.getLogTimeValue(log, super.chartWizardController.getTimeRange());
XYChart.Data<Number, Long> capacityData = new XYChart.Data<>(logTimeValue.getValue(), capacity);
XYChart.Data<Number, Long> usageData = new XYChart.Data<>(logTimeValue.getValue(), usage);
capacitySeries.getData().add(capacityData);
usageSeries.getData().add(usageData);
Node capacityDataNode = capacityData.getNode();
Node usageDataNode = usageData.getNode();
capacityDataNode.lookup(".chart-area-symbol").setStyle(BASE_SYMBOL_STYLE + "-fx-background-color: white, red;");
usageDataNode.lookup(".chart-area-symbol").setStyle(BASE_SYMBOL_STYLE + "-fx-background-color: white, blue;");
capacityDataNode.addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, e -> capacityDataNode.setOpacity(1.0d));
capacityDataNode.addEventHandler(MouseEvent.MOUSE_EXITED_TARGET, e -> capacityDataNode.setOpacity(0.0d));
usageDataNode.addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, e -> usageDataNode.setOpacity(1.0d));
usageDataNode.addEventHandler(MouseEvent.MOUSE_EXITED_TARGET, e -> usageDataNode.setOpacity(0.0d));
capacityDataNode.addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, e -> setTooltipValue(logTimeValue.toString(), capacity, usage, gcid));
usageDataNode.addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, e -> setTooltipValue(logTimeValue.toString(), capacity, usage, gcid));
capacityDataNode.addEventHandler(MouseEvent.MOUSE_CLICKED, e -> super.showLogWindow(super.gcEventList.get(gcid), "GC ID: " + gcid));
usageDataNode.addEventHandler(MouseEvent.MOUSE_CLICKED, e -> super.showLogWindow(super.gcEventList.get(gcid), "GC ID: " + gcid));
Tooltip.install(capacityData.getNode(), tooltip);
Tooltip.install(usageData.getNode(), tooltip);
}
if(capacitySeries.getData().size() == 0){
(new Alert(Alert.AlertType.ERROR, "No GC data", ButtonType.OK)).showAndWait();
return;
}
xAxis.setLowerBound(capacitySeries.getData().get(0).getXValue().doubleValue());
xAxis.setUpperBound(capacitySeries.getData().get(capacitySeries.getData().size() - 1).getXValue().doubleValue());
stage.show();
}
示例4: setHistogram
import javafx.scene.chart.AreaChart; //导入方法依赖的package包/类
void setHistogram(final PathTableData<?> model, final String columnName) {
if (model != null && model.getMeasurementNames().contains(columnName)) {
double[] values = model.getDoubleValues(columnName);
int nBins = params.getIntParameterValue("nBins");
if (nBins < 2)
nBins = 2;
else if (nBins > 1000)
nBins = 1000;
// We can have values in the 'wrong' order to facilitate comparison...
Arrays.sort(values);
// Check if we've actually changed anything - if not, then abort
if (nBins == currentBins && currentValues != null && Arrays.equals(currentValues, values))
return;
Histogram histogram = new Histogram(values, nBins);
histogram.setNormalizeCounts(params.getBooleanParameterValue("normalizeCounts"));
panelHistogram.getHistogramData().setAll(HistogramPanelFX.createHistogramData(histogram, false, (Integer)null));
AreaChart<Number, Number> chart = panelHistogram.getChart();
chart.setVerticalGridLinesVisible(true);
chart.setHorizontalGridLinesVisible(true);
chart.setLegendVisible(false);
chart.setCreateSymbols(false); // Can't stop them being orange...
chart.getXAxis().setLabel("Values");
chart.getYAxis().setLabel("Counts");
chart.getYAxis().setTickLabelsVisible(true);
chart.getYAxis().setTickMarkVisible(true);
chart.getXAxis().setTickLabelsVisible(true);
chart.getXAxis().setTickMarkVisible(true);
chart.setAnimated(params.getBooleanParameterValue("animate"));
updateTable(histogram);
currentColumn = columnName;
currentBins = nBins;
currentValues = values;
this.model = model;
} else
panelHistogram.getHistogramData().clear();
}
示例5: 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;
}