The upcoming release of Flex, has capabilities to specify fill colors
for individual chart items, but till then

 

There are 2 ways to achieve this

 

a.      Have a custom renderer, which specifically checks for the
particular item during rendering and highlights that
b.      This is a round about way of achieving this 

        1.      on creation complete - dispatch a mouse move event to
the item you want to highlight, the sample code is this

                                    

var p:Point = bar.dataToLocal(10,"USA");

 

                                    var m:MouseEvent = new
MouseEvent(MouseEvent.MOUSE_OVER, true, false,

                                    p.x, p.y);

                                    bar.dispatchEvent(m);

 

        2.      Have an event handler for itemRollOver for your bar
chart and get access to the chartitem
        3.      In the event handler, check for the item which needs to
be highlighted, change the fill of that and call the itemRenderer's
invalidatedisplaylist as shown in the sample code

 

                  private function
OnItemRollOver(event:ChartItemEvent):void

                  {

 
if(HitData(event.hitSet[0]).chartItem.index == 0) // this is the item,
you want to standout

                              {

                                          event.hitSet[0].chartItem.fill
= new SolidColor(0);

 
event.hitSet[0].chartItem.itemRenderer.invalidateDisplayList();

                              }

                  }

 

The downside of this, you have do dispatch the mouseevent, whenever
there is a change in the data, where the series gets invalidated.

 

 

Hopefully this should help

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of abba_t
Sent: Saturday, June 02, 2007 9:46 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Making an individual Bar on a BarGraph stand out?

 

It seems simple.... probably is, but I have searched high and low and 
probably have tried over one hundred different pieces of code but with 
no luck. I can not seem to find a way to highlite one particular bar 
on a bar graph. I can change the properties of the group of bars 
(alpha, fill, width etc.) but I am trying to apply something to an 
individual bar to make it appear highlited.

Any help would be greatly appreciated.



 

Reply via email to