highcharts spline传入数据
来源:互联网 发布:零基础学算法 第二版 编辑:程序博客网 时间:2024/05/22 13:16
function GetDeepChart(id, select, start, end) //获取数据
{
var wt = new Date(Date.parse(end.replace(/-/g, "/")));
var nt = new Date(Date.parse(start.replace(/-/g, "/")));
var cha = wt.getTime() - nt.getTime()
var days = Math.floor(cha / (24 * 3600 * 1000))
$.post("/HarthWork/Monitor/GetMonitorDeepList", { PointId: id, select: select, start: start, end: end }, function (data) {
if (data != null) {
var Monitortext = $("#MonitorTypeTree").tree("getSelected");
$.post("/HarthWork/Monitor/GetTypeUnit", { newId: Monitortext.id }, function (typeUnit) {
if (data != null) {
var text = Monitortext.text;
var day = 1;
var danwei = typeUnit;
var ytext = '监测单位(' + danwei + ')';
var seriesname = $("#selectId").find("option:selected").text();
var mydata = eval(data);
var series = [];
for (var i = 0; i < mydata.length; i++) {
var name = mydata[i]['name'];
var mydata1 = mydata[i]['data'];
var data1 = [];
for (var j = 0; j < mydata1.length; j++) {
var date = mydata1[j].datetime;
var obj = date.split(",");
var month = obj[1] - 1;
data1.push([Date.UTC(obj[0], month, obj[2], obj[3], obj[4], obj[5]), parseFloat(mydata1[j].datavalue)]);
}
series.push({ name: name, data: data1 });
}
getline(seriesname, cha / 20, ytext, series, danwei);
}
}, "text")
}
else {
$('#container').html("");
}
})
}
function getline(seriesname, cha, ytext, series, danwei)//生成图表
{
if (cha == 0) {cha = 3600 * 1000;
}
$(function () {
$('#container').highcharts({
global: {
useUTC: false
},
chart: {
type: 'spline'
},
title: {
text: seriesname
},
xAxis: {
type: 'datetime',
tickInterval: cha,//X轴时间间隔
tickPixelInterval: 150,
labels: {
enable: true,
rotation: 75, //旋转,效果就是影响标签的显示方向
formatter: function () {
return Highcharts.dateFormat('%Y-%m-%d %H', this.value);//转换时间格式
}
}
},
yAxis: {
title: {
text: ytext
}
},
tooltip: {
formatter: function () {
return '<b>' + this.series.name + '</b><br/>' +
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/> ' + (this.y).toFixed(3) + danwei;//划上点的时候显示的内容
}
},
series: series//是数据 已数组的方式传入, 一般是获取一段json数据后转换为数组
});
});
}
- highcharts spline传入数据
- 前端 Highcharts图表,如何动态传入数据
- highcharts折线图-line,spline
- HighCharts 根据spline-plot-bands图,定制自己的图(区间里显示多个数据)
- 如何将json数据传入到Highcharts中的data中
- 如何将json数据传入到Highcharts中的data中
- Servlet中的json数据传入highcharts中的data,形成动态的折线图
- highcharts 数据格式化
- Highcharts数据注意事项
- Highcharts 去掉数据点
- Highcharts 数据点样式
- Highcharts 数据统计功能
- highcharts的数据赋值
- highcharts异步获取数据
- HighCharts动态数据刷新
- highcharts异步获取数据
- Highcharts数据表示(2)
- Highcharts数据表示(3)
- yii框架搭建问题:PHP Fatal error: require_once(): Failed opening required
- exit和return的区别
- hdu 4899 Hero meet devil(状压dp)
- php Warning:date(): It is not safe to rely on the system's timezone settings
- 从抽象谈起(二):观察者模式与回调
- highcharts spline传入数据
- C# Socket异步通讯实现详解
- Cesium WebGL 调试环境配置
- LeetCode-Construct Binary Tree from Inorder and Postorder Traversal
- 汽车VIN号所标示的意义是什么
- Ajax:
- Mybatis_review之配置文件中的typeHandlers节点内容说明
- 网络流—最大流(Edmond-Karp算法)
- 再遇MySQL 启动 1067 错误。