Advertisement

04.21.2008 at 12:43PM PDT, ID: 23340814
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.5

Dynamically changing a PlotChart to depict a different PlotSeries/DataLegend from a single source

Asked by stockblocks in Adobe Flex

Tags: , , ,

I've searched around and can't find how to do this (I've seen the same 'ole examples that Adobe provides on PlotCharts and PlotSeries syntax, but my situation is a bit different... please read on).

The example source I've attached should explain what I'm trying to do...

I'd like to manipulate my PlotChart so it can provide on-the-fly breakdowns reflecting specific fields in my ArrayCollection.  Each breakdown will trigger a different DataLegend. The X:Y data points won't change... only their appearance for reflecting the required PlotSeries, which I presume needs to be dynamically created.

In my code here, I have two choices:  StationName and Region:

* when "Plot by StationName" is selected, the data legend will show 4 items (NorthEnd, SouthEnd, EastEnd, WestEnd).

* when "Plot by Region" is selected, the data legend will show 2 items (BTR and GYE).

The X:Y locations of each plotted point won't be affected.  What will change is the color/shape of each point that reflects the data legend that's visible.

Does this entail creation of new ArrayCollections?  Multiple PlotCharts? I realize it involves creation of more "<mx:PlotSeries...>" lines (my code only has one at the moment).

All in all, this is something I can visualize easily, but I'm unable to 'Flex-ify' it.

Hope someone can fill in the missing pieces for me.

SBStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
 
<mx:Script>
  <![CDATA[
  import mx.collections.ArrayCollection;
  import mx.controls.Alert;
  import mx.charts.HitData;
  	 
  [Bindable]
  public var pingData:ArrayCollection = new ArrayCollection([
     {StationName:"NorthEnd",   PingStrength:450, Tester:"Bob",    Region:"BTR", timeTick:160},
     {StationName:"NorthEnd",   PingStrength:750, Tester:"Jeff",   Region:"BTR", timeTick:420},
     {StationName:"EastEnd",    PingStrength:550, Tester:"Bill",   Region:"BTR", timeTick:670},
     {StationName:"SouthEnd",   PingStrength:450, Tester:"Bob",    Region:"BTR", timeTick:290},
     {StationName:"EastEnd",    PingStrength:450, Tester:"Bob",    Region:"BTR", timeTick:860},
     {StationName:"WestEnd",    PingStrength:645, Tester:"Gloria", Region:"BTR", timeTick:670},
     {StationName:"EastEnd",    PingStrength:450, Tester:"Bob",    Region:"BTR", timeTick:120},
     {StationName:"Upstairs",   PingStrength:600, Tester:"Jane",   Region:"GYE", timeTick:680},
     {StationName:"Downstairs", PingStrength:300, Tester:"Morris", Region:"GYE", timeTick:950},
     {StationName:"Upstairs",   PingStrength:500, Tester:"Ted",    Region:"GYE", timeTick:876},
     {StationName:"Upstairs",   PingStrength:250, Tester:"Mary",   Region:"GYE", timeTick:330},
     {StationName:"Downstairs", PingStrength:700, Tester:"John",   Region:"GYE", timeTick:540}
     ]);
  
   private function regenPlotDataByRegion():void {
   	Alert.show( "regenPlotDataByRegion: TBD" );
   		
   	myChart.invalidateSeriesStyles();
   } 
 
   private function regenPlotDataByStationName():void {
   	Alert.show( "regenPlotDataByStationName: TBD" );
 
   	myChart.invalidateSeriesStyles();
   } 
 
    
   private function displayPingInfo(hitData:HitData):String {
     return   "<I>" + hitData.item.StationName + "</I>: <B>" + hitData.item.PingStrength + "L</B>\n"
              + "Region: " + hitData.item.Region + '\n' 
              + "Tester: " + hitData.item.Tester + '\n' 
              + "Time: " + hitData.item.timeTick; 
     }
  ]]>
  
</mx:Script>
 
<mx:VBox>
 
  <mx:Panel title="Plot Chart">
    <mx:PlotChart id="myChart" dataProvider="{pingData}" dataTipFunction="displayPingInfo" showDataTips="true">
      <mx:series>
      <mx:PlotSeries xField="timeTick" yField="PingStrength" displayName="Pings" />
        <!-- ??????????? -->
      </mx:series>
    </mx:PlotChart>
  <mx:Legend dataProvider="{myChart}"/>
  </mx:Panel>
 
  <mx:HBox x="0" y="0" width="100%" height="100%">
    <mx:Button label="Plot by Region" click="regenPlotDataByRegion()" />
    <mx:Button label="Plot by StationName" click="regenPlotDataByStationName()" />
  </mx:HBox>
 
</mx:VBox>
 
</mx:Application>
[+][-]04.21.2008 at 01:56PM PDT, ID: 21405942

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 02:13PM PDT, ID: 21406112

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 02:19PM PDT, ID: 21406160

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 02:31PM PDT, ID: 21406260

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 03:37PM PDT, ID: 21406749

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 03:48PM PDT, ID: 21406807

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 04:11PM PDT, ID: 21406927

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Adobe Flex
Tags: Adobe, Flex, 2.01, PlotChart, PlotSeries
Sign Up Now!
Solution Provided By: julianopolito
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-43 - Hierarchy / EE_QW_2_20070628