flex 图表使用百分比示例
<?xml version="1.0"?>
<!-- charts/PredefinedAxisStyles.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<!--[CDATA[
//导入相关包
import mx.collections.ArrayCollection;
import mx.charts.*;
import mx.charts.series.items.ColumnSeriesItem;
import mx.charts.ChartItem;
import mx.charts.chartClasses.Series;
import mx.charts.chartClasses.IAxis;
import mx.utils.ObjectUtil;
[Bindable]
public var expenses:ArrayCollection = new ArrayCollection([
{Month:"*", Profit:20, Expenses:15},
{Month:"**", Profit:10, Expenses:20},
{Month:"***", Profit:30, Expenses:40},
{Month:"****", Profit:15, Expenses:25},
{Month:"*****", Profit:40, Expenses:45}
]);
public function myLabelFormat(obj:Object,pcat:Object,ax:LinearAxis):String
{
return numForm.format(obj)+"%";
}
private function setCustomLabel(element:ChartItem, series:Series):String {
// Get a refereence to the current data element.
var data:ColumnSeriesItem = ColumnSeriesItem(element);
// Get a reference to the current series.
var currentSeries:ColumnSeries = ColumnSeries(series);
// Create a return String and format the number.
return numForm.format(data.yNumber) + "%";
}
// This method customizes the values of the axis labels.
// This signature (with 4 arguments) is for a CategoryAxis.
public function defineLabel(
cat:Object,
pcat:Object,
ax:CategoryAxis,
labelItem:Object):String
{
// Show contents of the labelItem:
for (var s:String in labelItem) {
trace(s + ":" + labelItem[s]);
}
// Return the customized categoryField value:
//return cat + "";
return '<font size="35"><font color="#ff0000">' + cat + '</font></font>';
//'<font color="#ff0000">'
相关文档:
· Flex中应用程序、模块之间参数传递一般有三种方式:
· 1.通过URL携带参数进行传递
· 2.通过事件进行传递
· 3.实现接口进行传递
· 其中URL传递参数时:
· Application之间和Module之间是有区别的 ......
消息服务(Message Service )提供发布(publish)/订阅(subscribe)机制允许Flex 应用程序发布消息、订阅消息终端(messaging destination),从而实现实时数据的推和协作。
一、Message Service
Message Service 提供发布(publish)/订阅(subscribe)机制允许Flex 应用程序发布消息、订阅消息终端(messaging des ......
Flex Builder 3 下载安装与注册码(转)
Flex Builder 3 正式版,发布于中国时间 2008 年 2 月 25 日;
下载地址一:
http://download.macromedia.com/pub/flex/flex_builder/FB3_win.exe
大小: 424 MB ;未进行压缩的 Flex Builder 3 安装文件
不用注册登录,可以直接下载。
下载地址二:
http://trials.adobe.com/ ......
我以前一直从事桌面开发,尤其数据处理的的系统较多。使用较多的是开发工具是VFP,它有自带的数据库,也可以使用大型的数据库系统,既可以开发系统也可以用命令行进行管理数据。但,它在不久的将来就MS不再抚养这个买来的儿子了,操作的系统的换代等等多种因素影响,不管它是否会消忘,但始终也会 ......
CategoryAxis有一个叫做labelFunction的属性,这个属性的定义:指定一个函数,用于定义为CategoryAxis的dataProvider中的各个项目生成的标签。
所以修改的原理:可以利用labelFunction得到每个Label,然后再对其进行修改。
片段代码:
<mx:horizontalAxis>
<mx:CategoryAxis id="ca"
&nbs ......