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">'
相关文档:
消息服务(Message Service )提供发布(publish)/订阅(subscribe)机制允许Flex 应用程序发布消息、订阅消息终端(messaging destination),从而实现实时数据的推和协作。
一、Message Service
Message Service 提供发布(publish)/订阅(subscribe)机制允许Flex 应用程序发布消息、订阅消息终端(messaging des ......
flex滚动条虽然很好用,但总是会出现意想不到的问题。前几天说了,拖动后花屏的问题,今天又发现了更恶心的问题。当你把容器的宽度调为100%后 ,verticalScrollbarPolicy 用默认的auto。这是如果你缩放窗口会出现滚动条,但问题这是就出现了,只要出现了垂直滚动条,水平滚动条就是被迫出现。
<?xml version="1.0" enco ......
今天刚接触Flex,但是当我把代码编写完成运行的时候报下了如下错误:
C:\WINDOWS\system32\Macromed\Flash\Flash10e.ocx
Flex Builder cannot locate the required debugger version of Flash Player.
You might need to install the debugger version of Flash Player 9 or
reinstall Flex Builder.
Do you want to ......
*****************************************************
1-0. 安装配置工作环境
*****************************************************
1.安装jdk1.6
设置环境变量:java_home,内容为jdk安装后jdk所在目录,不是jre目录
2.安装tomcal 6.0到d:\
3.安装myeclipse 6.5
4.安装firefox及插件
安装firefox
&nbs ......
Flex DataGrid组件
实际上,DataGrid组件是属于列表组件的,之所以单独拿出来讲解,主要是因为 DataGrid组件有着很强大的功能,也有很多扩展的应用是在开发中经常用到的。DataGrid组件是按照行和列的形式显示数据的。有几个类是只有 DataGrid组件才能使用的,包括DataGridCellEditor类、DataGridColumn类和HeaderRendere ......