本文整理匯總了Java中org.jfree.chart.renderer.category.LineAndShapeRenderer.setSeriesShape方法的典型用法代碼示例。如果您正苦於以下問題:Java LineAndShapeRenderer.setSeriesShape方法的具體用法?Java LineAndShapeRenderer.setSeriesShape怎麽用?Java LineAndShapeRenderer.setSeriesShape使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jfree.chart.renderer.category.LineAndShapeRenderer
的用法示例。
在下文中一共展示了LineAndShapeRenderer.setSeriesShape方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configureLineAndShapeRenderer
import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
private static void configureLineAndShapeRenderer(LineAndShapeRenderer renderer, ValueSource valueSource, PlotInstance plotInstance) {
ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource);
int seriesCount = valueSourceData.getSeriesCount();
SeriesFormat seriesFormat = valueSource.getSeriesFormat();
DimensionConfig domainConfig = valueSource.getDomainConfig();
DimensionConfig colorDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig(PlotDimension.COLOR);
DimensionConfig shapeDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig(PlotDimension.SHAPE);
renderer.setDefaultEntityRadius(4);
// loop all series and set series format
for(int seriesIdx = 0; seriesIdx < seriesCount; ++seriesIdx) {
// configure linestyle
if(seriesFormat.getLineStyle() != LineStyle.NONE) {
renderer.setSeriesLinesVisible(seriesIdx, true);
renderer.setSeriesStroke(seriesIdx, seriesFormat.getStroke(),false);
} else {
renderer.setSeriesLinesVisible(seriesIdx, 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.setSeriesOutlinePaint(seriesIdx, PlotConfiguration.DEFAULT_SERIES_OUTLINE_PAINT);
renderer.setUseOutlinePaint(true);
}
}
示例2: configureLineAndShapeRenderer
import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
private static void configureLineAndShapeRenderer(LineAndShapeRenderer renderer, ValueSource valueSource,
PlotInstance plotInstance) {
ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource);
int seriesCount = valueSourceData.getSeriesCount();
SeriesFormat seriesFormat = valueSource.getSeriesFormat();
DimensionConfig domainConfig = valueSource.getDomainConfig();
DimensionConfig colorDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig(
PlotDimension.COLOR);
DimensionConfig shapeDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig(
PlotDimension.SHAPE);
renderer.setDefaultEntityRadius(4);
// loop all series and set series format
for (int seriesIdx = 0; seriesIdx < seriesCount; ++seriesIdx) {
// configure linestyle
if (seriesFormat.getLineStyle() != LineStyle.NONE) {
renderer.setSeriesLinesVisible(seriesIdx, true);
renderer.setSeriesStroke(seriesIdx, seriesFormat.getStroke(), false);
} else {
renderer.setSeriesLinesVisible(seriesIdx, 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.setSeriesOutlinePaint(seriesIdx, PlotConfiguration.DEFAULT_SERIES_OUTLINE_PAINT);
renderer.setUseOutlinePaint(true);
}
}
示例3: createPlotComponent
import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
private Component createPlotComponent() {
boolean legend = true;
boolean tooltips = false;
boolean urls = false;
chart = ChartFactory.createLineChart(null, null, null,
dataSet, PlotOrientation.VERTICAL, legend, tooltips, urls);
CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.GRAY);
plot.setRangeGridlinesVisible(true);
plot.setDomainGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.WHITE);
plot.setDomainGridlinePaint(Color.WHITE);
NumberAxis axis = (NumberAxis) plot.getRangeAxis();
axis.setAutoRangeIncludesZero(false);
axis.setAutoRangeStickyZero(true);
renderer = plot.getRenderer();
if(renderer instanceof LineAndShapeRenderer) {
LineAndShapeRenderer lasr = (LineAndShapeRenderer) renderer;
lasr.setBaseShapesVisible(true);
lasr.setDrawOutlines(true);
lasr.setUseFillPaint(true);
lasr.setBaseStroke(new BasicStroke(2));
ColorGenerator colors = new DefaultColorGenerator();
int count = dataSet.getRowCount();
int r = 3;
Shape circle = new Ellipse2D.Float(-r, -r, 2*r, 2*r);
for(int i=0; i<count; i++) {
Paint color = colors.nextColor();
lasr.setSeriesPaint(i, color);
lasr.setSeriesFillPaint(i, color);
lasr.setSeriesShape(i, circle);
}
}
return new ChartPanel(chart);
}
示例4: createPlotComponent
import org.jfree.chart.renderer.category.LineAndShapeRenderer; //導入方法依賴的package包/類
private Component createPlotComponent() {
boolean legend = true;
boolean tooltips = false;
boolean urls = false;
chart = ChartFactory.createLineChart(null, null, null,
dataSet, PlotOrientation.VERTICAL, legend, tooltips, urls);
CategoryPlot plot = chart.getCategoryPlot();
plot.setBackgroundPaint(Color.GRAY);
plot.setRangeGridlinesVisible(true);
plot.setDomainGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.WHITE);
plot.setDomainGridlinePaint(Color.WHITE);
NumberAxis axis = (NumberAxis) plot.getRangeAxis();
axis.setAutoRangeIncludesZero(false);
axis.setAutoRangeStickyZero(true);
renderer = plot.getRenderer();
if(renderer instanceof LineAndShapeRenderer) {
LineAndShapeRenderer lasr = (LineAndShapeRenderer) renderer;
lasr.setBaseShapesVisible(true);
lasr.setDrawOutlines(true);
lasr.setUseFillPaint(true);
lasr.setBaseStroke(new BasicStroke(2));
int r = 3;
Shape circle = new Ellipse2D.Float(-r, -r, 2*r, 2*r);
int count = dataSet.getRowCount();
for(int i=0; i<count; i++) {
PlotLabel label = (PlotLabel) dataSet.getRowKey(i);
boolean isLr = label.getId() >= developments;
Color color = isLr? LINK_RATIO : FACTOR;
lasr.setSeriesPaint(i, color);
lasr.setSeriesFillPaint(i, color);
lasr.setSeriesShape(i, circle);
lasr.setSeriesShapesVisible(i, !isLr);
lasr.setSeriesLinesVisible(i, isLr);
}
}
return new ChartPanel(chart);
}