本文整理汇总了Java中org.jfree.chart.renderer.xy.XYLineAndShapeRenderer.setBaseItemLabelGenerator方法的典型用法代码示例。如果您正苦于以下问题:Java XYLineAndShapeRenderer.setBaseItemLabelGenerator方法的具体用法?Java XYLineAndShapeRenderer.setBaseItemLabelGenerator怎么用?Java XYLineAndShapeRenderer.setBaseItemLabelGenerator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
的用法示例。
在下文中一共展示了XYLineAndShapeRenderer.setBaseItemLabelGenerator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setTimeSeriesRender
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public static void setTimeSeriesRender(Plot plot, boolean isShowData, boolean isShapesVisible) {
XYPlot xyplot = (XYPlot) plot;
xyplot.setNoDataMessage(NO_DATA_MSG);
xyplot.setInsets(new RectangleInsets(10, 10, 5, 10));
XYLineAndShapeRenderer xyRenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
xyRenderer.setBaseShapesVisible(false);
if (isShowData) {
xyRenderer.setBaseItemLabelsVisible(true);
xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
xyRenderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BOTTOM_CENTER));
}
xyRenderer.setBaseShapesVisible(isShapesVisible);
DateAxis domainAxis = (DateAxis) xyplot.getDomainAxis();
domainAxis.setAutoTickUnitSelection(false);
DateTickUnit dateTickUnit = new DateTickUnit(DateTickUnitType.YEAR, 1, new SimpleDateFormat("yyyy-MM"));
domainAxis.setTickUnit(dateTickUnit);
StandardXYToolTipGenerator xyTooltipGenerator = new StandardXYToolTipGenerator("{1}:{2}", new SimpleDateFormat("yyyy-MM-dd"), new DecimalFormat("0"));
xyRenderer.setBaseToolTipGenerator(xyTooltipGenerator);
setXY_XAixs(xyplot);
setXY_YAixs(xyplot);
}
示例2: setupChart
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
private void setupChart(String pInitialId, XYDataset pInitialDataset) {
chart = ChartFactory.createTimeSeriesChart(
"Spielerstatistiken", // title
"Zeiten", // x-axis label
pInitialId, // y-axis label
pInitialDataset, // data
jShowLegend.isSelected(), // create legend?
true, // generate tooltips?
false // generate URLs?
);
chart.setBackgroundPaint(Constants.DS_BACK);
XYPlot plot = (XYPlot) chart.getPlot();
setupPlotDrawing(plot);
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
for (int i = 0; i < plot.getSeriesCount(); i++) {
renderer.setSeriesLinesVisible(i, jShowLines.isSelected());
renderer.setSeriesShapesVisible(i, jShowDataPoints.isSelected());
plot.setRenderer(i, renderer);
}
renderer.setBaseItemLabelsVisible(jShowItemValues.isSelected());
renderer.setBaseItemLabelGenerator(new org.jfree.chart.labels.StandardXYItemLabelGenerator());
renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"), NumberFormat.getInstance()));
int lastDataset = plot.getDatasetCount() - 1;
if (lastDataset > 0) {
plot.getRangeAxis().setAxisLinePaint(plot.getLegendItems().get(lastDataset).getLinePaint());
plot.getRangeAxis().setLabelPaint(plot.getLegendItems().get(lastDataset).getLinePaint());
plot.getRangeAxis().setTickLabelPaint(plot.getLegendItems().get(lastDataset).getLinePaint());
plot.getRangeAxis().setTickMarkPaint(plot.getLegendItems().get(lastDataset).getLinePaint());
}
NumberFormat nf = NumberFormat.getInstance();
nf.setMinimumFractionDigits(0);
nf.setMaximumFractionDigits(0);
NumberAxis na = ((NumberAxis) plot.getRangeAxis());
if (na != null) {
na.setNumberFormatOverride(nf);
}
}
示例3: addDataset
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
private void addDataset(String pId, XYDataset pDataset) {
if (chart == null) {
setupChart(pId, pDataset);
} else {
XYPlot plot = (XYPlot) chart.getPlot();
plot.setDataset(plot.getDatasetCount(), pDataset);
NumberAxis axis = new NumberAxis(pId);
NumberFormat nf = NumberFormat.getInstance();
nf.setMinimumFractionDigits(0);
nf.setMaximumFractionDigits(0);
axis.setNumberFormatOverride(nf);
plot.setRangeAxis(plot.getDatasetCount() - 1, axis);
plot.setRangeAxisLocation(plot.getDatasetCount() - 1, AxisLocation.TOP_OR_LEFT);
plot.mapDatasetToRangeAxis(plot.getDatasetCount() - 1, plot.getDatasetCount() - 1);
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setSeriesLinesVisible(0, jShowLines.isSelected());
renderer.setSeriesShapesVisible(0, jShowDataPoints.isSelected());
plot.setRenderer(plot.getDatasetCount() - 1, renderer);
renderer.setBaseItemLabelsVisible(jShowItemValues.isSelected());
renderer.setBaseItemLabelGenerator(new org.jfree.chart.labels.StandardXYItemLabelGenerator());
renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"), NumberFormat.getInstance()));
axis.setAxisLinePaint(plot.getLegendItems().get(plot.getDatasetCount() - 1).getLinePaint());
axis.setLabelPaint(plot.getLegendItems().get(plot.getDatasetCount() - 1).getLinePaint());
axis.setTickLabelPaint(plot.getLegendItems().get(plot.getDatasetCount() - 1).getLinePaint());
axis.setTickMarkPaint(plot.getLegendItems().get(plot.getDatasetCount() - 1).getLinePaint());
}
}
示例4: configureRenderer
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
private void configureRenderer(ChromatogramPlotDataSet dataset, int datasetIndex) {
final XYPlot plot = chartNode.getChart().getXYPlot();
XYLineAndShapeRenderer newRenderer = new XYLineAndShapeRenderer();
final int lineThickness = dataset.getLineThickness();
newRenderer.setBaseShape(new Ellipse2D.Double(-2 * lineThickness, -2 * lineThickness,
4 * lineThickness + 1, 4 * lineThickness + 1));
newRenderer.setBaseShapesFilled(true);
newRenderer.setBaseShapesVisible(dataset.getShowDataPoints());
newRenderer.setDrawOutlines(false);
Stroke baseStroke = new BasicStroke(lineThickness);
newRenderer.setBaseStroke(baseStroke);
// Set tooltips for legend
newRenderer.setLegendItemToolTipGenerator((ds, series) -> {
if (ds instanceof ChromatogramPlotDataSet) {
return ((ChromatogramPlotDataSet) ds).getDescription();
} else
return null;
});
// Set color
Color baseColor = dataset.getColor();
newRenderer.setBasePaint(JavaFXUtil.convertColorToAWT(baseColor));
// Set label generator
XYItemLabelGenerator intelligentLabelGenerator =
new IntelligentItemLabelGenerator(chartNode, 100, dataset);
newRenderer.setBaseItemLabelGenerator(intelligentLabelGenerator);
newRenderer.setBaseItemLabelPaint(JavaFXUtil.convertColorToAWT(labelsColor));
newRenderer.setBaseItemLabelsVisible(itemLabelsVisible.get());
newRenderer.setBaseItemLabelsVisible(true);
// Set tooltip generator
newRenderer.setBaseToolTipGenerator(dataset);
plot.setRenderer(datasetIndex, newRenderer);
}