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. CCF|最大波动|Java|100

    import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Sc ...

  2. Scala基础篇-05求值策略

    Scala的求值策略有2种: call by value call by name 如何区分? 例子: def bar(x:Int,y: => Int) = def loop(): Int=lo ...

  3. KendoUI Grid Pager部分 Nan-Nan of x Items

    相关问题: http://stackoverflow.com/questions/23941065/pager-error-in-kendo-gridnan-nan-of-1-items http:/ ...

  4. zabbix告警邮件、短信发送错误快速排查方法

    zabbix告警邮件.短信发送错误快速排查方法 背景 zabbix告警邮件.短信经常有同事反馈发送错误的情况,这个问题排查的角度很多,那么最快捷的角度是什么呢? 在我看来,最快的角度就是判断这个告警邮 ...

  5. python导包一不小心就入坑(常用解决办法)

    常见导包报错: - ImportError:No module named - SystemError: Parent module '' not loaded, cannot perform rel ...

  6. RNN静态与动态

    静态.多层RNN:import numpy as np import tensorflow as tf # 导入 MINST 数据集 from tensorflow.examples.tutorial ...

  7. spring注解开发-容器创建全过程(源码)

    1.Spring容器的创建会经历refresh()方法[创建刷新](以AnnotationConfigApplicationContext为例) public AnnotationConfigAppl ...

  8. NOIp2018 提高组初赛试题参考答案

  9. [JOYOI] 1061 Mobile Service

    题目限制 时间限制 内存限制 评测方式 题目来源 1000ms 131072KiB 标准比较器 Local 题目描述 一个公司有三个移动服务员.如果某个地方有一个请求,某个员工必须赶到那个地方去(那个 ...

  10. C/C++函数指针详解(转)

    这两天在研究C/C++的函数指针,找到一篇讲解比较详细的博客,内容有点多,但是讲解得比较详细,适合初学者.特转之: 1.     无处不见的函数指针 使用函数指针可以设计出更优雅的程序,比如设计一个集 ...