3 Replies Latest reply on Dec 29, 2009 10:13 AM by Gregory Lafrance

    Problem with dataPosition and charts

    Gregory Lafrance Level 6

      In the following code:

       

      billingsSeries.setStyle("labelPosition", "outside");

       

      is causing this error:

       

      Type Coercion failed: cannot convert mx.charts::ColumnChart@6b380a1 to mx.charts.chartClasses.Series.

       

      But I am setting the property on the ColumnSeries, not on the chart, so I can't see how this can happen.

       

            private function createChart():void{   
              var colChart:ColumnChart = new ColumnChart();
              colChart.id="colChart";
              colChart.dataProvider=dataXML..data;
              colChart.showDataTips=true; 
              var catAxis:CategoryAxis = new CategoryAxis();
              catAxis.dataFunction = catFunc;
              catAxis.dataProvider = dataXML..data.(@ConfidenceStatus=='Trend');
              colChart.horizontalAxis = catAxis;
              var seriesArray:Array = new Array();
              var billingsSeries:ColumnSeries = new ColumnSeries();
              billingsSeries.id = "billingsCS";
              billingsSeries.displayName = "Billings";
              billingsSeries.dataFunction = dataFunc; 
              billingsSeries.dataProvider = dataXML..data.(@ConfidenceStatus=='Billings');
              billingsSeries.setStyle("fill", greenFill);
      
              // this throws error
              billingsSeries.setStyle("labelPosition", "outside");
      
              seriesArray.push(billingsSeries);
              colChart.series = seriesArray;
              chartArea.addChild(colChart);
            }