1、图表刚开始运行的时候不显示点(或者说是点刚开始添加的时候图表不会显示添加过的点),需要等待一定时间后图表才会显示
下图左边是等待一定时间后的 右边是刚刚打开的2、点数太多太密集了,我想做一个判断达到一个效果
data:[[v1,time1],[v1,time2],[v1,time3],[v2,time4]]
to
data:[[v1,time1],[v2,time4]]就是把中间重复值的点都去掉、、、 请教~~我的chart var chart = new Highcharts.Chart({
chart: {
height: 130,
renderTo: "container",
type: 'spline',
marginRight: 10,
events: {
load: function () {
// 每秒更新一次数据
var series = this.series[0];
setInterval(function () {
$.post("DataManager.ashx", { type: "getspots", name: name }, function (data) {
for (var x = 0; x < data.length; x++) {//筛选所需数据
if (data[x].value != "") {
if (data[x].name == name) {
realvalue = data[x].value;
}
}
}
}, 'json')
if (realvalue == undefined) {//排除异常数据
realvalue = 0;
}
else {
if (realvalue == "运行") {//特殊值
realvalue = 1;
}
realvalue = parseInt(realvalue);//转类型
}
var x = (new Date()).getTime() + 8 * 60 * 60 * 1000, // current time
y = realvalue;
series.addPoint([x, y], true, true);
}, 1000);
}
}
},
title: {
text: null
},
xAxis: {//X轴设置
type: 'datetime',
tickPixelInterval: 150
},
yAxis: {//Y轴设置
title: {
text: null
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {//提示窗显示信息
formatter: function () {
return '<b>' + this.series.name + '</b><br/>' +
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' +
Highcharts.numberFormat(this.y, 2);
}
},
legend: {
enabled: false
},
credits: {
enabled: false
},
exporting: {
enabled: false
},
plotOptions:{//
area: {
point: {
events: {
update: function () {
alert("asa")
//alert("change");
return false;
}
}
}
}
},
series: [{//数据集
name: name,
data: (function () {
var data = [],
time = (new Date()).getTime(),
i;
for (i = -180; i <= 0; i++) {
data.push({
x: time + i * 1000 + 8 * 60 * 60 * 1000,//这里取到的是格林志时间, 大约差8个小时
y: function () {
return 0;
}
});
}
return data;
})()
}]
});
下图左边是等待一定时间后的 右边是刚刚打开的2、点数太多太密集了,我想做一个判断达到一个效果
data:[[v1,time1],[v1,time2],[v1,time3],[v2,time4]]
to
data:[[v1,time1],[v2,time4]]就是把中间重复值的点都去掉、、、 请教~~我的chart var chart = new Highcharts.Chart({
chart: {
height: 130,
renderTo: "container",
type: 'spline',
marginRight: 10,
events: {
load: function () {
// 每秒更新一次数据
var series = this.series[0];
setInterval(function () {
$.post("DataManager.ashx", { type: "getspots", name: name }, function (data) {
for (var x = 0; x < data.length; x++) {//筛选所需数据
if (data[x].value != "") {
if (data[x].name == name) {
realvalue = data[x].value;
}
}
}
}, 'json')
if (realvalue == undefined) {//排除异常数据
realvalue = 0;
}
else {
if (realvalue == "运行") {//特殊值
realvalue = 1;
}
realvalue = parseInt(realvalue);//转类型
}
var x = (new Date()).getTime() + 8 * 60 * 60 * 1000, // current time
y = realvalue;
series.addPoint([x, y], true, true);
}, 1000);
}
}
},
title: {
text: null
},
xAxis: {//X轴设置
type: 'datetime',
tickPixelInterval: 150
},
yAxis: {//Y轴设置
title: {
text: null
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {//提示窗显示信息
formatter: function () {
return '<b>' + this.series.name + '</b><br/>' +
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' +
Highcharts.numberFormat(this.y, 2);
}
},
legend: {
enabled: false
},
credits: {
enabled: false
},
exporting: {
enabled: false
},
plotOptions:{//
area: {
point: {
events: {
update: function () {
alert("asa")
//alert("change");
return false;
}
}
}
}
},
series: [{//数据集
name: name,
data: (function () {
var data = [],
time = (new Date()).getTime(),
i;
for (i = -180; i <= 0; i++) {
data.push({
x: time + i * 1000 + 8 * 60 * 60 * 1000,//这里取到的是格林志时间, 大约差8个小时
y: function () {
return 0;
}
});
}
return data;
})()
}]
});
area: {
point: {
events: {
update: function () {
alert("asa")
//alert("change");
return false;
}
}
}
}
},
这统计好丑
这统计好丑
主要要求多个地点的显示、、 我把图表 整成小几百X小几百、、 自然会丑、、 其实我也不想的~~
这统计好丑原本我还给设了点间距、、 但老板说不要、 要可用面积大、、 我就没话说了
lineWidth: 1.5,// 线条粗线
fillOpacity: 0.1, //
er: {
enabled: false, //不显示点
states: {
hover: {
enabled: true, //mouseover 时显示点
radius: 5 // mouseover 时 点的大小
}
}
},
shadow: false
}希望能帮助到你