有人可以解释我如何使用amCharts和Data Loader功能使用多个CSV / JSON文件吗?
我的代码是:
DT[, lapply(.SD, rollMean, 3L), .SDcols = y:v]
# y v
# 1: NA NA
# 2: NA NA
# 3: 3.333333 2
# 4: 3.333333 3
# 5: 3.333333 4
# 6: 3.333333 5
# 7: 3.333333 6
# 8: 3.333333 7
# 9: 3.333333 8
我无法弄清楚如何显示网址所在的其他数据集:var chart = AmCharts.makeChart( "chartdiv", {
type: "stock",
datasets:[{
title: "Outdoor",
fieldmappings: [{
fromField: "timestamp",tofield: "timestamp"
},{
fromField: "temp", tofield: "temp"
},{
fromField: "id", tofield: "id"
}],
compared: false,
categoryField: "timestamp",
dataLoader: {
url: "/sensor-data.php?action=csv_data&id=AB&period=48",
showCurtain: true,
async: true,
reverse: true,
useColumnNames: true,
showErrors: true,
complete: function ( chart ) {
console.log( "Loading complete" );
},
load: function ( options, chart ) {
console.log( "File loaded: ", options.url );
},
error: function ( options, chart ) {
console.log( "Error occured loading file: ", options.url );
}
}}],
pathToImages: "http://www.amcharts.com/lib/images/",
//Python: 2015-10-27 08:43:00 YYYY-MM-DD HH:mm:ss */
//PHP: 2015-10-27 09:24:06 YYYY-MM-DD HH:mm:ss */
dataDateFormat: "YYYY-MM-DD JJ:NN:SS",
startDuration: 1,
categoryAxis: {
parseDates: true,
minPeriod : "10mm",
gridPosition: "start"
},
valueAxes: [ {
id: "v1",
gridAlpha: 0.07
}],
graphs: [ {
type:"line",
valueAxis: "v1",
title: "AB",
valueField: "temp",
lineThickness: 2
}
],
"legend": {}
} );
已编辑/已更新:根据下面的@martynasma评论,我已更新了代码但未显示任何内容且图表的数据未加载。
答案 0 :(得分:0)
您可以使用多个'dataLoader'
....
dataLoader: {
url:'...',
},
dataLoader: {
url:'...',
}
.....
和儿子