0 Replies Latest reply on Nov 16, 2009 12:50 PM by ice1000

    Stacked Column Chart Data Labels Not Appearing

    ice1000 Level 1

      I am using SetSytle in Actionscript to make the data labels in a stacked column chart appear inside but it's not working.

       

      A portion of the code I am using to create the chart is below:

       

                      //initialize column set for stacked columns
                      var colSet:ColumnSet = new ColumnSet();
                      colSet.type="stacked";
             
                       for each(var node:XML in _chartDP){
                           var k:int = 0;
                          
                           //skip zero datapoints
                           if (parseInt(node.toString()) != 0) {
                               //if measure node does not exist, add as series
                               k = uniqueYCat(node.attribute("BillTo"));
                               if (k == -1){                                                        
                                      // Create the new column series and set its properties.
                                      var localSeries:ColumnSeries = new ColumnSeries();
                                      localSeries.setStyle("labelPosition","inside");
                                      localSeries.dataProvider = dataArray;
                                      localSeries.yField = node.attribute("BillTo");
                                      localSeries.xField = "ConfidenceStatus";
                                      localSeries.displayName = node.attribute("BillTo");
                                      localSeries.setStyle("showDataEffect", ChangeEffect);

       

                                      // Back up the current series on the chart.
                                      var currentSeries:Array = chart.series;
                                     
                                      // Add the new series to the current Array of series.
                                      currentSeries.push(localSeries);
                                     
                                      //Add Array of series to columnset
                                      colSet.series.push(localSeries); 
                                
                                         //assign columnset to chart
                                      chart.series = [colSet];
                                   }             
                               }
                          }

       

       

      After some more research, I put a breakpoint inside ColumnChart.as in the following function:

       

          mx_internal function getSeriesLabelPos(series:Series):void
          {
              if(series is ColumnSeries)
              {
                  var columnSeries:ColumnSeries = ColumnSeries(series);
                  var position:String = columnSeries.labelPos;
                  if(position == "inside" || position == "outside" || position == "none")
                      _needLabels = true;
              }
              else if(series is ColumnSet)
              {
                  var setSeries:Array /* of Series */ = ColumnSet(series).series;
                  for (var i:int = 0; i < setSeries.length; i++)
                  {
                      getSeriesLabelPos(setSeries[i]);
                  }
              }  
          }

       

      the following line: var position:String = columnSeries.labelPos;


      returns postion as null. It looks like the setStyle is not passing the correct value to this function.

       

      Any ideas as to what is going on?