This brings up another point.  I could just add multiple PieSeries.  Unfortunately, setting a PieSeries.visible=false does not actually take it out of the chart.  Even though it's hidden, it still affects the other series and such.  This seems counter-productive.

On 6/28/06, Ely Greenfield <[EMAIL PROTECTED]> wrote:

 
 
 
Hmmm. Honestly, I'm surprised that worked in beta 3.  Regardless, the series is caching instances of the itemRenderer, and not correctly releasing them when you switch to a different renderer.  The only workaround I can see right now is to create a new PieSeries rather than just changing the itemRenderer.
 
Ely.
 
 
 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Pan Troglodytes
Sent: Wednesday, June 28, 2006 2:54 PM
To: flexcoders
Subject: [flexcoders] Ely: StoplightRenderer example doesn't work right in release

Ely,

Okay, I admit, the subject is a LITTLE misleading.  Your original page for the stoplight renderer (http://www.quietlyscheming.com/blog/charts/data-based-renderers/ ) does still work.  But a slight derivative of it now seems to fail.

I'm specifically referring to setting the itemRenderer at runtime.  Using setStyle("itemRenderer", ...), the chart never seems to update.  Below is my example based on your example.  I show three charts.  The first is using a switchable item renderer, the second is using MyStoplightItemRenderer, the third using MyStoplightItemRenderer2.  The radio button is supposed to switch the first chart back and forth these two.  This used to work under the beta.  Now it seems to have no effect.

Can you confirm this is a bug in Flex?  I'm not going to post it to the bug webpage yet in case you just changed how you are supposed to approach this problem.


Stoplight.mxml:
<?xml version="1.0" encoding="utf-8"?>
<Application xmlns=" http://www.adobe.com/2006/mxml" layout="absolute">
  <Script>
    <![CDATA[
      public function changeRenderer(e:Event):void {
        switch (rendergroup.selectedValue) {
          case "Renderer1":
            pie.setStyle('itemRenderer', new ClassFactory(MyStoplightWedgeRenderer));
            break;
          case "Renderer2":
            pie.setStyle('itemRenderer', new ClassFactory(MyStoplightWedgeRenderer2));
            break;
        }
      }
    ]]>
  </Script>

    <XML id="dataSet" source="data/sampleData.xml" />

    <Panel width="100%" height="100%" title="data based renderers" >
        <RadioButtonGroup id="rendergroup" change="changeRenderer(event)"/>
        <RadioButton label="Renderer1" groupName="rendergroup"/>
        <RadioButton label="Renderer2" groupName="rendergroup"/>

        <PieChart id="chart" width="100%" height="100%" dataProvider="{dataSet.Sample }">
            <series>
                <PieSeries field="@costs" id="pie"/>
            </series>
        </PieChart>
        <PieChart id="chart2" width="100%" height="100%" dataProvider="{ dataSet.Sample}">
            <series>
                <PieSeries field="@costs" id="pie2" itemRenderer="MyStoplightWedgeRenderer"/>
            </series>
        </PieChart>
        <PieChart id="chart3" width="100%" height="100%" dataProvider="{dataSet.Sample}">
            <series>
                <PieSeries field="@costs" id="pie3" itemRenderer="MyStoplightWedgeRenderer2"/>
            </series>
        </PieChart>
    </Panel>
</Application>


MyStoplightWedgeRenderer:
<?xml version="1.0 " encoding="utf-8"?>
<qc:StoplightWedgeRenderer xmlns:qc="qs.charts.dataRenderers.*" xmlns="http://www.adobe.com/2006/mxml">
      <qc:thresholds>
          <qc:StoplightThreshold value="0">
              <qc:fill>
                  <SolidColor color="#00AA00" />
              </qc:fill>
          </qc:StoplightThreshold>
          <qc:StoplightThreshold value="50">
              <qc:fill>
                  <SolidColor color="#AAAA00" />
              </qc:fill>
          </qc:StoplightThreshold>
          <qc:StoplightThreshold value="80">
              <qc:fill>
                  <SolidColor color="#AA0000" />
              </qc:fill>
          </qc:StoplightThreshold>                                   
      </qc:thresholds> 
</qc:StoplightWedgeRenderer>



MyStoplightWedgeRenderer2:
<?xml version=" 1.0" encoding="utf-8"?>
<qc:StoplightWedgeRenderer xmlns:qc="qs.charts.dataRenderers.* " xmlns="http://www.adobe.com/2006/mxml">
      <qc:thresholds>
          <qc:StoplightThreshold value="0">
              <qc:fill>
                  <SolidColor color="#CCAACC" />
              </qc:fill>
          </qc:StoplightThreshold>
          <qc:StoplightThreshold value="50">
              <qc:fill>
                  <SolidColor color="#AAAACC" />
              </qc:fill>
          </qc:StoplightThreshold>
          <qc:StoplightThreshold value="80">
              <qc:fill>
                  <SolidColor color="#AACCCC" />
              </qc:fill>
          </qc:StoplightThreshold>                                   
      </qc:thresholds> 
</qc:StoplightWedgeRenderer>


--
Jason




--
Jason __._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to