Flex Toggles histogram horizontal and descriptive notes using the radio button

Source: Internet
Author: User

1. Narrative description of the problem

A set of radio button, there are weeks and months, the choice of "Week", the histogram is displayed in the horizontal axis of the week, the vertical axis shows the number of people; Select "Month", histogram horizontal display of the month, the ordinate shows the ratio.


2. Demo Example

<?

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)" fontfamily= "Microsoft Jas Black" fontsize= "><s:layout><s:BasicLayout/></s:layout>" <fx:script><! [Cdata[import mx.collections.arraycollection;import Mx.controls.alert;import Mx.events.flexevent;import Mx.events.ItemClickEvent; [bindable]//graph Data Binding private var chartarray:arraycollection = new ArrayCollection ([{week: "Monday", Month: "January", Person: "8989 ", Rate:"},{week: "Tuesday", Month: "February", Person: "5675", Rate: "},{week": "Wednesday", Month: "March", Person: "7234", Rate: "12"},{ Week: "Thursday", Month: "April", Person: "3456", Rate: "},{week": "Friday", Month: "May", Person: "6355", Rate: "},{week", "Saturday", Month: ' June ', Person: ' 4356 ', Rate: '},{week ': ' Sunday ', Month: ' July ', Person: ' 9087 ', Rate: ' 87 '}],/** * initialization function */protected function Inithandler (event:flexevent): void{}/** * Query buTton functions */protected function Search_clickhandler (event:mouseevent): void{}/** * radio button toggle function */protected functions Radiogroup_itemclickhandler (event:itemclickevent): Void{if (event.currenttarget.selectedvalue== "Week") { Datax.categoryfield = "Week";d atax.displayname = "Week";d Ate.xfield = "Week";d Ate.yfield = "Person";d Ate.displayname = "Number of people" ;} else if (event.currenttarget.selectedvalue== "month") {Datax.categoryfield = ' month ';d atax.displayname = "month";d Ate.xfield = " Month ";d Ate.yfield =" rate ";d Ate.displayname =" ratio ";}]] ></fx:script><fx:declarations><s:radiobuttongroup id= "Radiogroup" itemClick= "Radiogroup_ Itemclickhandler (Event) "/></fx:declarations><s:vgroup width=" 100% "height=" 100% "paddingBottom=" 10 " Paddingleft= "Ten" paddingright= "paddingtop=" horizontalalign= "center" ><s:hgroup width= "100%" height= "30 "Paddingleft=" verticalalign= "Middle" ><s:label text= "date type:"/><s:label width= "/><s: RadioButton label= "Week" groupname= "Radiogroup" value= "Week" Selected= "true"/><s:label width= "/><s:radiobutton label=" month "groupname=" Radiogroup "value=" Month "/> <s:label width= "/><s:button label=" query "id=" search "click=" Search_clickhandler (Event) "/&GT;&LT;/S: Hgroup><mx:columnchart id= "column" dataprovider= "{Chartarray}" width= "100%" height= "80%" columnwidthratio= " 0.4 "showdatatips=" true "><mx:horizontalaxis><mx:categoryaxis id=" datax "categoryfield=" Week " Displayname= "Week"/></mx:horizontalaxis><mx:series><mx:columnseries displayName= "number" id= "date" Xfield= "Week" yfield= "person"/></mx:series></mx:columnchart><mx:legend dataprovider= "{column}" /></s:vgroup></s:application>


3. Example Results

(1) When initializing



(2) Select "Month"

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvew91mjnoywk0nq==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center "width=" 710 "height=" 383 "border=" 1 ">

Copyright notice: This article Bo Master original article. Blog, not reproduced without consent.

Flex Toggles histogram horizontal and descriptive notes using the radio button

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.