by Mike Chambers

 Comments (8)

Created

August 11, 2003

A question was posted to my weblog asking how to retrieve the data for the individual bar chart section selected in the 3D Bar chart included as part of the Flash Charting Components Set 2 on DRK 4.

If you are using a listener to capture the select / press event, it is very simple as all of the data is passed to the listener method.

Here is an example:


[code]var dp = new DataProviderClass();dp.addItem( { data: [1,2,3,4,5,6,7], color: 0xFF0000, label: "red co." } );dp.addItem( { data: [3,4,5,6,7,8,9], color: 0x00FF00, label: "green co." } );dp.addItem( { data: [4,9,8,7,6,5,4], color: 0x0000FF, label: "blue co." } );myBarChart_abc.setDataProvider ( dp );// define listener object and eventsvar listener = {};listener.onSelect = function ( chart_component, groupIndex, itemIndex ){trace("data : " + chart_component.getItemAt(groupIndex).data[itemIndex])}// add the listener to the chartmyBarChart_abc.addListener ( listener );[code]

You can find more information on the Charting Component Set 2 and DRK 4 here.

COMMENTS

  • By Matty - 2:36 PM on August 11, 2003   Reply

    Thanks Mike.

  • By Ben Pritchard - 3:35 PM on August 22, 2003   Reply

    I have real basic question I think. How can I have one group of lets say 3 bar charts (not multiple groups shown in perspective) and have all three bars have different colors? I can’t seem to find out how to do this anywhere – is it possible? I was wondering how you would return the bar’s instance name and then actually change the color. Thanks!

  • By Gus - 2:05 PM on December 8, 2003   Reply

    Hi,I have a question a about Chart Components Set 2. Well, I puted that code you show as ex and didn´t worked, because the component don´t show up. It´s like he´s invible or something, I tested with another codes and I tryed to put the values myself at parameters, but nothing works ! how can I make the component show up in the movie ??thanks

  • By Sapna - 7:32 AM on December 10, 2003   Reply

    hi,Sorry to ask such a basic question, but I’m stuck!I’m using the f3dpiechart component from DRK5. I’ve placed the empty comp. on the stage and named it.IN the first frame of the main time line i have this code.button_btn.onPress = function(){var dp = new DataProviderClass();dp.addItem( { data: [1,2,3,4,5,6,7], color: 0xFF0000, label: “red co.” } );dp.addItem( { data: [3,4,5,6,7,8,9], color: 0x00FF00, label: “green co.” } );dp.addItem( { data: [4,9,8,7,6,5,4], color: 0x0000FF, label: “blue co.” } );myPieChart_apc.setDataProvider ( dp );}The alert works when i hit the button. But then nothing. The pir chart never gets updated! What am i doing wrong? please help! I’ve been fiddling for a whole day.Sapna.

  • By Sapna - 7:43 AM on December 10, 2003   Reply

    Sorry the ‘alert’ or the trace is the first line in the function.Sapna.

  • By Gus - 12:53 PM on December 15, 2003   Reply

    Hi ! its me again…. another stupid question, lol….Can u tell me, how can I bring XML information from my site using ACCESS’s DataBase to generate a grafic in swf automatic ??

  • By welly - 9:47 AM on May 19, 2004   Reply

    does anyone know how to pull in data from xml, txt file or even a dynamic text box ? to the flash charting components set 2 ?thankswelly

  • By John Smith - 2:01 PM on August 3, 2004   Reply

    HiCan anyone please tell me if it is possible to have more than one line on the Line Chart component of the Flash Charting Components ?Thanks in advanceJohn

ADD A COMMENT