New Renderer looses Map Image Info

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Nexxxus
Posts: 1
Joined: Tue Jul 02, 2013 3:14 pm
antibot: No, of course not.

New Renderer looses Map Image Info

Post by Nexxxus » Tue Jul 02, 2013 3:30 pm

Hello, I am creating a graph.
This graph has different series and has multi-axis, and each serie is adjusted to its own range axis.
Too, each serie is painted with a determined color and its axis too.
There is no problem with it.

The question is that I want to paint each point in mi graph with two different colors (outline and item). No problem with this extending an XYLineAndShapeRenderer.

My Renderer code:

Code: Select all

private class MiRenderer extends XYLineAndShapeRenderer {
        
		private GraphAlternativeLines alternativas;
		private Paint colorlinea;
		private Ellipse2D.Double forma = new Ellipse2D.Double(-5D, -5D, 10D, 10D);
		
		public MiRenderer(boolean lines, boolean shapes,GraphAlternativeLines alternativas,Paint colorlinea) {
            super(lines, shapes);
            this.alternativas=alternativas;
            this.colorlinea=colorlinea;
        }
		
		public Paint getBasePaint(){
			return colorlinea;
		}
		public Paint getSeriesPaint(int series){
			return colorlinea;
		}
		public boolean getBaseShapesVisible(){
			return true;
		}
		public boolean getBaseShapesFilled(){
			return true;
		}
		public boolean getDrawOutlines(){
			return true;
		}
		public boolean getUseOutlinePaint(){
			return true;
		}
		public Paint getItemPaint(int row, int col) {
           return alternativas.manuals.get(col);
        }
        public Paint getItemOutlinePaint(int row, int col){
        	return alternativas.summary.get(col);
        }
        public Shape getBaseShape(){
        	return forma;
        }
        public Shape getSeriesShape(int series){
        	return forma;
        }
        protected void drawFirstPassShape(Graphics2D g2, int pass, int series,int item, Shape shape) {
            g2.setStroke(getItemStroke(series, item));
            g2.setPaint(colorlinea);
            g2.draw(shape);
        }
    }
Use of this code:

Code: Select all

/**Pinto las series con su color**/
		List<GraphAlternativeLines> alternativas = (List<GraphAlternativeLines>) parametros.get("alternativas");
		for(int i=0; i<alternativas.size() ; i++){
			GraphAlternativeLines alt = alternativas.get(i);
			Paint color = colors[i%colors.length];
			XYLineAndShapeRenderer r = new MiRenderer(true, true,alt,color);
			r.setBasePaint(color);
			r.setSeriesPaint(0,color);
			r.setBaseShapesVisible(true);
			r.setBaseShapesFilled(true);
			superior.setRenderer(i, r);
		}
If I comment the "new" line I can see the map in my HTML , but not point is painted as I need.
How can I regenerate map info?

Locked