当前位置: 首页>>代码示例>>Java>>正文


Java LegendItem类代码示例

本文整理汇总了Java中com.sun.javafx.charts.Legend.LegendItem的典型用法代码示例。如果您正苦于以下问题:Java LegendItem类的具体用法?Java LegendItem怎么用?Java LegendItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LegendItem类属于com.sun.javafx.charts.Legend包,在下文中一共展示了LegendItem类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setLegendTextFill

import com.sun.javafx.charts.Legend.LegendItem; //导入依赖的package包/类
public void setLegendTextFill(final Series<X, Y> SERIES, final Paint FILL) {
    if (getData().isEmpty()) { return; }
    if (!getData().contains(SERIES)) { return; }

    int seriesIndex = getData().indexOf(SERIES);
    if (seriesIndex == -1) { return; }

    Legend legend = (Legend) getLegend();
    if (null == legend) { return; }

    LegendItem item = legend.getItems().get(seriesIndex);
    if (null == item) { return; }

    String itemText = item.getText();
    for (Node node : legend.lookupAll(".chart-legend-item")) {
        if (node instanceof Label) {
            Label label = (Label) node;
            if (label.getText().equals(itemText)) { label.setTextFill(FILL); }
        }
    }
}
 
开发者ID:HanSolo,项目名称:smoothcharts,代码行数:22,代码来源:SmoothedChart.java

示例2: setLegendSymbolFill

import com.sun.javafx.charts.Legend.LegendItem; //导入依赖的package包/类
public void setLegendSymbolFill(final Series<X, Y> SERIES, final Paint LEGEND_SYMBOL_FILL) {
    if (getData().isEmpty()) { return; }
    if (!getData().contains(SERIES)) { return; }

    int seriesIndex = getData().indexOf(SERIES);
    if (seriesIndex == -1) { return; }

    Legend legend = (Legend) getLegend();
    if (null == legend) { return; }

    LegendItem item = legend.getItems().get(seriesIndex);
    if (null == item) { return; }

    Region symbol = (Region) item.getSymbol();
    if (null == symbol) { return; }

    symbol.setBackground(new Background(new BackgroundFill(LEGEND_SYMBOL_FILL, new CornerRadii(6), Insets.EMPTY)));
}
 
开发者ID:HanSolo,项目名称:smoothcharts,代码行数:19,代码来源:SmoothedChart.java

示例3: updateLegend

import com.sun.javafx.charts.Legend.LegendItem; //导入依赖的package包/类
/**
 * This is called whenever a series is added or removed and the legend needs to
 * be updated
 */
@Override
protected void updateLegend() {
	legend.getItems().clear();
	if (getData() != null) {
		for (int seriesIndex = 0; seriesIndex < getData().size(); seriesIndex++) {
			MultiAxisChart.Series<X, Y> series = getData().get(seriesIndex);
			LegendItem legenditem = new LegendItem(series.getName());
			legenditem.getSymbol().getStyleClass().addAll("chart-area-symbol", "series" + seriesIndex,
					"area-legend-symbol", series.defaultColorStyleClass);
			legend.getItems().add(legenditem);
		}
	}
	if (legend.getItems().size() > 0) {
		if (getLegend() == null) {
			setLegend(legend);
		}
	} else {
		setLegend(null);
	}
}
 
开发者ID:JKostikiadis,项目名称:MultiAxisCharts,代码行数:25,代码来源:MultiAxisAreaChart.java

示例4: updateLegend

import com.sun.javafx.charts.Legend.LegendItem; //导入依赖的package包/类
/**
 * This is called whenever a series is added or removed and the legend needs to
 * be updated
 */
@Override
protected void updateLegend() {
	legend.getItems().clear();
	if (getData() != null) {
		for (int seriesIndex = 0; seriesIndex < getData().size(); seriesIndex++) {
			Series<X, Y> series = getData().get(seriesIndex);
			LegendItem legenditem = new LegendItem(series.getName());
			legenditem.getSymbol().getStyleClass().addAll("chart-line-symbol", "series" + seriesIndex,
					series.defaultColorStyleClass);
			legend.getItems().add(legenditem);
		}
	}
	if (legend.getItems().size() > 0) {
		if (getLegend() == null) {
			setLegend(legend);
		}
	} else {
		setLegend(null);
	}
}
 
开发者ID:JKostikiadis,项目名称:MultiAxisCharts,代码行数:25,代码来源:MultiAxisLineChart.java

示例5: updateLegend

import com.sun.javafx.charts.Legend.LegendItem; //导入依赖的package包/类
/**
 * This is called whenever a series is added or removed and the legend needs to
 * be updated
 */
@Override
protected void updateLegend() {
	legend.getItems().clear();
	if (getData() != null) {
		for (int seriesIndex = 0; seriesIndex < getData().size(); seriesIndex++) {
			Series<X, Y> series = getData().get(seriesIndex);
			LegendItem legenditem = new LegendItem(series.getName());
			legenditem.getSymbol().getStyleClass().addAll("chart-bar", "series" + seriesIndex, "bar-legend-symbol",
					series.defaultColorStyleClass);
			legend.getItems().add(legenditem);
		}
	}
	if (legend.getItems().size() > 0) {
		if (getLegend() == null) {
			setLegend(legend);
		}
	} else {
		setLegend(null);
	}
}
 
开发者ID:JKostikiadis,项目名称:MultiAxisCharts,代码行数:25,代码来源:MultiAxisBarChart.java

示例6: updateLegend

import com.sun.javafx.charts.Legend.LegendItem; //导入依赖的package包/类
/**
 * This is called whenever a series is added or removed and the legend needs to
 * be updated
 */
@Override
protected void updateLegend() {
	legend.getItems().clear();
	if (getData() != null) {
		for (int seriesIndex = 0; seriesIndex < getData().size(); seriesIndex++) {
			MultiAxisChart.Series<X, Y> series = getData().get(seriesIndex);
			LegendItem legenditem = new LegendItem(series.getName());
			if (!series.getData().isEmpty() && series.getData().get(0).getNode() != null) {
				legenditem.getSymbol().getStyleClass().addAll(series.getData().get(0).getNode().getStyleClass());
			}
			legend.getItems().add(legenditem);
		}
	}
	if (legend.getItems().size() > 0) {
		if (getLegend() == null) {
			setLegend(legend);
		}
	} else {
		setLegend(null);
	}
}
 
开发者ID:JKostikiadis,项目名称:MultiAxisCharts,代码行数:26,代码来源:MultiAxisScatterChart.java

示例7: getLegends

import com.sun.javafx.charts.Legend.LegendItem; //导入依赖的package包/类
protected ArrayList<NamedLegend> getLegends() {
    ArrayList<NamedLegend> legends  = new ArrayList<NamedLegend>();
    Boolean vertical[] = {false, true};
    int items_num[] = {0, 1, 5, 100};
    for (int i = 0; i < vertical.length; i++) {
        for (int j = 0; j < items_num.length; j++) {
            NamedLegend legend = new NamedLegend(vertical[i] ? "vert" : "false" + " " + items_num[j]);
            for (int k = 0; k < items_num[j]; k++) {
                legend.getItems().add(new LegendItem("Item " + k));
            }
            legends.add(legend);
        }
    }
    return legends;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:16,代码来源:ChartBaseApp.java


注:本文中的com.sun.javafx.charts.Legend.LegendItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。