标签:
SVN 源码地址:http://code.taobao.org/svn/keshihua-echarts/
1.1、如何声明
var sdk = new ChartSdk();
1.2、加载JS中的图表模板option
var option = sdk.js(“option_line.js”);
1.2、加载后台JSON数据,本方法采用done异步模式
var url = “saledata-columnarrays.json”; //url = “Data/getSaleData.ashx?date1=2002&date2=2004″; sdk.json(url).done(function (data) { });
1.3、后台JSON格式
请参照 x1/saledata-columnarrays.json
{
“年月”:["2002.01","2002.02","2002.03","2002.04","2002.05","2002.06","2002.07","2002.08","2002.09","2002.10","2002.11","2002.12","2003.01","2003.02","2003.03","2003.04","2003.05","2003.06","2003.07","2003.08","2003.09","2003.10","2003.11","2003.12"],
“北京分公司”:[2214688,2253356,2215699,2173668,2296687,2326781,2346648,2425477,2866165,3159668,3285264,3362316,3506287,3565509,3703955,3709457,3733232,3730043,3751574,3758845,3805567,3832556,3846647,3904035],
“河北分公司”:[319751,357461,386489,416781,448783,457776,486013,500278,519972,539977,533876,546715,583787,586676,592334,606451,608789,616900,606997,602765,612887,636667,647125,687811],
“山东分公司”:[379655,378846,379864,378589,383356,376482,376760,383258,364822,406098,396654,403351,401233,382526,379745,380245,379663,376782,378883,380025,392351,384462,390103,397756],
“成都分公司”:[11557,12766,10351,9965,10578,11374,10685,13018,14337,13843,14565,13933,14246,14867,13277,10211,11067,11140,11274,11217,11388,12125,11556,12231],
“云南分公司”:[57723,61223,55681,54226,58664,56445,55391,60867,80361,84762,83226,84556,86137,79046,78651,77590,77094,80052,79225,80147,79943,77654,79501,80112]
}
1.4、获得JSON对象的属性名称数组,按照序列访问
var propNames = sdk.propNames(data, 1,5);
1.5、获得JSON对象的属性值,按照序列或名称访问
按照名字
var dateTimes = sdk.prop(data, “年月”);
或者 按照序列
var dateTimes = sdk.prop(data, 0);
标签:
原文地址:http://www.cnblogs.com/babietongtianta/p/5323990.html