【发布时间】:2018-02-03 11:51:58
【问题描述】:
问题:
具有相同日期的点被放置在X轴的不同位置(X轴是日期轴)。
http://icecream.me/b8388ef9e8d80e3a55dc546cd61187d9
以下是 AmCharts 设置:
AmCharts.makeChart("dashboard-chart", {
"type": "serial",
"theme": "light",
"equalSpacing": true,
"dataProvider": chartData,
"valueAxes": valueAxes,
"graphs": graphs,
"categoryField": "captured_datetime",
'chartCursor': {
'cursorPosition': 'mouse',
'cursorColor': '#ffa500',
"valueLineBalloonEnabled": true,
"valueLineEnabled": true,
},
"categoryAxis": {
"gridPosition": "middle",
"labelRotation": 75,
"minorGridEnabled": true
},
"responsive": {
"enabled": true
}
});
传入的数据如下所示:
[
{
"node_id":"1680",
"node_name":"Internal",
"nd":"1",
"sensor_type":"TM",
"captured_datetime":"2018-02-01 19:31:33",
"valueTM1680":"91.1"
},
{
"node_id":"1680",
"node_name":"Internal",
"nd":"1",
"sensor_type":"HU",
"captured_datetime":"2018-02-01 19:31:33",
"valueHU1680":"72.6"
},
{
"node_id":"1680",
"node_name":"Internal",
"nd":"1",
"sensor_type":"TM",
"captured_datetime":"2018-02-01 19:33:13",
"valueTM1680":"91.1"
},
{
"node_id":"1680",
"node_name":"Internal",
"nd":"1",
"sensor_type":"HU",
"captured_datetime":"2018-02-01 19:33:13",
"valueHU1680":"72.6"
}
]
图表示例:
graphs.push({
"balloonText": "Sensor name: [[node_name]] <br> Sensor id: [[nd]] <br> Sensor value:[[value]]<br> Sensor type: [[sensor_type]]<br> Collecting date: [[captured_datetime]] <br>",
"bullet": "round",
"lineColor": "#000000",
"bulletSize": 3,
"fillAlphas": types[i].indexOf("TM") >= 0 ? 1 : 0,
"type": types[i].indexOf("TM") >= 0 ? "column" : "smoothedLine",
"labelPosition": "right",
"valueField": "value" + types[i],
"fixedColumnWidth": 10
})
尝试使用带有以下参数的 parseDates(但没有帮助):
"minPeriod":"ss",
"parseDates":true
在图表中添加了以下设置(也没有帮助):
"dataDateFormat": "YYYY-MM-DD HH:NN:SS", "equalSpacing": true,
【问题讨论】:
标签: javascript php amcharts