本文整理匯總了Java中org.jfree.chart.renderer.xy.XYLineAndShapeRenderer.setBaseToolTipGenerator方法的典型用法代碼示例。如果您正苦於以下問題:Java XYLineAndShapeRenderer.setBaseToolTipGenerator方法的具體用法?Java XYLineAndShapeRenderer.setBaseToolTipGenerator怎麽用?Java XYLineAndShapeRenderer.setBaseToolTipGenerator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
的用法示例。
在下文中一共展示了XYLineAndShapeRenderer.setBaseToolTipGenerator方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: createTimeChart
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入方法依賴的package包/類
private JFreeChart createTimeChart(ReportChart reportChart, ChartValue[] values, boolean displayInline)
{
XYDataset dataset = createTimeDataset(values);
ValueAxis timeAxis = new DateAxis(reportChart.getXAxisLabel());
NumberAxis valueAxis = new NumberAxis(reportChart.getYAxisLabel());
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setBaseToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance());
if (reportChart.getDrillDownReport() != null)
{
renderer.setURLGenerator(new TimeSeriesURLGenerator(
"executeReport.action?displayInline=" + displayInline
+ "&exportType=0&reportId="
+ reportChart.getDrillDownReport().getId(), "series",
ReportChart.DRILLDOWN_PARAMETER));
}
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
plot.setOrientation(PlotOrientation.VERTICAL);
if (reportChart.getPlotOrientation() == ReportChart.HORIZONTAL)
{
plot.setOrientation(PlotOrientation.HORIZONTAL);
}
JFreeChart chart = new JFreeChart(reportChart.getTitle(), JFreeChart.DEFAULT_TITLE_FONT, plot, reportChart.isShowLegend());
return chart;
}
示例5: configureXYLineAndShapeRenderer
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //導入方法依賴的package包/類
private static void configureXYLineAndShapeRenderer(XYLineAndShapeRenderer renderer, ValueSource valueSource,
PlotInstance plotInstance) {
renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
SeriesFormat seriesFormat = valueSource.getSeriesFormat();
DimensionConfig domainConfig = valueSource.getDomainConfig();
DimensionConfig colorDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig(
PlotDimension.COLOR);
DimensionConfig shapeDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig(
PlotDimension.SHAPE);
ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource);
int seriesCount = valueSourceData.getSeriesDataForAllGroupCells().groupCellCount();
// Loop all series and set series format.
// Format based on dimension configs will be set later on in initFormatDelegate().
for (int seriesIdx = 0; seriesIdx < seriesCount; ++seriesIdx) {
// configure linestyle
if (seriesFormat.getLineStyle() == LineStyle.NONE) {
renderer.setSeriesLinesVisible(seriesIdx, false);
} else {
renderer.setSeriesLinesVisible(seriesIdx, true);
renderer.setSeriesStroke(seriesIdx, seriesFormat.getStroke(), false);
}
// configure series shape if necessary
if (!SeriesFormat.calculateIndividualFormatForEachItem(domainConfig, shapeDimensionConfig)) {
if (seriesFormat.getItemShape() != ItemShape.NONE) {
renderer.setSeriesShapesVisible(seriesIdx, true);
renderer.setSeriesShape(seriesIdx, seriesFormat.getItemShape().getShape());
} else {
renderer.setSeriesShapesVisible(seriesIdx, false);
}
}
// configure series color if necessary
if (!SeriesFormat.calculateIndividualFormatForEachItem(domainConfig, colorDimensionConfig)) {
Color itemColor = seriesFormat.getItemColor();
renderer.setSeriesPaint(seriesIdx, itemColor);
renderer.setSeriesFillPaint(seriesIdx, itemColor);
}
renderer.setSeriesOutlinePaint(seriesIdx, PlotConfiguration.DEFAULT_SERIES_OUTLINE_PAINT);
renderer.setUseOutlinePaint(true);
}
}
示例6: 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);
}