• 属性“dataProvider”有多个初始值设定项。(注意:“dataProvider”是“mx.charts.BarChart”的默认属性)。


    1、错误描写叙述

    属性“dataProvider”有多个初始值设定项。(注意:“dataProvider”是“mx.charts.BarChart”的默认属性)。


    2、错误原因

    <?

    xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%" creationComplete="initHandler(event)"> <s:layout> <s:BasicLayout/> </s:layout> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.events.FlexEvent; [Bindable] private var chartArray:ArrayCollection = new ArrayCollection([ {week:"星期一",snake:"5459",cow:"7845"}, {week:"星期二",snake:"8956",cow:"7845"}, {week:"星期三",snake:"3562",cow:"7845"}, {week:"星期四",snake:"7856",cow:"7845"}, {week:"星期五",snake:"1245",cow:"7845"}, {week:"星期六",snake:"9656",cow:"7845"}, {week:"星期日",snake:"6784",cow:"7845"} ]); protected function initHandler(event:FlexEvent):void { } ]]> </fx:Script> <fx:Declarations> <!-- 将非可视元素(比如服务、值对象)放在此处 --> </fx:Declarations> <mx:VBox width="100%" height="100%" horizontalAlign="center" paddingBottom="10" paddingLeft="10" paddingRight="20" paddingTop="10"> <mx:BarChart id="barchart" width="100%" height="90%" showDataTips="true" dataProvider="{chartArray}"> <mx:verticalAxis> <mx:CategoryAxis categoryField="week" displayName="星期"/> </mx:verticalAxis> <mx:series> <mx:BarSeries displayName="蛇数量" xField="snake" yField="week"/> </mx:series> <fx:Array> </fx:Array> </mx:BarChart> <mx:Legend dataProvider="{barchart}"/> </mx:VBox> </s:Application>


    3、解决的方法

    <?

    xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%" creationComplete="initHandler(event)"> <s:layout> <s:BasicLayout/> </s:layout> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.events.FlexEvent; [Bindable] private var chartArray:ArrayCollection = new ArrayCollection([ {week:"星期一",snake:"5459",cow:"7845"}, {week:"星期二",snake:"8956",cow:"7845"}, {week:"星期三",snake:"3562",cow:"7845"}, {week:"星期四",snake:"7856",cow:"7845"}, {week:"星期五",snake:"1245",cow:"7845"}, {week:"星期六",snake:"9656",cow:"7845"}, {week:"星期日",snake:"6784",cow:"7845"} ]); protected function initHandler(event:FlexEvent):void { cate.ticksBetweenLabels = false; } ]]> </fx:Script> <fx:Declarations> <!-- 将非可视元素(比如服务、值对象)放在此处 --> </fx:Declarations> <mx:VBox width="100%" height="100%" horizontalAlign="center" paddingBottom="10" paddingLeft="10" paddingRight="20" paddingTop="10"> <mx:BarChart id="barchart" width="100%" height="90%" showDataTips="true" dataProvider="{chartArray}"> <mx:verticalAxis> <mx:CategoryAxis id="cate" categoryField="week" displayName="星期" /> </mx:verticalAxis> <mx:series> <mx:BarSeries displayName="蛇数量" xField="snake" yField="week"/> </mx:series> <mx:secondVerticalAxis> <mx:CategoryAxis categoryField="week" displayName="星期"/> </mx:secondVerticalAxis> <mx:secondSeries> <mx:LineSeries displayName="牛" xField="cow" yField="week"/> </mx:secondSeries> </mx:BarChart> <mx:Legend dataProvider="{barchart}"/> </mx:VBox> </s:Application>



  • 相关阅读:
    Generate Parentheses
    Length of Last Word
    Maximum Subarray
    Count and Say
    二分搜索算法
    Search Insert Position
    Implement strStr()
    Remove Element
    Remove Duplicates from Sorted Array
    Remove Nth Node From End of List
  • 原文地址:https://www.cnblogs.com/mengfanrong/p/5167942.html
Copyright © 2020-2023  润新知