本文整理汇总了Java中javafx.scene.chart.LineChart.setLegendVisible方法的典型用法代码示例。如果您正苦于以下问题:Java LineChart.setLegendVisible方法的具体用法?Java LineChart.setLegendVisible怎么用?Java LineChart.setLegendVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.chart.LineChart
的用法示例。
在下文中一共展示了LineChart.setLegendVisible方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayIndex
import javafx.scene.chart.LineChart; //导入方法依赖的package包/类
private void displayIndex(Map<String, Double> resultIndex, String title, String header) {
BaseDialog dialog = new BaseDialog(title, header);
dialog.getDialogPane().setPrefSize(800, 600);
dialog.getDialogPane().getButtonTypes().addAll(new ButtonType(Configuration.getBundle().getString("ui.actions.stats.close"), ButtonBar.ButtonData.CANCEL_CLOSE));
// draw
final CategoryAxis xAxis = new CategoryAxis();
final NumberAxis yAxis = new NumberAxis();
final LineChart<String,Number> lineChart = new LineChart<>(xAxis, yAxis);
lineChart.setTitle(title);
lineChart.setLegendVisible(false);
xAxis.setLabel(Configuration.getBundle().getString("ui.actions.stats.xaxis"));
yAxis.setLabel(Configuration.getBundle().getString("ui.actions.readable.yaxis"));
XYChart.Series<String, Number> series = new XYChart.Series();
for(Map.Entry<String, Double> st:resultIndex.entrySet()) {
series.getData().add(new XYChart.Data(st.getKey(), st.getValue()));
}
lineChart.getData().addAll(series);
dialog.getDialogPane().setContent(lineChart);
dialog.setResizable(true);
dialog.showAndWait();
}
示例2: build
import javafx.scene.chart.LineChart; //导入方法依赖的package包/类
@Override
public LineChart<Number, Number> build()
{
final NumberAxis xAxis = new NumberAxis();
xAxis.setLabel("MAPQ");
final NumberAxis yAxis = new NumberAxis();
yAxis.setLabel("Count");
final XYChart.Series<Number,Number> serie = new XYChart.Series<Number,Number>();
serie.setName(xAxis.getLabel());
for(int g=0;g<=100;++g)
{
serie.getData().add(new XYChart.Data<Number,Number>(
g,this.mapq2count.count(g))
);
}
final LineChart<Number, Number> sbc =
new LineChart<Number, Number>(xAxis, yAxis);
sbc.setTitle(this.getName());
sbc.getData().add(serie);
sbc.setCreateSymbols(false);
sbc.setLegendVisible(false);
return sbc;
}
示例3: build
import javafx.scene.chart.LineChart; //导入方法依赖的package包/类
@Override
public Chart build() {
final NumberAxis xAxis = new NumberAxis();
xAxis.setLabel("QUAL");
final NumberAxis yAxis = new NumberAxis();
yAxis.setLabel("Count");
final XYChart.Series<Number,Number> serie = new XYChart.Series<Number,Number>();
serie.setName(xAxis.getLabel());
for(final Integer i: new TreeSet<>(this.qual2count.keySet()))
{
serie.getData().add(new XYChart.Data<Number,Number>(
i,this.qual2count.count(i))
);
}
final LineChart<Number, Number> sbc =
new LineChart<Number, Number>(xAxis, yAxis);
sbc.setTitle(this.getName());
sbc.getData().add(serie);
sbc.setCreateSymbols(false);
sbc.setLegendVisible(false);
return sbc;
}
示例4: createChart
import javafx.scene.chart.LineChart; //导入方法依赖的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;
}
示例5: build
import javafx.scene.chart.LineChart; //导入方法依赖的package包/类
@Override
public LineChart<Number, Number> build()
{
final NumberAxis xAxis = new NumberAxis();
xAxis.setLabel("%GC");
final NumberAxis yAxis = new NumberAxis();
yAxis.setLabel("Count");
final XYChart.Series<Number,Number> serie = new XYChart.Series<Number,Number>();
serie.setName("QC");
for(int g=0;g<=100;++g)
{
serie.getData().add(new XYChart.Data<Number,Number>(
g,this.gcPercent2count.count(g))
);
}
final LineChart<Number, Number> sbc =
new LineChart<Number, Number>(xAxis, yAxis);
sbc.setTitle("Percentage GC");
sbc.getData().add(serie);
sbc.setCreateSymbols(false);
sbc.setLegendVisible(false);
return sbc;
}
示例6: build
import javafx.scene.chart.LineChart; //导入方法依赖的package包/类
@Override
public LineChart<Number, Number> build()
{
final NumberAxis xAxis = new NumberAxis();
xAxis.setLabel("Quality");
final NumberAxis yAxis = new NumberAxis();
yAxis.setLabel("Count");
final XYChart.Series<Number,Number> serie = new XYChart.Series<Number,Number>();
serie.setName(xAxis.getLabel());
for(int g=0;g<=100;++g)
{
serie.getData().add(new XYChart.Data<Number,Number>(
g,this.quality2count.count(g))
);
}
final LineChart<Number, Number> sbc =
new LineChart<Number, Number>(xAxis, yAxis);
sbc.setTitle(this.getName());
sbc.getData().add(serie);
sbc.setCreateSymbols(false);
sbc.setLegendVisible(false);
return sbc;
}
示例7: createLineChart
import javafx.scene.chart.LineChart; //导入方法依赖的package包/类
/**
* Creates a line chart
*
* @return {@link LineChart}
*/
private LineChart<Number, Number> createLineChart() {
NumberAxis modeAxis = new NumberAxis();
modeAxis.setLabel("Mode");
NumberAxis timeAxis = new NumberAxis();
timeAxis.setLabel("Time");
LineChart<Number, Number> chart = new LineChart<Number, Number>(modeAxis, timeAxis);
chart.setMinHeight(chartHeight);
chart.setTitle("History");
chart.setLegendVisible(false);
chart.getStyleClass().add("statistic-chart");
chart.getStyleClass().add("statistic-chart-line");
XYChart.Series<Number, Number> trackingSeriesRed = new XYChart.Series<Number, Number>();
XYChart.Series<Number, Number> trackingSeriesGreen = new XYChart.Series<Number, Number>();
XYChart.Series<Number, Number> trackingSeriesBlue = new XYChart.Series<Number, Number>();
for(int i = 0; i < trackingSession.getData().size(); i++) {
TrackingData trackingData = trackingSession.getData().get(i);
XYChart.Data<Number, Number> data = new XYChart.Data<Number, Number>(i+1, trackingData.getDuration()/1000.0);
switch(trackingData.getMode()) {
case RED:
trackingSeriesRed.getData().add(data);
break;
case GREEN:
trackingSeriesGreen.getData().add(data);
break;
case BLUE:
trackingSeriesBlue.getData().add(data);
break;
}
}
chart.getData().add(trackingSeriesRed);
chart.getData().add(trackingSeriesGreen);
chart.getData().add(trackingSeriesBlue);
return chart;
}
示例8: call
import javafx.scene.chart.LineChart; //导入方法依赖的package包/类
@Override
public TreeTableCell<FeatureTableRow, Object> call(TreeTableColumn<FeatureTableRow, Object> p) {
return new TreeTableCell<FeatureTableRow, Object>() {
@Override
public void updateItem(Object object, boolean empty) {
super.updateItem(object, empty);
setStyle(
"-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;");
if (object == null) {
setText(null);
} else {
Chromatogram chromatogram = (Chromatogram) object;
ChromatographyInfo[] chromatographyInfoValues = chromatogram.getRetentionTimes();
float[] intensityValues = chromatogram.getIntensityValues();
int numOfDataPoints = chromatogram.getNumberOfDataPoints();
// x-axis
NumberAxis xAxis = new NumberAxis();
xAxis.setTickLabelsVisible(false);
xAxis.setOpacity(0);
xAxis.setAutoRanging(false);
xAxis.setLowerBound(chromatogram.getRtRange().lowerEndpoint().getRetentionTime());
xAxis.setUpperBound(chromatogram.getRtRange().upperEndpoint().getRetentionTime());
// y-axis
NumberAxis yAxis = new NumberAxis();
yAxis.setTickLabelsVisible(false);
yAxis.setOpacity(0);
// Chart line
final LineChart<Number, Number> lineChart = new LineChart<Number, Number>(xAxis, yAxis);
XYChart.Series series = new XYChart.Series();
for (int i = 1; i < numOfDataPoints; i++) {
series.getData().add(new XYChart.Data(chromatographyInfoValues[i].getRetentionTime(),
intensityValues[i]));
}
// Chart
lineChart.getData().addAll(series);
lineChart.setLegendVisible(false);
lineChart.setCreateSymbols(false);
lineChart.setMinSize(0, 0);
lineChart.setPrefHeight(75);
lineChart.setPrefWidth(100);
setGraphic(lineChart);
}
}
};
}
示例9: buildLineChart
import javafx.scene.chart.LineChart; //导入方法依赖的package包/类
public static LineChart<String, Number> buildLineChart(Stats stats, Scene scene) {
final CategoryAxis xAxis = new CategoryAxis();
final NumberAxis yAxis = new NumberAxis();
LineChart<String, Number> lineChart = new LineChart<String, Number>(xAxis, yAxis);
// lineChart.setTitle("Réaction");
// defining a series
XYChart.Series series = new XYChart.Series();
// series.setName("Temps de réaction");
XYChart.Series average = new XYChart.Series();
XYChart.Series sdp = new XYChart.Series();
XYChart.Series sdm = new XYChart.Series();
// populating the series with data
ArrayList<Integer> shoots = null;
if (stats instanceof BubblesGamesStats) {
shoots = stats.getSortedLengthBetweenGoals();
} else {
shoots = stats.getLengthBetweenGoals();
}
double sd = stats.getSD();
int i = 0;
average.getData().add(new XYChart.Data(0 + "", stats.getAverageLength()));
sdp.getData().add(new XYChart.Data(0 + "", stats.getAverageLength() + sd));
sdm.getData().add(new XYChart.Data(0 + "", stats.getAverageLength() - sd));
for (Integer I : shoots) {
i++;
series.getData().add(new XYChart.Data(i + "", I.intValue()));
average.getData().add(new XYChart.Data(i + "", stats.getAverageLength()));
sdp.getData().add(new XYChart.Data(i + "", stats.getAverageLength() + sd));
sdm.getData().add(new XYChart.Data(i + "", stats.getAverageLength() - sd));
}
i++;
average.getData().add(new XYChart.Data(i + "", stats.getAverageLength()));
sdp.getData().add(new XYChart.Data(i + "", stats.getAverageLength() + sd));
sdm.getData().add(new XYChart.Data(i + "", stats.getAverageLength() - sd));
lineChart.setCreateSymbols(false);
lineChart.getData().add(average);
lineChart.getData().add(sdp);
lineChart.getData().add(sdm);
lineChart.getData().add(series);
series.getNode().setStyle("-fx-stroke-width: 3; -fx-stroke: red; -fx-stroke-dash-offset:5;");
average.getNode().setStyle("-fx-stroke-width: 1; -fx-stroke: lightgreen;");
sdp.getNode().setStyle("-fx-stroke-width: 1; -fx-stroke: grey;");
sdm.getNode().setStyle("-fx-stroke-width: 1; -fx-stroke: grey;");
EventHandler<Event> openLineChartEvent = createZoomInLineChartEventHandler(lineChart, scene);
lineChart.addEventHandler(MouseEvent.MOUSE_CLICKED, openLineChartEvent);
lineChart.setLegendVisible(false);
lineChart.setPrefWidth(scene.getWidth() * 0.4);
lineChart.setPrefHeight(scene.getHeight() * 0.4);
return lineChart;
}