Mike Chambers

code = joy

Retrieving Values for 3D Bar Chart Component

with 8 comments

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:


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 events
var listener = {};

listener.onSelect = function ( chart_component, groupIndex, itemIndex )
{
trace("data : " + chart_component.getItemAt(groupIndex).data[itemIndex])
}

// add the listener to the chart
myBarChart_abc.addListener ( listener );

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

Written by mikechambers

August 11th, 2003 at 1:41 pm

Posted in DRK

8 Responses to 'Retrieving Values for 3D Bar Chart Component'

Subscribe to comments with RSS

  1. Thanks Mike.

    Matty

    11 Aug 03 at 2:36 pm

  2. 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!

    Ben Pritchard

    22 Aug 03 at 3:35 pm

  3. 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

    Gus

    8 Dec 03 at 2:05 pm

  4. 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.

    Sapna

    10 Dec 03 at 7:32 am

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

    Sapna.

    Sapna

    10 Dec 03 at 7:43 am

  6. 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 ??

    Gus

    15 Dec 03 at 12:53 pm

  7. 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 ?

    thanks
    welly

    welly

    19 May 04 at 9:47 am

  8. Hi

    Can 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 advance
    John

    John Smith

    3 Aug 04 at 2:01 pm

Leave a Reply