2 Replies Latest reply on Oct 18, 2010 10:28 AM by azilaga

    How do I create custom x-axis labels for stacked column chart with XML data?

    azilaga

      Can't seem to figure out how to create a label for each column on a stacked column chart.  The XML is beeing called via httpservicePlease help.

       

      Sample XML:

       

          <item>
              <period>Quarter 4/2010</period>
              <category>CCM</category>
              <lowpass>20</lowpass>
              <lowfail>5</lowfail>
              <mediumpass>15</mediumpass>
              <mediumfail>3</mediumfail>
              <highpass>42</highpass>
              <highfail>6</highfail>
              <ts>15</ts>
              <tsfail>0</tsfail>
              <allPass>112</allPass>
              <allFail>14</allFail>
          </item>

       

      MXML:

       

              <mx:ColumnChart id="chart_CCM"
                      showLabelVertically="true"
                      columnWidthRatio="1.0"
                      width="500" height="300"
                      x="10" y="5">
                      <mx:horizontalAxis>
                          <mx:CategoryAxis id="ha_ccm" title="Period" categoryField="period" />
                      </mx:horizontalAxis>
                      <mx:horizontalAxisRenderer>
                          <mx:AxisRenderer axis="{ha_ccm}">
                              <mx:axisStroke>{axisStroke}</mx:axisStroke>
                          </mx:AxisRenderer>
                      </mx:horizontalAxisRenderer>
                      <mx:verticalAxis>
                          <mx:LinearAxis id="va_ccm" title="No. of Requests" />
                      </mx:verticalAxis>
                      <mx:verticalAxisRenderer>
                          <mx:AxisRenderer axis="{va_ccm}">
                              <mx:axisStroke>{axisStroke}</mx:axisStroke>
                          </mx:AxisRenderer>
                      </mx:verticalAxisRenderer>
                     
                      <mx:series>
                          <mx:ColumnSet id="colLow" name="LTix" displayName="LTix-dn">
                              <mx:ColumnSeries xField="period" yField="lowpass" displayName="Low" fill="{passColor}" labelField="{colLow}"
                                  showDataEffect="{seriesInterpolate}" labelFunction="columnSeries_labelFunc" styleName="chartSeries" />
                              <mx:ColumnSeries xField="period" yField="lowfail" displayName="Low" fill="{failColor}" 
                                  showDataEffect="{seriesInterpolate}" labelFunction="columnSeries_labelFunc" styleName="chartSeries" />
                          </mx:ColumnSet>
                          <mx:ColumnSet>
                              <mx:ColumnSeries xField="period" yField="mediumpass" displayName="Med" fill="{passColor}"
                                  showDataEffect="{seriesInterpolate}" labelFunction="columnSeries_labelFunc" styleName="chartSeries" />
                              <mx:ColumnSeries xField="period" yField="mediumfail" displayName="Med" fill="{failColor}"
                              showDataEffect="{seriesInterpolate}" labelFunction="columnSeries_labelFunc" styleName="chartSeries" />                   
                          </mx:ColumnSet>
                          <mx:ColumnSet>
                              <mx:ColumnSeries xField="period" yField="highpass" displayName="High" fill="{passColor}"
                                  showDataEffect="{seriesInterpolate}" labelFunction="columnSeries_labelFunc" styleName="chartSeries" />
                              <mx:ColumnSeries xField="period" yField="highfail" displayName="High" fill="{failColor}"
                                  showDataEffect="{seriesInterpolate}" labelFunction="columnSeries_labelFunc" styleName="chartSeries" />
                          </mx:ColumnSet>
                          <mx:ColumnSet>
                              <mx:ColumnSeries xField="period" yField="ts" displayName="TS" fill="{passColor}"    
                                  showDataEffect="{seriesInterpolate}" labelFunction="columnSeries_labelFunc" styleName="chartSeries" />
                              <mx:ColumnSeries xField="period" yField="tsfail" displayName="TS Fail" fill="{failColor}"    
                                  showDataEffect="{seriesInterpolate}" labelFunction="columnSeries_labelFunc" styleName="chartSeries" />
                          </mx:ColumnSet>
                          <mx:ColumnSet>
                              <mx:ColumnSeries xField="period" yField="allPass" displayName="Total" fill="{passColor}"
                                  showDataEffect="{seriesInterpolate}" labelFunction="columnSeries_labelFunc" styleName="chartSeries" />
                              <mx:ColumnSeries xField="period" yField="allFail" displayName="Total" fill="{failColor}"
                                  showDataEffect="{seriesInterpolate}" labelFunction="columnSeries_labelFunc" styleName="chartSeries" />
                          </mx:ColumnSet>
                      </mx:series>
                     
                  </mx:ColumnChart>

       

      <mx:HTTPService url="currentMonth.xml" id="svc_getMonthCCM" resultFormat="e4x" />