let tooltip display flags

This commit is contained in:
c9s 2014-05-22 23:14:46 +08:00
parent faaaeb5f90
commit 546fcb14af
2 changed files with 53 additions and 12 deletions

View file

@ -70,10 +70,43 @@
}, },
tooltip: { tooltip: {
// headerFormat: '<span style="font-size: 10px">{point.key}: </span><br/>',
formatter: function() {
var s = '';
var comment = this.points[1].point.comment;
// new Date(this.x) + ':';
if (comment) {
s += '<span style="font-size: 10px;">';
s += comment;
s += '</span><br/>';
}
$.each(this.points, function(i, point) {
s += '<span style="color:' + point.series.color + '">\u25CF</span> ' + point.series.name + ': <b>' + point.y + '</b><br/>';
});
return s;
},
shared: true, shared: true,
crosshairs: true crosshairs: true
}, },
/*
tooltip: {
formatter: function() {
var s = '';
$.each(this.points, function(i, point) {
s += point.series.name +': '+ point.y + '<br/>';
});
if (this.points[1] && this.points[1].comment) {
s += '<b>'+ this.points[1].comment +'</b>';
}
return s;
},
shared: true
},
*/
plotOptions: { plotOptions: {
/* /*
area: { area: {
@ -137,16 +170,24 @@
var lines = data.split(/\n/); var lines = data.split(/\n/);
$(lines).each(function(i,line) { $(lines).each(function(i,line) {
/*
{ marker: {
fillColor: '#FF0000',
lineWidth: 3,
lineColor: "#FF0000" // inherit from series
}
*/
var columns = line.split(/,/); var columns = line.split(/,/);
var a;
a = parseInt(columns[1]);
options.series[0].data.push(a || 0);
a = parseInt(columns[2]); var commentText = columns[4];
options.series[1].data.push(a || 0); for (var i = 1; i < 4; i++ ) {
var a = parseInt(columns[i]);
a = parseInt(columns[3]); var args = a ?
options.series[2].data.push(a || 0); (commentText ? { y: a, comment: commentText } : a)
: 0;
options.series[i-1].data.push(args);
}
}); });
$('#chart').highcharts(options); $('#chart').highcharts(options);

View file

@ -461,7 +461,7 @@
1400750512,10126746.58 1400750512,10126746.58
1400750536,10568568.26 1400750536,10568568.26
1400762875,10472029.42 1400762875,10472029.42
1400764426,10066458.45,1590373.41 1400764426,10066458.45,1590373.41,0,flag
1400765068,10657617.64,2131810.12 1400765068,10657617.64,2131810.12,0,flag
1400766518,10259200.94,1878279.25,96697.86 1400766518,10259200.94,1878279.25,96697.86,flag1
1400766623,11057429.08,2113683.19,95835.70 1400766623,11057429.08,2113683.19,95835.70,flag2

Can't render this file because it has a wrong number of fields in line 464.