Flex: PieChart LabelFunction

Categories: Flex; Tagged with: ; @ March 4th, 2010 14:54

使用labelFunction 直接显示PieChart的信息, 如下代码定义一个PieChart:

		
					
						
					
				
				

其labelFunction:

		/** 过期分布PieChart的LabelFunction.  */
		protected static function labelFunForChartExpDEtail(item:Object, field:String, index:Number, percentValue:Number):String {
			var percentString:String = percentValue.toString().substr(0, 5);
			return UserQualStatistics.getTypeLabel(item.type) + ":" + "\n" + RM.getString(BUNDLE_DASHBOARD, "info.total") + ":" + item.total + "(" + percentString + "%)";
		}

效果:

 

image

Flex:Chart 设置DataTipFunction

Categories: Flex; Tagged with: ; @ March 4th, 2010 14:08

某BarChart: showDataTips="true" dataTipFunction="dataTipFunForQualExpSummary"

tipFunction:

		/** 资格过期摘要图表的dataTipFunction. */
		protected  function dataTipFunForQualExpSummary(hd:HitData):String {
			var curObj:Object = hd.item;
			var curSeries:BarSeries = BarSeries(hd.chartItem.element); // 获得当前的BarSeries
			return curObj.qual + "-" + curSeries.displayName + "\n" + uqStatistics.getUQAs(curSeries.xField, curObj.qualObj).length + RM.getString(BUNDLE_DASHBOARD, "label.piece");
		}

效果:

image

Flex:获得BarChart中选定的对象及BarSeries

Categories: Flex; Tagged with: ; @ February 25th, 2010 17:19

如下图:

image

在点击某个BarSeries,  可通过如下方法获得该BarSeries:

监听ChartItemEvent:

var curObj:Object = e.hitData.item; // 获得当前选定的对象
var curSeries:BarSeries = BarSeries(e.hitData.chartItem.element); // 获得当前选定的BarSeries

 

更多Flex Chart实例: http://livedocs.adobe.com/flex/3/html/help.html?content=charts_eventsandeffects_12.html

Flex: 设定Chart的顶点样式

Categories: Flex; Tagged with: ; @ January 27th, 2010 23:07

代码

lineSeries.setStyle("itemRenderer", new ClassFactory(mx.charts.renderers.CircleItemRenderer));

效果:

image



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.