Retrieving Values for 3D Bar Chart Component

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.

8 Responses to Retrieving Values for 3D Bar Chart Component

  1. Matty says:

    Thanks Mike.

  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!

  3. Gus says:

    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

  4. Sapna says:

    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.

  5. Sapna says:

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

  6. Gus says:

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

  7. welly says:

    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

  8. John Smith says:

    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