FusionCharts allows to change chart data and re-render the chart, after it has loaded on the user’s computer. This is possible with the help of methods, which are attached to each FusionCharts object.

In the following demonstrative example, we will change the data source of a chart when the chart is clicked upon. The XML code (below) dynamically changes the data source of the FusionCharts object.

<?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"
xmlns:components="com.fusioncharts.components.*" initialize="initApp()"> <components:FusionCharts id="FC1" x="10" y="10" FCChartType="Column3D" width="500" height="300" FCDataURL="Data.xml" /> <fx:Script>
<![CDATA[ import com.events.FCEvent;
import mx.collections.ArrayCollection;
import mx.controls.Alert; private function initApp():void {
FC1.addEventListener("FCClickEvent",clicked);
} private function clicked(e:FCEvent):void {
FC1.FCData(city_data);
FC1.FCParams(city_params);
FC1.FCRender();
} // Providing chart data as ArrayCollection to chart
[Bindable]
private var city_data:ArrayCollection = new ArrayCollection([
{label:'USA',value:'96000', link:'S-USA'},//注意 S- 是一个前缀标志 后边的内容可以在点击的时候获取到
{label:'Germany',value:'90000', link:'S-Germany'},
{label:'Austria',value:'58000', link:'S-Austria'},
{label:'Brazil',value:'50000', link:'S-Brazil'},
{label:'UK',value:'28000', link:'S-UK'},
{label:'Sweden',value:'25000', link:'S-Sweden'}
]); // Providing chart parameters as ArrayCollection to chart
[Bindable]
private var city_params:ArrayCollection=new ArrayCollection([
{caption:"Sales by Country"},
{subcaption:"(Click country item for details)"},
{numberPrefix:"$"},
{showValues:"0"}
]); ]]>
</fx:Script> </s:Application>

In the above code we doen the following:

Initially, we bind the event listener clicked to the click event of the FusionCharts file.

FC1.addEventListener("FCClickEvent",clicked);

The clicked method calls upon FCData, FCParams and FCRender of the FusionCharts object to perform the various functions. The data is set using the following method.

FC1.FCData( city_data );

Here city_data is an ArrayCollection object, which contains the datasets. The parameters are passed in the following manner:

FC1.FCParams(city_params); 

Similarly, city_params is an ArrayCollection object containing the list of parameters.

Finally, FCRender method is called to render the chart.

FC1.FCRender();

FusionCharts for Flex 如何更改图表数据的更多相关文章

  1. GapMinder气泡图:在线互动图表数据平台

    GapMinder:在线互动图表数据平台是一个将国际统计数据转换成活动的.交互的和有趣的图表,以在线统计数据为基础的互动图表集的完美世界.目的是通过增进对可以自由访问的公共统计数据的使用和理解,以促进 ...

  2. 更改Oracle数据文件名及数据文件存放路径

    更改Oracle数据文件名及数据文件存放路径 SQL> select * from v$dbfile;        FILE# NAME ---------- ---------------- ...

  3. HTML5线性图表 图表数据区域可着色

    这是一款基于Canvas的HTML5图表应用,在图表数据初始化的时候伴随动画效果. 在线演示: 点击演示 源代码下载: 点击下载 核心jQuery代码: var myData = {   labels ...

  4. centos 7.1系统更改Mariadb数据存储位置步骤分享

    一.首先确保你要更改Mariadb数据存储的位置的空间够大 现在已将Mariadb存储位置更改到/opt/目录下 1.然后将Mariadb服务stop:systemctl stop mariadb 2 ...

  5. FusionCharts for Flex的属性和事件

    FusionCharts for Flex的属性和事件 1.Properties(属性) (1)FCChartType (2)FCDataURL (3)FCDataXML (4)FCDebugMode ...

  6. Grafana 利用Grafana Variables变量配置快速切换不同主机的图表数据展示

    用Grafana Variables变量配置快速切换不同主机的图表数据展示   by:授客 QQ:1033553122 测试环境 需求描述 操作步骤 结果展示 测试环境 influxdb-1.5.2. ...

  7. C# Chart使用总结 1 ---------关于图表数据的来源

    关于图表数据的来源: 1.通过XValueMember YValueMembers 设置 OleDbConnection conn = new OleDbConnection(connStr); Ol ...

  8. 将Highcharts图表数据生成Table表格

    有的时候,我们不仅仅需要漂亮的统计图来显示统计结果,还需要在统计图下方一个表格可以更加直观的展现各类数据.既然统计图都显示出来了,那我们可以根据统计图的各元素生成表格了. 首先,先显示统计图. Htm ...

  9. Echarts使用及动态加载图表数据 折线图X轴数据动态加载

    Echarts简介 echarts,缩写来自Enterprise Charts,商业级数据图表,一个纯JavaScript的图表库,来自百度...我想应该够简洁了 使用Echarts 目前,就官网的文 ...

随机推荐

  1. Chrome插件制作

    由于网上很难找到关于Chrome插件制作的中文教程,为了总结和方便更多的开发者,本文以最常见的显示效果为browser_action的二维码插件为例,进行相关阐述.前端童鞋开发的话应该很简单的,鄙人是 ...

  2. String.format()【示例详解】

    String.format()[示例详解] 整理者:Vashon 前言: String.format 作为文本处理工具,为我们提供强大而丰富的字符串格式化功能,为了不止步于简单调用 String.fo ...

  3. 深入解析Web Services

    SOA,面向服务器建构,是一款架构,这几年虽然没前几年那么流行,但是还是有很多企业在用,而Web Services是目前适合做SOA的主要技术之一,通过使用Web Services,应用程序可以对外发 ...

  4. Outlook 数据文件(.pst 和 .ost)简介

    使用 Microsoft Outlook 时,电子邮件.日历.任务和其他项目保存在邮件服务器或计算机上,或者同时保存在这两个位置.如果 Outlook 项目保存在计算机上,则它们保存在 Outlook ...

  5. PHP安全之 register_globals

    一.register_globals = Off 和 register_globals = On的区别 register_globals是php.ini里的一个配置,这个配置影响到php如何接收传递过 ...

  6. P1357 花园 (矩阵快速幂+ DP)

    题意:一个只含字母C和P的环形串 求长度为n且每m个连续字符不含有超过k个C的方案数 m <= 5  n <= 1e15 题解:用一个m位二进制表示状态 转移很好想 但是这个题是用矩阵快速 ...

  7. The MySQL server is running with the –secure-file-priv

    show variables like '%secure%'; 将文件导出路径更改为查询到的secure-file-priv路径下 select * from table where column = ...

  8. 浅谈stiring数

    在组合数学,Stirling数可指两类数,第一类Stirling数和第二类Stirling数. stirling常应用于许多组合枚举问题中. 第一类stirling数: 对第一类Stirling数   ...

  9. 北京化工大学2018年10月程序设计竞赛部分题解(A,C,E,H)

    目录 北京化工大学2018年10月程序设计竞赛部分题解(A,C,E,H) 竞赛事件相关 竞赛链接 竞赛题目 总结 北京化工大学2018年10月程序设计竞赛部分题解(A,C,E,H) 竞赛事件相关 竞赛 ...

  10. int (*a)[10]和int *a[10]的区别

    有点晚了,放个链接,睡觉. https://stackoverflow.com/questions/13910749/difference-between-ptr10-and-ptr10