1 Reply Latest reply on Mar 12, 2007 6:11 PM by chris.huston.t10

    Flex Charting Weirdness

      I'm trying to display a "Gantt Chart" type chart using Ely's example here: http://demo.quietlyscheming.com/ChartSampler/app.html (Series Types -> Columns & bars -> Floating Bars). This is really perfect for what I'm trying to do.

      I was pretty happy... until I put in my own data. After entering in my own data - I don't know - it's displaying phantom info... I'm really not sure where it's getting the data from. The first two items that show up are correct, but the rest of the items are just - whacked. The start point is incorrect, the bar length is wrong... I've tried changing the values just to see what would happen... and it simply doesn't display the correct information. It seems to me like a chart that doesn't display the values correctly isn't very useful - but perhaps I'm just doing something wrong. I was hoping someone would have some insight.

      Ely uses an xml file to render the data, with the only values being used in the chart being "revenue" (the start point for the bar) and "costs" (the length of the bar).

      <Sample month="January" revenue="120" costs="45" />
      <Sample month="February" revenue="108" costs="42" />
      <Sample month="March" revenue="150" costs="82" />
      <Sample month="April" revenue="170" costs="44" />
      <Sample month="May" revenue="250" costs="57" />
      <Sample month="June" revenue="200" costs="33" />
      <Sample month="July" revenue="145" costs="80" />
      <Sample month="August" revenue="166" costs="87" />
      <Sample month="September" revenue="103" costs="56" />
      <Sample month="October" revenue="140" costs="91" />
      <Sample month="November" revenue="100" costs="42" />
      <Sample month="December" revenue="182" costs="56" />
      <Sample month="May" revenue="120" costs="57" />

      And here's the chart code:
      <Model id="dataSet" source="/data/sampleData.xml" />

      <BarChart id="chart" width="100%" height="100%" dataProvider="{dataSet.Sample}">
      <BarSeries xField="revenue" minField="costs"/>
      <CategoryAxis categoryField="month" />

      So, all i did was change the values "revenue" to "start" and "costs" to "duration".

      So here's my xml: <YearlyData>
      <Sample month="CBCS Final Signoff" start="28" duration="2" />
      <Sample month="Design Revisions" start="27" duration="2" />
      <Sample month="Copy Revisions" start="26" duration="2" />
      <Sample month="Legal Approval" start="18" duration="7" />
      <Sample month="Design Revisions" start="17" duration="2" />
      <Sample month="Copy Revisions" start="16" duration="2" />
      <Sample month="BP Internal Routing" start="13" duration="3" />
      <Sample month="CBCS Review" start="11" duration="2"/>
      <Sample month="Design Concepts" start="6" duration="5" />
      <Sample month="Copy Concepts" start="1" duration="5" />
      <Sample month="Project Kick-off" start="0" duration="1" />

      And my Chart code:
      <Model id="dataSet" source="/data/sampleData.xml" />

      <BarChart id="chart" width="100%" height="100%" dataProvider="{dataSet.Sample}">
      <BarSeries xField="start" minField="duration"/>
      <CategoryAxis categoryField="month" />

      When you run his data it appears to all be charted correctly, when you run mine the top two items are correct, 3 on down are just - I don't know - it's just all wrong.

      Any ideas would be appreciated.
        • 1. Re: Flex Charting Weirdness
          chris.huston.t10 Level 3
          I ran your data with the below code and all the data was displayed correctly.

          <mx:Model id="dataSet" source="sampleData.xml" />
          <mx:BarChart id="chart" width="391" height="278" dataProvider="{dataSet.Sample}" x="32" y="269">
          <mx:BarSeries xField="start" minField="duration"/>
          <mx:CategoryAxis categoryField="month" />