IN general, you can draw right into your own component. When you're
extending someone else's component, you run the risk of interfering with
what they're doing.  

 

Setting that second point aside for a moment, you'd do something like:

 

g.clear();

g.lineStyle(...);

g.moveTo(0,0);

g.lineTo(...); etc.

 

See the ASDoc for the graphics API for more details.

 

Ely.

 

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of {reduxDJ}
Sent: Wednesday, May 30, 2007 4:04 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Custom Datatip Renderes for charts

 

Ely:

 

So is there an easier way then the way I mentioned below of extending
etc to draw into the charts graphics?  Can I do it right into my

Graphics object?  

 

var g:Graphics = graphics;

 

and then (what would be next)


Thanks,
Patrick

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Ely Greenfield
Sent: Wednesday, May 30, 2007 2:40 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Custom Datatip Renderes for charts

 

 

 

 

There's nothing special going on in the GraphicsUtilities class.  The
problem is that you're drawing into a sprite, rather than directly into
your component's own graphics.

 

Ely.

 

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of patricklemiuex
Sent: Wednesday, May 30, 2007 2:17 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Custom Datatip Renderes for charts

 

Ok, well I've gotten this far with my datatip renderer. It looks like
all the chart classes call the graphics utilities class to draw the
boring square box, no rounded rectangle method exists in this class. 
If I just roll my own rounded rectangle box inside my DataTipRenderer
constructor, it hides the label... 

So it looks like i need to do is, first extend the graphicsutilities
class and and then override the fillrect method to draw a rounded
rectangle, finally extend each chart to use my new extended graphics
utilities instead of the native one. Does that sound right?

package com.me.data
{
import flash.display.Graphics;
import flash.geom.Rectangle;

import mx.charts.HitData;
import mx.charts.chartClasses.DataTip;
import mx.charts.chartClasses.GraphicsUtilities;
import mx.graphics.IFill;
import mx.graphics.RoundedRectangle;
import mx.graphics.SolidColor;
import mx.graphics.Stroke;
import flash.display.Sprite;
import mx.core.IDataRenderer

public class CustomDataTip extends DataTip implements IDataRenderer
{

override protected function
updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void
{
// super.updateDisplayList(unscaledWidth, unscaledHeight);
var g:Graphics = graphics;
var xpos:Number = 0;
var ypos:Number = 0;

//var fill:IFill = IFill(new SolidColor(getStyle("backgroundColor"),
0.5));
//var stroke :Stroke= new Stroke(getStyle("borderColor"), 0, 100);
//GraphicsUtilities.fillRect(g, xpos, ypos,
unscaledWidth,unscaledHeight, fill, stroke);

var edit:Sprite = new Sprite();
edit.graphics.beginFill(getStyle("backgroundColor"),.5);
edit.graphics.drawRoundRect(xpos,ypos,unscaledWidth,unscaledHeight,6);
edit.graphics.endFill();
addChild(edit);
}
}
}

 

<<image001.jpg>>

<<image002.jpg>>

Reply via email to