本文整理汇总了Java中org.jfree.chart.renderer.xy.AbstractXYItemRenderer类的典型用法代码示例。如果您正苦于以下问题:Java AbstractXYItemRenderer类的具体用法?Java AbstractXYItemRenderer怎么用?Java AbstractXYItemRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractXYItemRenderer类属于org.jfree.chart.renderer.xy包,在下文中一共展示了AbstractXYItemRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getItemRenderer
import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; //导入依赖的package包/类
@Override
public AbstractXYItemRenderer getItemRenderer(boolean nominal, int size, double minColor, double maxColor) {
XYBlockRenderer renderer = new XYBlockRenderer();
renderer.setPaintScale(new BlockPaintScale(minColor, maxColor));
renderer.setBlockAnchor(RectangleAnchor.CENTER);
// if Block dimension is increased (e.g 1.2x1.2), the grid effect gets bigger
// so it could be that blocks are overlapping a little
// but if Block dimension is decreased (e.g. 0.9x0.9), each rectangle seems to have
// a less-transparent border (you have to zoom-in to notice), and that could be the cause of
// the grid effect.
// renderer.setBlockHeight(1.0);
// renderer.setBlockWidth(1.0);
return renderer;
}
示例2: resetUI
import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; //导入依赖的package包/类
/**
* Resets the display.
*/
@Override
void resetUI() {
super.resetUI();
XYPlot xyPlot = mChart.getXYPlot();
AbstractXYItemRenderer br = new XYBarRenderer();
mDatasetsSyncHist = new TimePeriodValues[NUM_AUTHS+1];
@SuppressWarnings("unchecked")
Map<SimpleTimePeriod, Integer> mTimePeriodMapTmp[] = new HashMap[NUM_AUTHS + 1];
mTimePeriodMap = mTimePeriodMapTmp;
TimePeriodValuesCollection tpvc = new TimePeriodValuesCollection();
xyPlot.setDataset(tpvc);
xyPlot.setRenderer(br);
for (int i = 0; i < NUM_AUTHS + 1; i++) {
br.setSeriesPaint(i, AUTH_COLORS[i]);
mDatasetsSyncHist[i] = new TimePeriodValues(AUTH_NAMES[i]);
tpvc.addSeries(mDatasetsSyncHist[i]);
mTimePeriodMap[i] = new HashMap<SimpleTimePeriod, Integer>();
}
}
示例3: buildDataSet
import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; //导入依赖的package包/类
private TimeSeriesCollection buildDataSet(SortedMap<DataSetBarDescr, SortedMap<Date,Double>> series, AbstractXYItemRenderer renderer) {
TimeSeriesCollection dataset = new TimeSeriesCollection();
int seriesIdx = 0;
for (DataSetBarDescr serieDef : series.keySet()) {
TimeSeries timeSerie = new TimeSeries(serieDef.getSerieName());
SortedMap<Date, Double> serie = series.get(serieDef);
for (Date date : serie.keySet()) {
RegularTimePeriod period = new Day(date);
Number value = serie.get(date);
TimeSeriesDataItem item = new TimeSeriesDataItem(period, value);
timeSerie.add(item, false);
}
dataset.addSeries(timeSerie);
renderer.setSeriesPaint(seriesIdx, serieDef.getSerieColor());
renderer.setSeriesFillPaint(seriesIdx, serieDef.getSerieColor());
renderer.setSeriesStroke(seriesIdx, new BasicStroke(serieDef.getSerieStrokeSize()));
seriesIdx++;
}
return dataset;
}
示例4: testFindDomainBounds
import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; //导入依赖的package包/类
/**
* Some checks for the findDomainBounds() method.
*/
public void testFindDomainBounds() {
AbstractXYItemRenderer renderer = new StandardXYItemRenderer();
// check the bounds of a simple dataset
XYDataset dataset = createDataset1();
Range r = renderer.findDomainBounds(dataset);
assertEquals(1.0, r.getLowerBound(), EPSILON);
assertEquals(3.0, r.getUpperBound(), EPSILON);
// check that a null dataset returns null bounds
assertTrue(renderer.findDomainBounds(null) == null);
}
示例5: drawZeroDomainBaseline
import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; //导入依赖的package包/类
/**
* Draws a base line across the chart at value zero on the domain axis.
*
* @param g2 the graphics device.
* @param area the data area.
*
* @see #setDomainZeroBaselineVisible(boolean)
*
* @since 1.0.5
*/
protected void drawZeroDomainBaseline(Graphics2D g2, Rectangle2D area) {
if (isDomainZeroBaselineVisible()) {
XYItemRenderer r = getRenderer();
// FIXME: the renderer interface doesn't have the drawDomainLine()
// method, so we have to rely on the renderer being a subclass of
// AbstractXYItemRenderer (which is lame)
if (r instanceof AbstractXYItemRenderer) {
AbstractXYItemRenderer renderer = (AbstractXYItemRenderer) r;
renderer.drawDomainLine(g2, this, getDomainAxis(), area, 0.0,
this.domainZeroBaselinePaint,
this.domainZeroBaselineStroke);
}
}
}
示例6: drawDomainGridlines
import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; //导入依赖的package包/类
/**
* Draws the gridlines for the plot, if they are visible.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param ticks the ticks.
*
* @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
*/
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea,
List ticks) {
// no renderer, no gridlines...
if (getRenderer() == null) {
return;
}
// draw the domain grid lines, if any...
if (isDomainGridlinesVisible() || isDomainMinorGridlinesVisible()) {
Stroke gridStroke = null;
Paint gridPaint = null;
Iterator iterator = ticks.iterator();
boolean paintLine;
while (iterator.hasNext()) {
paintLine = false;
ValueTick tick = (ValueTick) iterator.next();
if ((tick.getTickType() == TickType.MINOR)
&& isDomainMinorGridlinesVisible()) {
gridStroke = getDomainMinorGridlineStroke();
gridPaint = getDomainMinorGridlinePaint();
paintLine = true;
} else if ((tick.getTickType() == TickType.MAJOR)
&& isDomainGridlinesVisible()) {
gridStroke = getDomainGridlineStroke();
gridPaint = getDomainGridlinePaint();
paintLine = true;
}
XYItemRenderer r = getRenderer();
if ((r instanceof AbstractXYItemRenderer) && paintLine) {
((AbstractXYItemRenderer) r).drawDomainLine(g2, this,
getDomainAxis(), dataArea, tick.getValue(),
gridPaint, gridStroke);
}
}
}
}
示例7: drawZeroDomainBaseline
import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; //导入依赖的package包/类
/**
* Draws a base line across the chart at value zero on the domain axis.
*
* @param g2 the graphics device.
* @param area the data area.
*
* @see #setDomainZeroBaselineVisible(boolean)
*
* @since 1.0.5
*/
protected void drawZeroDomainBaseline(Graphics2D g2, Rectangle2D area) {
if (isDomainZeroBaselineVisible()) {
XYItemRenderer r = getRenderer();
// FIXME: the renderer interface doesn't have the drawDomainLine()
// method, so we have to rely on the renderer being a subclass of
// AbstractXYItemRenderer (which is lame)
if (r instanceof AbstractXYItemRenderer) {
AbstractXYItemRenderer renderer = (AbstractXYItemRenderer) r;
renderer.drawDomainLine(g2, this, getDomainAxis(), area, 0.0,
this.domainZeroBaselinePaint,
this.domainZeroBaselineStroke);
}
}
}
示例8: drawDomainGridlines
import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; //导入依赖的package包/类
/**
* Draws the gridlines for the plot, if they are visible.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param ticks the ticks.
*
* @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
*/
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea,
List ticks) {
// no renderer, no gridlines...
if (getRenderer() == null) {
return;
}
// draw the domain grid lines, if any...
if (isDomainGridlinesVisible() || isDomainMinorGridlinesVisible()) {
Stroke gridStroke = null;
Paint gridPaint = null;
Iterator iterator = ticks.iterator();
boolean paintLine = false;
while (iterator.hasNext()) {
paintLine = false;
ValueTick tick = (ValueTick) iterator.next();
if ((tick.getTickType() == TickType.MINOR) && isDomainMinorGridlinesVisible()){
gridStroke = getDomainMinorGridlineStroke();
gridPaint = getDomainMinorGridlinePaint();
paintLine = true;
}
else if ((tick.getTickType() == TickType.MAJOR) && isDomainGridlinesVisible()){
gridStroke = getDomainGridlineStroke();
gridPaint = getDomainGridlinePaint();
paintLine = true;
}
XYItemRenderer r = getRenderer();
if ((r instanceof AbstractXYItemRenderer) && paintLine) {
((AbstractXYItemRenderer) r).drawDomainLine(g2, this,
getDomainAxis(), dataArea, tick.getValue(),
gridPaint, gridStroke);
}
}
}
}
示例9: resetRenderer
import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; //导入依赖的package包/类
protected void resetRenderer(final IScope scope, final String serieid) {
final AbstractXYItemRenderer newr = (AbstractXYItemRenderer) this.getOrCreateRenderer(scope, serieid);
// newr.setSeriesStroke(0, new BasicStroke(0));
newr.setBaseCreateEntities(true);
final ChartDataSeries myserie = this.getChartdataset().getDataSeries(scope, serieid);
if (newr instanceof XYLineAndShapeRenderer) {
((XYLineAndShapeRenderer) newr).setSeriesLinesVisible(0, myserie.getMysource().showLine);
((XYLineAndShapeRenderer) newr).setSeriesShapesFilled(0, myserie.getMysource().fillMarker);
((XYLineAndShapeRenderer) newr).setSeriesShapesVisible(0, myserie.getMysource().useMarker);
}
if (newr instanceof XYShapeRenderer) {
if (!myserie.getMysource().fillMarker) {
((XYShapeRenderer) newr).setUseFillPaint(false);
// ((XYShapeRenderer) newr).setDrawOutlines(true);
}
}
if (myserie.getMycolor() != null) {
newr.setSeriesPaint(0, myserie.getMycolor());
}
newr.setSeriesStroke(0, new BasicStroke((float) myserie.getLineThickness()));
if (newr instanceof myXYErrorRenderer) {
((myXYErrorRenderer) newr).setDrawYError(false);
((myXYErrorRenderer) newr).setDrawXError(false);
if (myserie.isUseYErrValues())
((myXYErrorRenderer) newr).setDrawYError(true);
if (myserie.isUseXErrValues())
((myXYErrorRenderer) newr).setDrawXError(true);
if (myserie.getMysource().isUseSize())
((myXYErrorRenderer) newr).setUseSize(scope, true);
}
if (myserie.getMysource().getUniqueMarkerName() != null)
setSerieMarkerShape(scope, myserie.getName(), myserie.getMysource().getUniqueMarkerName());
}
示例10: setUseSize
import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; //导入依赖的package包/类
@Override
public void setUseSize(final IScope scope, final String name, final boolean b) {
// TODO Auto-generated method stub
final AbstractXYItemRenderer newr = (AbstractXYItemRenderer) this.getOrCreateRenderer(scope, name);
if (newr instanceof myXYErrorRenderer) {
((myXYErrorRenderer) newr).setUseSize(scope, b);
}
}
示例11: testFindDomainBounds
import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; //导入依赖的package包/类
/**
* Some checks for the findDomainBounds() method.
*/
public void testFindDomainBounds() {
AbstractXYItemRenderer renderer = new StandardXYItemRenderer();
// check the bounds of a simple dataset
XYDataset dataset = createDataset1();
Range r = renderer.findDomainBounds(dataset);
assertEquals(1.0, r.getLowerBound(), EPSILON);
assertEquals(3.0, r.getUpperBound(), EPSILON);
// check that a null dataset returns null bounds
assertTrue(renderer.findDomainBounds(null) == null);
}
示例12: drawDomainGridlines
import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; //导入依赖的package包/类
/**
* Draws the gridlines for the plot, if they are visible.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param ticks the ticks.
*
* @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
*/
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea,
List ticks) {
// no renderer, no gridlines...
if (getRenderer() == null) {
return;
}
// draw the domain grid lines, if any...
if (isDomainGridlinesVisible() || isDomainMinorGridlinesVisible()) {
Stroke gridStroke = null;
Paint gridPaint = null;
Iterator iterator = ticks.iterator();
boolean paintLine = false;
while (iterator.hasNext()) {
paintLine = false;
ValueTick tick = (ValueTick) iterator.next();
if ((tick.getTickType() == TickType.MINOR)
&& isDomainMinorGridlinesVisible()) {
gridStroke = getDomainMinorGridlineStroke();
gridPaint = getDomainMinorGridlinePaint();
paintLine = true;
}
else if ((tick.getTickType() == TickType.MAJOR)
&& isDomainGridlinesVisible()) {
gridStroke = getDomainGridlineStroke();
gridPaint = getDomainGridlinePaint();
paintLine = true;
}
XYItemRenderer r = getRenderer();
if ((r instanceof AbstractXYItemRenderer) && paintLine) {
((AbstractXYItemRenderer) r).drawDomainLine(g2, this,
getDomainAxis(), dataArea, tick.getValue(),
gridPaint, gridStroke);
}
}
}
}
示例13: drawDomainGridlines
import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; //导入依赖的package包/类
/**
* Draws the gridlines for the plot, if they are visible.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param ticks the ticks.
*
* @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
*/
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea,
List ticks) {
// no renderer, no gridlines...
if (getRenderer() == null) {
return;
}
// draw the domain grid lines, if any...
if (isDomainGridlinesVisible() || isDomainMinorGridlinesVisible()) {
Stroke gridStroke = null;
Paint gridPaint = null;
Iterator iterator = ticks.iterator();
boolean paintLine;
while (iterator.hasNext()) {
paintLine = false;
ValueTick tick = (ValueTick) iterator.next();
if ((tick.getTickType() == TickType.MINOR)
&& isDomainMinorGridlinesVisible()) {
gridStroke = getDomainMinorGridlineStroke();
gridPaint = getDomainMinorGridlinePaint();
paintLine = true;
}
else if ((tick.getTickType() == TickType.MAJOR)
&& isDomainGridlinesVisible()) {
gridStroke = getDomainGridlineStroke();
gridPaint = getDomainGridlinePaint();
paintLine = true;
}
XYItemRenderer r = getRenderer();
if ((r instanceof AbstractXYItemRenderer) && paintLine) {
((AbstractXYItemRenderer) r).drawDomainLine(g2, this,
getDomainAxis(), dataArea, tick.getValue(),
gridPaint, gridStroke);
}
}
}
}
示例14: drawZeroDomainBaseline
import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; //导入依赖的package包/类
@Override
protected void drawZeroDomainBaseline(Graphics2D g2, Rectangle2D area) {
if (isDomainZeroBaselineVisible()) {
XYItemRenderer r = getRenderer();
if (r instanceof AbstractXYItemRenderer) {
AbstractXYItemRenderer renderer = (AbstractXYItemRenderer) r;
renderer.drawDomainLine(g2, this, getDomainAxis(), area, 0.0, getDomainZeroBaselinePaint(), getDomainZeroBaselineStroke());
}
}
}
示例15: getItemRenderer
import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; //导入依赖的package包/类
@Override
public AbstractXYItemRenderer getItemRenderer(boolean nominal, int size, double minColor, double maxColor) {
XYBlockRenderer renderer = new XYBlockRenderer();
renderer.setPaintScale(new BlockPaintScale(minColor, maxColor));
renderer.setBlockAnchor(RectangleAnchor.CENTER);
// if Block dimension is increased (e.g 1.2x1.2), the grid effect gets bigger
// so it could be that blocks are overlapping a little
// but if Block dimension is decreased (e.g. 0.9x0.9), each rectangle seems to have
// a less-transparent border (you have to zoom-in to notice), and that could be the cause of the grid effect.
//renderer.setBlockHeight(1.0);
//renderer.setBlockWidth(1.0);
return renderer;
}