Highcharts tooltip is not working for large data - highcharts

Need your help.
I am using Highcharts to generate graphs in that I am facing following issue. For large data, tooltip is not working for the first time. after i zoom in, the tooltip is working as expected.Please help. following is the fiddle
http://jsfiddle.net/615Lfz15/
$(document).ready(function() {
var data1 =[{"maximumLean":4.7,"usl":5.5,"framesFlag":0,"emptyConesFlag":0,"ninetyFivePFlag":0,"inSpec":100.0,"arrow":0,"ninetyFivePValue":0.3,"mean":4.5,"meanFlag":0,"addDate":"08-12-2014 10:00:01","conesFlag":0,"targetSpec":4.5,"cpm":54.0,"emptyCone":13.7,"ninetyPFlag":0,"lsl":3.5,"minimumLean":4.2,"sampleSize":30,"ninetyPValue":0.2,"sd":0.1,"fpm":46.6,"fc":466,"lean":3.8,"median":4.5,"medianFlag":0,"inspecFlag":0,"cl":4.5,"sdFlag":0,"cc":540},{"lean":4.9,"addDate":"08-12-2014 10:00:01"},{"lean":4.2,"addDate":"08-12-2014 10:00:01"},{"lean":3.5,"addDate":"08-12-2014 10:00:01"},{"lean":3.9,"addDate":"08-12-2014 10:00:01"},{"lean":3.2,"addDate":"08-12-2014 10:00:01"},{"lean":4.3,"addDate":"08-12-2014 10:00:01"},{"lean":3.9,"addDate":"08-12-2014 10:00:01"},{"lean":4.6,"addDate":"08-12-2014 10:00:01"},{"lean":4.6,"addDate":"08-12-2014 10:00:01"},{"lean":4.0,"addDate":"08-12-2014 10:00:01"},{"lean":3.9,"addDate":"08-12-2014 10:00:01"},{"lean":3.5,"addDate":"08-12-2014 10:00:01"},{"lean":5.1,"addDate":"08-12-2014 10:00:01"},{"lean":4.0,"addDate":"08-12-2014 10:00:01"},{"lean":4.1,"addDate":"08-12-2014 10:00:01"},{"lean":4.1,"addDate":"08-12-2014 10:00:01"},{"lean":4.4,"addDate":"08-12-2014 10:00:01"},{"lean":4.3,"addDate":"08-12-2014 10:00:01"},{"lean":3.8,"addDate":"08-12-2014 10:00:01"},{"lean":4.8,"addDate":"08-12-2014 10:00:01"},{"lean":4.7,"addDate":"08-12-2014 10:00:01"},{"lean":5.2,"addDate":"08-12-2014 10:00:01"},{"lean":4.8,"addDate":"08-12-2014 10:00:01"},{"lean":3.1,"addDate":"08-12-2014 10:00:01"},{"lean":3.9,"addDate":"08-12-2014 10:00:01"},{"lean":5.9,"addDate":"08-12-2014 10:00:01"},{"lean":3.8,"addDate":"08-12-2014 10:00:01"},{"lean":3.6,"addDate":"08-12-2014 10:00:01"},{"lean":5.1,"addDate":"08-12-2014 10:00:01"},{"lean":4.1,"addDate":"08-12-2014 10:00:01"},{"lean":4.1,"addDate":"08-12-2014 10:00:01"},{"lean":5.1,"addDate":"08-12-2014 10:00:01"},{"lean":4.1,"addDate":"08-12-2014 10:00:01"},{"lean":5.1,"addDate":"08-12-2014 10:00:01"},{"lean":3.7,"addDate":"08-12-2014 10:00:01"},{"lean":5.0,"addDate":"08-12-2014 10:00:01"},{"lean":4.5,"addDate":"08-12-2014 10:00:01"},{"lean":5.2,"addDate":"08-12-2014 10:00:01"},{"lean":3.8,"addDate":"08-12-2014 10:00:01"},{"lean":4.3,"addDate":"08-12-2014 10:00:01"},{"lean":5.3,"addDate":"08-12-2014 10:00:01"},{"lean":4.2,"addDate":"08-12-2014 10:00:01"},{"lean":5.7,"addDate":"08-12-2014 10:00:01"},{"lean":3.7,"addDate":"08-12-2014 10:00:01"},{"lean":3.8,"addDate":"08-12-2014 10:00:01"},{"lean":4.0,"addDate":"08-12-2014 10:00:01"},{"lean":4.8,"addDate":"08-12-2014 10:00:01"},{"lean":5.5,"addDate":"08-12-2014 10:01:01"},{"lean":3.8,"addDate":"08-12-2014 10:01:01"},{"lean":5.0,"addDate":"08-12-2014 10:01:01"},{"lean":4.1,"addDate":"08-12-2014 10:01:01"},{"lean":4.1,"addDate":"08-12-2014 10:01:01"},{"lean":4.8,"addDate":"08-12-2014 10:01:01"},{"lean":4.2,"addDate":"08-12-2014 10:01:01"},{"lean":4.7,"addDate":"08-12-2014 10:01:01"},{"lean":4.7,"addDate":"08-12-2014 10:01:01"},{"lean":3.7,"addDate":"08-12-2014 10:01:01"},{"lean":3.9,"addDate":"08-12-2014 10:01:01"},{"lean":4.8,"addDate":"08-12-2014 10:01:01"},{"lean":4.5,"addDate":"08-12-2014 10:01:01"},{"lean":5.0,"addDate":"08-12-2014 10:01:01"},{"lean":4.7,"addDate":"08-12-2014 10:01:01"},{"lean":4.4,"addDate":"08-12-2014 10:01:01"},{"lean":3.8,"addDate":"08-12-2014 10:01:01"},{"lean":4.8,"addDate":"08-12-2014 10:01:01"},{"lean":5.6,"addDate":"08-12-2014 10:01:01"},{"lean":4.2,"addDate":"08-12-2014 10:01:01"},{"lean":3.8,"addDate":"08-12-2014 10:01:01"},{"lean":4.2,"addDate":"08-12-2014 10:01:01"},{"lean":4.0,"addDate":"08-12-2014 10:01:01"},{"lean":6.1,"addDate":"08-12-2014 10:01:01"},{"lean":4.1,"addDate":"08-12-2014 10:01:01"},{"lean":4.9,"addDate":"08-12-2014 10:01:01"},{"lean":4.4,"addDate":"08-12-2014 10:01:01"},{"lean":4.8,"addDate":"08-12-2014 10:01:01"},{"lean":3.7,"addDate":"08-12-2014 10:01:01"},{"lean":4.6,"addDate":"08-12-2014 10:01:01"},{"lean":4.9,"addDate":"08-12-2014 10:01:01"},{"lean":5.0,"addDate":"08-12-2014 10:01:01"},{"lean":3.9,"addDate":"08-12-2014 10:01:01"},{"lean":5.2,"addDate":"08-12-2014 10:01:01"},{"lean":4.9,"addDate":"08-12-2014 10:01:01"},{"lean":4.4,"addDate":"08-12-2014 10:01:01"},{"lean":5.4,"addDate":"08-12-2014 10:01:01"},{"lean":4.5,"addDate":"08-12-2014 10:01:01"},{"lean":4.6,"addDate":"08-12-2014 10:01:01"},{"lean":4.6,"addDate":"08-12-2014 10:01:01"},{"lean":5.3,"addDate":"08-12-2014 10:01:01"},{"lean":5.2,"addDate":"08-12-2014 10:01:01"},{"lean":4.8,"addDate":"08-12-2014 10:01:01"},{"lean":5.2,"addDate":"08-12-2014 10:01:01"},{"lean":5.2,"addDate":"08-12-2014 10:01:01"},{"lean":3.8,"addDate":"08-12-2014 10:01:01"},{"lean":5.7,"addDate":"08-12-2014 10:01:01"},{"lean":4.3,"addDate":"08-12-2014 10:02:01"},{"lean":4.4,"addDate":"08-12-2014 10:02:01"},{"lean":4.6,"addDate":"08-12-2014 10:02:01"},{"lean":5.0,"addDate":"08-12-2014 10:02:01"},{"lean":4.1,"addDate":"08-12-2014 10:02:01"},{"lean":4.9,"addDate":"08-12-2014 10:02:01"},{"lean":4.4,"addDate":"08-12-2014 10:02:01"},{"lean":3.5,"addDate":"08-12-2014 10:02:01"},{"lean":5.8,"addDate":"08-12-2014 10:02:01"},{"lean":4.1,"addDate":"08-12-2014 10:02:01"},{"lean":3.6,"addDate":"08-12-2014 10:02:01"},{"lean":5.4,"addDate":"08-12-2014 10:02:01"},{"lean":3.6,"addDate":"08-12-2014 10:02:01"},{"lean":5.1,"addDate":"08-12-2014 10:02:01"},{"lean":4.9,"addDate":"08-12-2014 10:02:01"},{"lean":5.6,"addDate":"08-12-2014 10:02:01"},{"lean":4.6,"addDate":"08-12-2014 10:02:01"},{"lean":4.6,"addDate":"08-12-2014 10:02:01"},{"lean":4.8,"addDate":"08-12-2014 10:02:01"},{"lean":3.6,"addDate":"08-12-2014 10:02:01"},{"lean":4.5,"addDate":"08-12-2014 10:02:02"},{"lean":5.0,"addDate":"08-12-2014 10:02:02"},{"lean":5.1,"addDate":"08-12-2014 10:02:02"},{"lean":5.9,"addDate":"08-12-2014 10:02:02"},{"lean":4.6,"addDate":"08-12-2014 10:02:02"},{"lean":4.7,"addDate":"08-12-2014 10:02:02"},{"lean":5.7,"addDate":"08-12-2014 10:02:02"},{"lean":5.7,"addDate":"08-12-2014 10:02:02"},{"lean":4.1,"addDate":"08-12-2014 10:02:02"},{"lean":3.4,"addDate":"08-12-2014 10:02:02"},{"lean":4.9,"addDate":"08-12-2014 10:02:02"},{"lean":6.1,"addDate":"08-12-2014 10:02:02"},{"lean":3.8,"addDate":"08-12-2014 10:02:02"},{"lean":4.1,"addDate":"08-12-2014 10:02:02"},{"lean":4.8,"addDate":"08-12-2014 10:02:02"},{"lean":4.5,"addDate":"08-12-2014 10:02:02"},{"lean":3.4,"addDate":"08-12-2014 10:02:02"},{"lean":3.5,"addDate":"08-12-2014 10:02:02"},{"lean":4.3,"addDate":"08-12-2014 10:02:02"},{"lean":4.0,"addDate":"08-12-2014 10:02:02"},{"lean":4.7,"addDate":"08-12-2014 10:02:02"},{"lean":4.6,"addDate":"08-12-2014 10:02:02"},{"lean":4.3,"addDate":"08-12-2014 10:02:02"},{"lean":4.7,"addDate":"08-12-2014 10:02:02"},{"lean":3.3,"addDate":"08-12-2014 10:02:02"},{"lean":4.6,"addDate":"08-12-2014 10:02:02"},{"lean":5.0,"addDate":"08-12-2014 10:02:02"},{"lean":4.6,"addDate":"08-12-2014 10:03:01"},{"lean":5.2,"addDate":"08-12-2014 10:03:01"},{"lean":4.4,"addDate":"08-12-2014 10:03:01"},{"lean":5.9,"addDate":"08-12-2014 10:03:01"},{"lean":3.1,"addDate":"08-12-2014 10:03:01"},{"lean":4.0,"addDate":"08-12-2014 10:03:01"},{"lean":4.2,"addDate":"08-12-2014 10:03:01"},{"lean":4.9,"addDate":"08-12-2014 10:03:01"},{"lean":4.1,"addDate":"08-12-2014 10:03:01"},{"lean":4.6,"addDate":"08-12-2014 10:03:01"},{"lean":3.6,"addDate":"08-12-2014 10:03:01"},{"lean":4.1,"addDate":"08-12-2014 10:03:01"},{"lean":5.4,"addDate":"08-12-2014 10:03:01"},{"lean":4.7,"addDate":"08-12-2014 10:03:01"},{"lean":5.0,"addDate":"08-12-2014 10:03:01"},{"lean":5.0,"addDate":"08-12-2014 10:03:01"},{"lean":4.4,"addDate":"08-12-2014 10:03:01"},{"lean":3.6,"addDate":"08-12-2014 10:03:01"},{"lean":5.0,"addDate":"08-12-2014 10:03:01"},{"lean":5.1,"addDate":"08-12-2014 10:03:01"},{"lean":5.5,"addDate":"08-12-2014 10:03:01"},{"lean":4.6,"addDate":"08-12-2014 10:03:01"},{"lean":4.7,"addDate":"08-12-2014 10:03:01"},{"lean":5.5,"addDate":"08-12-2014 10:03:01"},{"lean":3.9,"addDate":"08-12-2014 10:03:01"},{"lean":4.8,"addDate":"08-12-2014 10:03:01"},{"lean":5.3,"addDate":"08-12-2014 10:03:01"},{"lean":4.7,"addDate":"08-12-2014 10:03:01"},{"lean":3.2,"addDate":"08-12-2014 10:03:01"},{"lean":4.6,"addDate":"08-12-2014 10:03:01"},{"lean":3.4,"addDate":"08-12-2014 10:03:01"},{"lean":5.4,"addDate":"08-12-2014 10:03:01"},{"lean":4.9,"addDate":"08-12-2014 10:03:01"},{"lean":4.9,"addDate":"08-12-2014 10:03:01"},{"lean":5.1,"addDate":"08-12-2014 10:03:01"},{"lean":5.5,"addDate":"08-12-2014 10:03:01"},{"lean":3.5,"addDate":"08-12-2014 10:03:01"},{"lean":3.7,"addDate":"08-12-2014 10:03:01"},{"lean":4.9,"addDate":"08-12-2014 10:03:01"},{"lean":5.7,"addDate":"08-12-2014 10:03:02"},{"lean":4.0,"addDate":"08-12-2014 10:03:02"},{"lean":3.8,"addDate":"08-12-2014 10:03:02"},{"lean":3.6,"addDate":"08-12-2014 10:03:02"},{"lean":5.1,"addDate":"08-12-2014 10:03:02"},{"lean":3.6,"addDate":"08-12-2014 10:03:02"},{"lean":5.1,"addDate":"08-12-2014 10:03:02"},{"lean":4.8,"addDate":"08-12-2014 10:03:02"},{"lean":5.4,"addDate":"08-12-2014 10:03:02"},{"lean":5.6,"addDate":"08-12-2014 10:04:02"},{"lean":5.2,"addDate":"08-12-2014 10:04:02"},{"lean":4.8,"addDate":"08-12-2014 10:04:02"},{"lean":5.0,"addDate":"08-12-2014 10:04:02"},{"lean":5.1,"addDate":"08-12-2014 10:04:02"},{"lean":4.6,"addDate":"08-12-2014 10:04:02"},{"lean":3.6,"addDate":"08-12-2014 10:04:02"},{"lean":4.8,"addDate":"08-12-2014 10:04:02"},{"lean":4.1,"addDate":"08-12-2014 10:04:02"},{"lean":3.9,"addDate":"08-12-2014 10:04:02"},{"lean":4.5,"addDate":"08-12-2014 10:04:02"},{"lean":3.6,"addDate":"08-12-2014 10:04:02"},{"lean":4.5,"addDate":"08-12-2014 10:04:02"},{"lean":3.7,"addDate":"08-12-2014 10:04:02"},{"lean":4.8,"addDate":"08-12-2014 10:04:02"},{"lean":4.5,"addDate":"08-12-2014 10:04:02"},{"lean":5.4,"addDate":"08-12-2014 10:04:02"},{"lean":5.5,"addDate":"08-12-2014 10:04:02"},{"lean":5.4,"addDate":"08-12-2014 10:04:02"},{"lean":4.3,"addDate":"08-12-2014 10:04:02"},{"lean":3.7,"addDate":"08-12-2014 10:04:02"},{"lean":3.9,"addDate":"08-12-2014 10:04:02"},{"lean":4.2,"addDate":"08-12-2014 10:04:02"},{"lean":5.3,"addDate":"08-12-2014 10:04:02"},{"lean":5.1,"addDate":"08-12-2014 10:04:02"},{"lean":5.0,"addDate":"08-12-2014 10:04:02"},{"lean":5.7,"addDate":"08-12-2014 10:04:02"},{"lean":4.0,"addDate":"08-12-2014 10:04:02"},{"lean":5.0,"addDate":"08-12-2014 10:04:02"},{"lean":4.5,"addDate":"08-12-2014 10:04:02"},{"lean":4.6,"addDate":"08-12-2014 10:04:02"},{"lean":5.6,"addDate":"08-12-2014 10:04:02"},{"lean":5.7,"addDate":"08-12-2014 10:04:02"},{"lean":4.0,"addDate":"08-12-2014 10:04:02"},{"lean":4.8,"addDate":"08-12-2014 10:04:02"},{"lean":3.9,"addDate":"08-12-2014 10:04:02"},{"lean":3.5,"addDate":"08-12-2014 10:04:02"},{"lean":5.6,"addDate":"08-12-2014 10:04:02"},{"lean":3.5,"addDate":"08-12-2014 10:04:02"},{"lean":4.7,"addDate":"08-12-2014 10:04:02"},{"lean":4.7,"addDate":"08-12-2014 10:04:02"},{"lean":4.3,"addDate":"08-12-2014 10:04:02"},{"lean":3.5,"addDate":"08-12-2014 10:04:02"},{"lean":5.1,"addDate":"08-12-2014 10:04:02"},{"lean":3.8,"addDate":"08-12-2014 10:04:02"},{"lean":4.3,"addDate":"08-12-2014 10:05:01"},{"lean":4.7,"addDate":"08-12-2014 10:05:01"},{"lean":3.8,"addDate":"08-12-2014 10:05:01"},{"lean":4.6,"addDate":"08-12-2014 10:05:01"},{"lean":4.6,"addDate":"08-12-2014 10:05:01"},{"lean":3.5,"addDate":"08-12-2014 10:05:01"},{"lean":4.3,"addDate":"08-12-2014 10:05:01"},{"lean":5.5,"addDate":"08-12-2014 10:05:01"},{"lean":4.3,"addDate":"08-12-2014 10:05:01"},{"lean":4.6,"addDate":"08-12-2014 10:05:01"},{"lean":4.4,"addDate":"08-12-2014 10:05:01"},{"lean":3.8,"addDate":"08-12-2014 10:05:01"},{"lean":4.2,"addDate":"08-12-2014 10:05:01"},{"lean":4.6,"addDate":"08-12-2014 10:05:01"},{"lean":3.7,"addDate":"08-12-2014 10:05:01"},{"lean":3.8,"addDate":"08-12-2014 10:05:01"},{"lean":5.0,"addDate":"08-12-2014 10:05:01"},{"lean":4.4,"addDate":"08-12-2014 10:05:01"},{"lean":4.0,"addDate":"08-12-2014 10:05:01"},{"lean":5.6,"addDate":"08-12-2014 10:05:01"},{"lean":4.9,"addDate":"08-12-2014 10:05:01"},{"lean":4.3,"addDate":"08-12-2014 10:05:01"},{"lean":4.2,"addDate":"08-12-2014 10:05:01"},{"lean":4.0,"addDate":"08-12-2014 10:05:01"},{"lean":5.3,"addDate":"08-12-2014 10:05:01"},{"lean":3.4,"addDate":"08-12-2014 10:05:01"},{"lean":5.0,"addDate":"08-12-2014 10:05:01"},{"lean":4.2,"addDate":"08-12-2014 10:05:01"},{"lean":4.7,"addDate":"08-12-2014 10:05:02"},{"lean":4.8,"addDate":"08-12-2014 10:05:02"},{"lean":5.5,"addDate":"08-12-2014 10:05:02"},{"lean":3.9,"addDate":"08-12-2014 10:05:02"},{"lean":5.3,"addDate":"08-12-2014 10:05:02"},{"lean":4.0,"addDate":"08-12-2014 10:05:02"},{"lean":3.9,"addDate":"08-12-2014 10:05:02"},{"lean":3.7,"addDate":"08-12-2014 10:05:02"},{"lean":6.2,"addDate":"08-12-2014 10:05:02"},{"lean":4.6,"addDate":"08-12-2014 10:05:02"},{"lean":4.4,"addDate":"08-12-2014 10:05:02"},{"lean":4.5,"addDate":"08-12-2014 10:05:02"},{"lean":4.8,"addDate":"08-12-2014 10:05:02"},{"lean":4.8,"addDate":"08-12-2014 10:05:02"},{"lean":3.9,"addDate":"08-12-2014 10:05:02"},{"lean":4.7,"addDate":"08-12-2014 10:05:02"},{"lean":3.6,"addDate":"08-12-2014 10:05:02"},{"lean":5.3,"addDate":"08-12-2014 10:05:02"},{"lean":4.5,"addDate":"08-12-2014 10:05:02"},{"lean":3.4,"addDate":"08-12-2014 10:06:01"},{"lean":4.6,"addDate":"08-12-2014 10:06:01"},{"lean":5.4,"addDate":"08-12-2014 10:06:01"},{"lean":4.0,"addDate":"08-12-2014 10:06:01"},{"lean":4.0,"addDate":"08-12-2014 10:06:01"},{"lean":4.9,"addDate":"08-12-2014 10:06:01"},{"lean":5.9,"addDate":"08-12-2014 10:06:01"},{"lean":4.1,"addDate":"08-12-2014 10:06:01"},{"lean":4.9,"addDate":"08-12-2014 10:06:01"},{"lean":3.3,"addDate":"08-12-2014 10:06:01"},{"lean":3.9,"addDate":"08-12-2014 10:06:01"},{"lean":3.9,"addDate":"08-12-2014 10:06:01"},{"lean":4.0,"addDate":"08-12-2014 10:06:01"},{"lean":4.5,"addDate":"08-12-2014 10:06:01"},{"lean":4.2,"addDate":"08-12-2014 10:06:01"},{"lean":4.1,"addDate":"08-12-2014 10:06:01"},{"lean":4.8,"addDate":"08-12-2014 10:06:01"},{"lean":4.8,"addDate":"08-12-2014 10:06:01"},{"lean":5.2,"addDate":"08-12-2014 10:06:01"},{"lean":4.6,"addDate":"08-12-2014 10:06:01"},{"lean":4.3,"addDate":"08-12-2014 10:06:01"},{"lean":4.3,"addDate":"08-12-2014 10:06:01"},{"lean":3.8,"addDate":"08-12-2014 10:06:01"},{"lean":3.7,"addDate":"08-12-2014 10:06:01"},{"lean":4.7,"addDate":"08-12-2014 10:06:01"},{"lean":5.3,"addDate":"08-12-2014 10:06:01"},{"lean":4.7,"addDate":"08-12-2014 10:06:02"},{"lean":4.0,"addDate":"08-12-2014 10:06:02"},{"lean":5.1,"addDate":"08-12-2014 10:06:02"},{"lean":4.6,"addDate":"08-12-2014 10:06:02"},{"lean":5.1,"addDate":"08-12-2014 10:06:02"},{"lean":4.3,"addDate":"08-12-2014 10:06:02"},{"lean":5.3,"addDate":"08-12-2014 10:06:02"},{"lean":4.9,"addDate":"08-12-2014 10:06:02"},{"lean":4.0,"addDate":"08-12-2014 10:06:02"},{"lean":4.1,"addDate":"08-12-2014 10:06:02"},{"lean":5.4,"addDate":"08-12-2014 10:06:02"},{"lean":4.1,"addDate":"08-12-2014 10:06:02"},{"lean":4.9,"addDate":"08-12-2014 10:06:02"},{"lean":3.6,"addDate":"08-12-2014 10:06:02"},{"lean":4.0,"addDate":"08-12-2014 10:06:02"},{"lean":4.1,"addDate":"08-12-2014 10:06:02"},{"lean":4.1,"addDate":"08-12-2014 10:06:02"},{"lean":4.2,"addDate":"08-12-2014 10:06:02"},{"lean":4.2,"addDate":"08-12-2014 10:06:02"},{"lean":4.2,"addDate":"08-12-2014 10:06:02"},{"lean":4.7,"addDate":"08-12-2014 10:06:02"},{"lean":4.5,"addDate":"08-12-2014 10:06:02"},{"lean":4.0,"addDate":"08-12-2014 10:06:02"},{"lean":2.9,"addDate":"08-12-2014 10:07:01"},{"lean":4.8,"addDate":"08-12-2014 10:07:01"},{"lean":5.2,"addDate":"08-12-2014 10:07:01"},{"lean":4.1,"addDate":"08-12-2014 10:07:01"},{"lean":5.6,"addDate":"08-12-2014 10:07:01"},{"lean":4.2,"addDate":"08-12-2014 10:07:01"},{"lean":5.5,"addDate":"08-12-2014 10:07:01"},{"lean":5.1,"addDate":"08-12-2014 10:07:01"},{"lean":4.4,"addDate":"08-12-2014 10:07:01"},{"lean":5.0,"addDate":"08-12-2014 10:07:01"},{"lean":4.0,"addDate":"08-12-2014 10:07:01"},{"lean":4.1,"addDate":"08-12-2014 10:07:01"},{"lean":4.4,"addDate":"08-12-2014 10:07:01"},{"lean":3.2,"addDate":"08-12-2014 10:07:01"},{"lean":3.9,"addDate":"08-12-2014 10:07:01"},{"lean":5.2,"addDate":"08-12-2014 10:07:01"},{"lean":4.0,"addDate":"08-12-2014 10:07:01"},{"lean":4.2,"addDate":"08-12-2014 10:07:01"},{"lean":4.5,"addDate":"08-12-2014 10:07:01"},{"lean":5.2,"addDate":"08-12-2014 10:07:01"},{"lean":5.7,"addDate":"08-12-2014 10:07:01"},{"lean":3.6,"addDate":"08-12-2014 10:07:01"},{"lean":3.3,"addDate":"08-12-2014 10:07:01"},{"lean":4.2,"addDate":"08-12-2014 10:07:02"},{"lean":5.7,"addDate":"08-12-2014 10:07:02"},{"lean":4.7,"addDate":"08-12-2014 10:07:02"},{"lean":3.8,"addDate":"08-12-2014 10:07:02"},{"lean":5.0,"addDate":"08-12-2014 10:07:02"},{"lean":3.8,"addDate":"08-12-2014 10:07:02"},{"lean":5.1,"addDate":"08-12-2014 10:07:02"},{"lean":4.6,"addDate":"08-12-2014 10:07:02"},{"lean":4.0,"addDate":"08-12-2014 10:07:02"},{"lean":4.4,"addDate":"08-12-2014 10:07:02"},{"lean":5.7,"addDate":"08-12-2014 10:07:02"},{"lean":5.5,"addDate":"08-12-2014 10:07:02"},{"lean":3.7,"addDate":"08-12-2014 10:07:02"},{"lean":4.7,"addDate":"08-12-2014 10:07:02"},{"lean":4.3,"addDate":"08-12-2014 10:07:02"},{"lean":4.0,"addDate":"08-12-2014 10:07:02"},{"lean":5.2,"addDate":"08-12-2014 10:07:02"},{"lean":5.2,"addDate":"08-12-2014 10:07:02"},{"lean":4.5,"addDate":"08-12-2014 10:07:02"},{"lean":4.6,"addDate":"08-12-2014 10:07:02"},{"lean":5.6,"addDate":"08-12-2014 10:07:02"},{"lean":4.6,"addDate":"08-12-2014 10:08:01"},{"lean":4.2,"addDate":"08-12-2014 10:08:01"},{"lean":4.6,"addDate":"08-12-2014 10:08:01"},{"lean":5.4,"addDate":"08-12-2014 10:08:01"},{"lean":3.6,"addDate":"08-12-2014 10:08:01"},{"lean":3.0,"addDate":"08-12-2014 10:08:01"},{"lean":5.6,"addDate":"08-12-2014 10:08:01"},{"lean":3.9,"addDate":"08-12-2014 10:08:01"},{"lean":5.3,"addDate":"08-12-2014 10:08:01"},{"lean":5.2,"addDate":"08-12-2014 10:08:01"},{"lean":4.7,"addDate":"08-12-2014 10:08:01"},{"lean":4.3,"addDate":"08-12-2014 10:08:01"},{"lean":5.5,"addDate":"08-12-2014 10:08:01"},{"lean":6.0,"addDate":"08-12-2014 10:08:01"},{"lean":4.7,"addDate":"08-12-2014 10:08:01"},{"lean":4.1,"addDate":"08-12-2014 10:08:01"},{"lean":5.5,"addDate":"08-12-2014 10:08:01"},{"lean":5.5,"addDate":"08-12-2014 10:08:01"},{"lean":3.8,"addDate":"08-12-2014 10:08:01"},{"lean":4.5,"addDate":"08-12-2014 10:08:01"},{"lean":5.1,"addDate":"08-12-2014 10:08:01"},{"lean":3.5,"addDate":"08-12-2014 10:08:01"},{"lean":5.2,"addDate":"08-12-2014 10:08:01"},{"lean":3.7,"addDate":"08-12-2014 10:08:01"},{"lean":4.0,"addDate":"08-12-2014 10:08:01"},{"lean":4.3,"addDate":"08-12-2014 10:08:01"},{"lean":4.6,"addDate":"08-12-2014 10:08:01"},{"lean":4.5,"addDate":"08-12-2014 10:08:01"},{"lean":5.1,"addDate":"08-12-2014 10:08:01"},{"lean":4.2,"addDate":"08-12-2014 10:08:01"},{"lean":3.7,"addDate":"08-12-2014 10:08:01"},{"lean":3.4,"addDate":"08-12-2014 10:08:01"},{"lean":4.7,"addDate":"08-12-2014 10:08:01"},{"lean":4.2,"addDate":"08-12-2014 10:08:01"},{"lean":5.3,"addDate":"08-12-2014 10:08:01"},{"lean":5.2,"addDate":"08-12-2014 10:08:01"},{"lean":3.6,"addDate":"08-12-2014 10:08:01"},{"lean":5.0,"addDate":"08-12-2014 10:08:01"},{"lean":4.6,"addDate":"08-12-2014 10:08:01"},{"lean":5.0,"addDate":"08-12-2014 10:08:01"},{"lean":5.3,"addDate":"08-12-2014 10:08:01"},{"lean":3.4,"addDate":"08-12-2014 10:08:01"},{"lean":4.5,"addDate":"08-12-2014 10:08:01"},{"lean":4.9,"addDate":"08-12-2014 10:09:01"},{"lean":5.5,"addDate":"08-12-2014 10:09:01"},{"lean":4.8,"addDate":"08-12-2014 10:09:01"},{"lean":4.0,"addDate":"08-12-2014 10:09:01"},{"lean":3.6,"addDate":"08-12-2014 10:09:01"},{"lean":5.6,"addDate":"08-12-2014 10:09:01"},{"lean":4.7,"addDate":"08-12-2014 10:09:01"},{"lean":3.2,"addDate":"08-12-2014 10:09:01"},{"lean":3.7,"addDate":"08-12-2014 10:09:01"},{"lean":3.6,"addDate":"08-12-2014 10:09:01"},{"lean":3.5,"addDate":"08-12-2014 10:09:01"},{"lean":5.0,"addDate":"08-12-2014 10:09:01"},{"lean":5.0,"addDate":"08-12-2014 10:09:01"},{"lean":3.6,"addDate":"08-12-2014 10:09:01"},{"lean":4.3,"addDate":"08-12-2014 10:09:01"},{"lean":4.9,"addDate":"08-12-2014 10:09:01"},{"lean":3.7,"addDate":"08-12-2014 10:09:01"},{"lean":3.4,"addDate":"08-12-2014 10:09:01"},{"lean":4.6,"addDate":"08-12-2014 10:09:01"},{"lean":4.2,"addDate":"08-12-2014 10:09:01"},{"lean":5.0,"addDate":"08-12-2014 10:09:01"},{"lean":4.3,"addDate":"08-12-2014 10:09:02"},{"lean":4.1,"addDate":"08-12-2014 10:09:02"},{"lean":4.4,"addDate":"08-12-2014 10:09:02"},{"lean":4.4,"addDate":"08-12-2014 10:09:02"},{"lean":5.3,"addDate":"08-12-2014 10:09:02"},{"lean":3.2,"addDate":"08-12-2014 10:09:02"},{"lean":4.1,"addDate":"08-12-2014 10:09:02"},{"lean":4.0,"addDate":"08-12-2014 10:09:02"},{"lean":3.5,"addDate":"08-12-2014 10:09:02"},{"lean":4.1,"addDate":"08-12-2014 10:09:02"},{"lean":4.3,"addDate":"08-12-2014 10:09:02"},{"lean":5.6,"addDate":"08-12-2014 10:09:02"},{"lean":4.3,"addDate":"08-12-2014 10:09:02"},{"lean":3.9,"addDate":"08-12-2014 10:09:02"},{"lean":4.7,"addDate":"08-12-2014 10:09:02"},{"lean":5.6,"addDate":"08-12-2014 10:09:02"},{"lean":4.5,"addDate":"08-12-2014 10:09:02"},{"lean":4.2,"addDate":"08-12-2014 10:09:02"},{"lean":4.9,"addDate":"08-12-2014 10:09:02"},{"lean":5.2,"addDate":"08-12-2014 10:09:02"},{"lean":5.1,"addDate":"08-12-2014 10:09:02"},{"lean":4.2,"addDate":"08-12-2014 10:09:02"},{"lean":5.3,"addDate":"08-12-2014 10:09:02"},{"lean":3.9,"addDate":"08-12-2014 10:09:02"},{"lean":5.4,"addDate":"08-12-2014 10:09:02"},{"lean":4.4,"addDate":"08-12-2014 10:09:02"},{"lean":3.3,"addDate":"08-12-2014 10:09:02"},{"start":"08-12-2014 10:00:00","end":"08-12-2014 10:10:00"}];
var x=1;
var dataofHighChart = [];
var meandataofHighChart = 0;
for(var event in data1){
var dataCopy = data1[event];
if(x==1){
meandataofHighChart =(dataCopy.mean);
console.info(meandataofHighChart);
}
dataofHighChart.push({
y:dataCopy.lean,
dateVal:dataCopy.addDate
});
x++;
}
var qaChart = new Highcharts.Chart({
chart: {
zoomType: "x",
renderTo: 'chart_div', // like
},
title: {
text: 'QA Chart', style: { "font-weight": "bold","font-size": "16px;"},
x: -20 //center
},
xAxis: {
floor: 1,
allowDecimals:false,
title: {
text: 'Frame Number',style: { "font-weight": "bold","font-size": "14px;"}
}
},
plotOptions: {
line: {
turboThreshold: x
}
},
tooltip: {
formatter: function () {
return 'Frame Number : '+this.point.x+'<br/> % Lean : '+this.point.y+ ' % <br/> Added Date : '+this.point.dateVal;
}
},
yAxis: {
title: {
text: '% Lean',style: { "font-weight": "bold","font-size": "14px;"}
},
plotLines: [{
value:meandataofHighChart,
color: 'red',
width:2,
zIndex:4,
label:{text:''}}]
},
series: [{
name: '% Lean',
data: dataofHighChart
}]
});
});

The problem is that in you loop you push a object with undefined point (y value) so you receive and error in highcharts (wrong path of line). Only what you need is add a condition which check a value of pushed y param.
if(dataCopy.lean!==UNDEFINED) {
dataofHighChart.push({
y: dataCopy.lean,
dateVal: dataCopy.addDate
});
}
Correct example: http://jsfiddle.net/sbochan/615Lfz15/1/

Related

Highchart zoom feature is not working. It is in https://jsfiddle.net/f0n31uqx/

JSON DATA
const rawData = [{"eventId":"c0nmqcdsvg8q9deq0m30","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.05,"updateTime":"2021-02-19T07:48:01.072000Z"}},"timestamp":"2021-02-19T07:48:01.072000Z"},{"eventId":"c0nmimfae9qf8j0ni8ug","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.05,"updateTime":"2021-02-19T07:31:37.195000Z"}},"timestamp":"2021-02-19T07:31:37.195000Z"},{"eventId":"c0nmb0cmksjn6fnmek40","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.1,"updateTime":"2021-02-19T07:15:13.736000Z"}},"timestamp":"2021-02-19T07:15:13.736000Z"},{"eventId":"c0nm3ani3sc4tff6o5lg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.05,"updateTime":"2021-02-19T06:58:50.348000Z"}},"timestamp":"2021-02-19T06:58:50.348000Z"},{"eventId":"c0nlrknae9qf8j0jd61g","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.2,"updateTime":"2021-02-19T06:42:26.798000Z"}},"timestamp":"2021-02-19T06:42:26.798000Z"},{"eventId":"c0nljuu4aaj3ehi66l70","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.15,"updateTime":"2021-02-19T06:26:03.456000Z"}},"timestamp":"2021-02-19T06:26:03.456000Z"},{"eventId":"c0nlc90snrvnmlvjjrp0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.1,"updateTime":"2021-02-19T06:09:40.150000Z"}},"timestamp":"2021-02-19T06:09:40.150000Z"},{"eventId":"c0nl4je4aaj3ehi3fbl0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.15,"updateTime":"2021-02-19T05:53:17.235000Z"}},"timestamp":"2021-02-19T05:53:17.235000Z"},{"eventId":"c0nkstgd11ttvapiroi0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.2,"updateTime":"2021-02-19T05:36:54.196000Z"}},"timestamp":"2021-02-19T05:36:54.196000Z"},{"eventId":"c0nkl7um6o2p5rlk17pg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.15,"updateTime":"2021-02-19T05:20:31.239000Z"}},"timestamp":"2021-02-19T05:20:31.239000Z"},{"eventId":"c0nkdi4mksjn6fnbecvg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.25,"updateTime":"2021-02-19T05:04:08.318000Z"}},"timestamp":"2021-02-19T05:04:08.318000Z"},{"eventId":"c0nk5ser46k56lsj00d0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.35,"updateTime":"2021-02-19T04:47:45.487000Z"}},"timestamp":"2021-02-19T04:47:45.487000Z"},{"eventId":"c0nju6l9m1grbnmn3pf0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.3,"updateTime":"2021-02-19T04:31:22.857000Z"}},"timestamp":"2021-02-19T04:31:22.857000Z"},{"eventId":"c0njmh4mksjn6fn7djmg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.35,"updateTime":"2021-02-19T04:15:00.072000Z"}},"timestamp":"2021-02-19T04:15:00.072000Z"},{"eventId":"c0njerbpv76emv1io31g","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.3,"updateTime":"2021-02-19T03:58:37.434000Z"}},"timestamp":"2021-02-19T03:58:37.434000Z"},{"eventId":"c0nj75od11ttvap97fm0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.4,"updateTime":"2021-02-19T03:42:15.454000Z"}},"timestamp":"2021-02-19T03:42:15.454000Z"},{"eventId":"c0nivg3pv76emv1g2gt0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.4,"updateTime":"2021-02-19T03:25:52.666000Z"}},"timestamp":"2021-02-19T03:25:52.666000Z"},{"eventId":"c0ninqg9scdqsoh00jog","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.4,"updateTime":"2021-02-19T03:09:30.356000Z"}},"timestamp":"2021-02-19T03:09:30.356000Z"},{"eventId":"c0nig50d11ttvap50q6g","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.4,"updateTime":"2021-02-19T02:53:08.042000Z"}},"timestamp":"2021-02-19T02:53:08.042000Z"},{"eventId":"c0ni8flolbcr7u23mffg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.5,"updateTime":"2021-02-19T02:36:45.869000Z"}},"timestamp":"2021-02-19T02:36:45.869000Z"},{"eventId":"c0ni0q7i3sc4tfefc000","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.45,"updateTime":"2021-02-19T02:20:23.995000Z"}},"timestamp":"2021-02-19T02:20:23.995000Z"},{"eventId":"c0nhp4mr46k56ls5aong","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.55,"updateTime":"2021-02-19T02:04:02.166000Z"}},"timestamp":"2021-02-19T02:04:02.166000Z"},{"eventId":"c0nhhf2b02gddfvc6au0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.55,"updateTime":"2021-02-19T01:47:40.400000Z"}},"timestamp":"2021-02-19T01:47:40.400000Z"},{"eventId":"c0nh9pgsnrvnmlusb56g","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.6,"updateTime":"2021-02-19T01:31:18.726000Z"}},"timestamp":"2021-02-19T01:31:18.726000Z"},{"eventId":"c0nh24ab02gddfv9dvm0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.55,"updateTime":"2021-02-19T01:14:57.091000Z"}},"timestamp":"2021-02-19T01:14:57.091000Z"},{"eventId":"c0ngqeu4aaj3ehhafq50","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.65,"updateTime":"2021-02-19T00:58:35.434000Z"}},"timestamp":"2021-02-19T00:58:35.434000Z"},{"eventId":"c0ngipgsnrvnmluo7otg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.6,"updateTime":"2021-02-19T00:42:13.986000Z"}},"timestamp":"2021-02-19T00:42:13.986000Z"},{"eventId":"c0ngb43pv76emv114au0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.7,"updateTime":"2021-02-19T00:25:52.898000Z"}},"timestamp":"2021-02-19T00:25:52.898000Z"},{"eventId":"c0ng3f5svg8q9ddk16ng","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.75,"updateTime":"2021-02-19T00:09:32.116000Z"}},"timestamp":"2021-02-19T00:09:32.116000Z"},{"eventId":"c0nfrpvi3sc4tfe31530","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.7,"updateTime":"2021-02-18T23:53:11.261000Z"}},"timestamp":"2021-02-18T23:53:11.261000Z"},{"eventId":"c0nfk4lsvg8q9ddhammg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.8,"updateTime":"2021-02-18T23:36:50.630000Z"}},"timestamp":"2021-02-18T23:36:50.630000Z"},{"eventId":"c0nfcfgsnrvnmluhea40","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.75,"updateTime":"2021-02-18T23:20:30.265000Z"}},"timestamp":"2021-02-18T23:20:30.265000Z"},{"eventId":"c0nf4qdsvg8q9ddei0q0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.85,"updateTime":"2021-02-18T23:04:09.819000Z"}},"timestamp":"2021-02-18T23:04:09.819000Z"},{"eventId":"c0net56r46k56lrkrjs0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.75,"updateTime":"2021-02-18T22:47:48.885000Z"}},"timestamp":"2021-02-18T22:47:48.885000Z"},{"eventId":"c0nelfsmksjn6fmas22g","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.65,"updateTime":"2021-02-18T22:31:27.612000Z"}},"timestamp":"2021-02-18T22:31:27.612000Z"},{"eventId":"c0nedqlolbcr7u1djesg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.65,"updateTime":"2021-02-18T22:15:06.439000Z"}},"timestamp":"2021-02-18T22:15:06.439000Z"},{"eventId":"c0ne658snrvnmlua76t0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.8,"updateTime":"2021-02-18T21:58:45.352000Z"}},"timestamp":"2021-02-18T21:58:45.352000Z"},{"eventId":"c0ndufum6o2p5rkcvib0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.8,"updateTime":"2021-02-18T21:42:23.890000Z"}},"timestamp":"2021-02-18T21:42:23.890000Z"},{"eventId":"c0ndmqmm6o2p5rkbjcog","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.8,"updateTime":"2021-02-18T21:26:02.848000Z"}},"timestamp":"2021-02-18T21:26:02.848000Z"},{"eventId":"c0ndf5mr46k56lrc84pg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.8,"updateTime":"2021-02-18T21:09:41.947000Z"}},"timestamp":"2021-02-18T21:09:41.947000Z"},{"eventId":"c0nd7g5olbcr7u16ltkg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.9,"updateTime":"2021-02-18T20:53:20.943000Z"}},"timestamp":"2021-02-18T20:53:20.943000Z"},{"eventId":"c0ncvr0snrvnmlu3afmg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.9,"updateTime":"2021-02-18T20:37:00.188000Z"}},"timestamp":"2021-02-18T20:37:00.188000Z"},{"eventId":"c0nco5tolbcr7u13tuv0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":22,"updateTime":"2021-02-18T20:20:39.569000Z"}},"timestamp":"2021-02-18T20:20:39.569000Z"},{"eventId":"c0ncggod11ttvao1vr50","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":22.1,"updateTime":"2021-02-18T20:04:19.446000Z"}},"timestamp":"2021-02-18T20:04:19.446000Z"},{"eventId":"c0nc8rjpv76emv09ik1g","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.9,"updateTime":"2021-02-18T19:47:58.911000Z"}},"timestamp":"2021-02-18T19:47:58.911000Z"},{"eventId":"c0nc16ms4leui3od2c6g","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.9,"updateTime":"2021-02-18T19:31:38.286000Z"}},"timestamp":"2021-02-18T19:31:38.286000Z"},{"eventId":"c0nbphfi3sc4tfdb5tpg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.8,"updateTime":"2021-02-18T19:15:17.605000Z"}},"timestamp":"2021-02-18T19:15:17.605000Z"},{"eventId":"c0nbhs09scdqsonmdp30","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.75,"updateTime":"2021-02-18T18:58:56.400000Z"}},"timestamp":"2021-02-18T18:58:56.400000Z"},{"eventId":"c0nba6p0niu96p24p2e0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.8,"updateTime":"2021-02-18T18:42:35.054000Z"}},"timestamp":"2021-02-18T18:42:35.054000Z"},{"eventId":"c0nb2hdolbcr7u0qa9f0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.85,"updateTime":"2021-02-18T18:26:13.835000Z"}},"timestamp":"2021-02-18T18:26:13.835000Z"},{"eventId":"c0naqs6s4leui3o5q6t0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.85,"updateTime":"2021-02-18T18:09:52.888000Z"}},"timestamp":"2021-02-18T18:09:52.888000Z"},{"eventId":"c0naj75olbcr7u0ngqjg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.8,"updateTime":"2021-02-18T17:53:32.020000Z"}},"timestamp":"2021-02-18T17:53:32.020000Z"},{"eventId":"c0nabhosnrvnmltk37ug","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.7,"updateTime":"2021-02-18T17:37:10.986000Z"}},"timestamp":"2021-02-18T17:37:10.986000Z"},{"eventId":"c0na3sdsvg8q9dch76e0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.8,"updateTime":"2021-02-18T17:20:49.740000Z"}},"timestamp":"2021-02-18T17:20:49.740000Z"},{"eventId":"c0n9s77ae9qf8j6dvblg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.9,"updateTime":"2021-02-18T17:04:28.841000Z"}},"timestamp":"2021-02-18T17:04:28.841000Z"},{"eventId":"c0n9ki6r46k56lqm58sg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.95,"updateTime":"2021-02-18T16:48:08.240000Z"}},"timestamp":"2021-02-18T16:48:08.240000Z"},{"eventId":"c0n9csvae9qf8j6b4sog","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.95,"updateTime":"2021-02-18T16:31:47.772000Z"}},"timestamp":"2021-02-18T16:31:47.772000Z"},{"eventId":"c0n957tolbcr7u0f4kq0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.95,"updateTime":"2021-02-18T16:15:27.199000Z"}},"timestamp":"2021-02-18T16:15:27.199000Z"},{"eventId":"c0n8timr46k56lqhncc0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.95,"updateTime":"2021-02-18T15:59:06.487000Z"}},"timestamp":"2021-02-18T15:59:06.487000Z"},{"eventId":"c0n8ltfi3sc4tfcojh00","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.85,"updateTime":"2021-02-18T15:42:45.815000Z"}},"timestamp":"2021-02-18T15:42:45.815000Z"},{"eventId":"c0n8e8fi3sc4tfcn2gi0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":22,"updateTime":"2021-02-18T15:26:25.358000Z"}},"timestamp":"2021-02-18T15:26:25.358000Z"},{"eventId":"c0n86jem6o2p5rjati6g","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":22.1,"updateTime":"2021-02-18T15:10:05.164000Z"}},"timestamp":"2021-02-18T15:10:05.164000Z"},{"eventId":"c0n7uue4aaj3ehnleue0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":22.1,"updateTime":"2021-02-18T14:53:45.280000Z"}},"timestamp":"2021-02-18T14:53:45.280000Z"},{"eventId":"c0n7n9er46k56lq9v0vg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":22.15,"updateTime":"2021-02-18T14:37:25.432000Z"}},"timestamp":"2021-02-18T14:37:25.432000Z"},{"eventId":"c0n7fk89scdqsomtc1eg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":22.15,"updateTime":"2021-02-18T14:21:05.624000Z"}},"timestamp":"2021-02-18T14:21:05.624000Z"},{"eventId":"c0n77vgsnrvnmlt0h5lg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":22.1,"updateTime":"2021-02-18T14:04:46.013000Z"}},"timestamp":"2021-02-18T14:04:46.013000Z"},{"eventId":"c0n70adsvg8q9dbtfmu0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.95,"updateTime":"2021-02-18T13:48:25.891000Z"}},"timestamp":"2021-02-18T13:48:25.891000Z"},{"eventId":"c0n6oler46k56lq3fu4g","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.7,"updateTime":"2021-02-18T13:32:05.042000Z"}},"timestamp":"2021-02-18T13:32:05.042000Z"},{"eventId":"c0n6gvtolbcr7u7tpcrg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.55,"updateTime":"2021-02-18T13:15:43.313000Z"}},"timestamp":"2021-02-18T13:15:43.313000Z"},{"eventId":"c0n69a6s4leui3v7bbs0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.45,"updateTime":"2021-02-18T12:59:20.800000Z"}},"timestamp":"2021-02-18T12:59:20.800000Z"},{"eventId":"c0n61ker46k56lpuha3g","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.3,"updateTime":"2021-02-18T12:42:57.819000Z"}},"timestamp":"2021-02-18T12:42:57.819000Z"},{"eventId":"c0n5pumm6o2p5riqi370","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.25,"updateTime":"2021-02-18T12:26:34.618000Z"}},"timestamp":"2021-02-18T12:26:34.618000Z"},{"eventId":"c0n5i8us4leui3v21kdg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.1,"updateTime":"2021-02-18T12:10:11.221000Z"}},"timestamp":"2021-02-18T12:10:11.221000Z"},{"eventId":"c0n5aismksjn6fki583g","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21.1,"updateTime":"2021-02-18T11:53:47.493000Z"}},"timestamp":"2021-02-18T11:53:47.493000Z"},{"eventId":"c0n52stolbcr7u7k6gdg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21,"updateTime":"2021-02-18T11:37:23.492000Z"}},"timestamp":"2021-02-18T11:37:23.492000Z"},{"eventId":"c0n4r6ur46k56lpmqen0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":21,"updateTime":"2021-02-18T11:20:59.393000Z"}},"timestamp":"2021-02-18T11:20:59.393000Z"},{"eventId":"c0n4jgvae9qf8j5bmc1g","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":20.85,"updateTime":"2021-02-18T11:04:35.010000Z"}},"timestamp":"2021-02-18T11:04:35.010000Z"},{"eventId":"c0n4bqlsvg8q9dbcht60","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":20.75,"updateTime":"2021-02-18T10:48:10.452000Z"}},"timestamp":"2021-02-18T10:48:10.452000Z"},{"eventId":"c0n444dolbcr7u7emrpg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":20.7,"updateTime":"2021-02-18T10:31:45.431000Z"}},"timestamp":"2021-02-18T10:31:45.431000Z"},{"eventId":"c0n3se7i3sc4tfbpemog","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":20.65,"updateTime":"2021-02-18T10:15:20.160000Z"}},"timestamp":"2021-02-18T10:15:20.160000Z"},{"eventId":"c0n3knm4aaj3ehmp9t9g","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":20.55,"updateTime":"2021-02-18T09:58:54.786000Z"}},"timestamp":"2021-02-18T09:58:54.786000Z"},{"eventId":"c0n3d1ab02gddfsn6shg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":20.55,"updateTime":"2021-02-18T09:42:29.261000Z"}},"timestamp":"2021-02-18T09:42:29.261000Z"},{"eventId":"c0n35asmksjn6fk5mgmg","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":20.45,"updateTime":"2021-02-18T09:26:03.369000Z"}},"timestamp":"2021-02-18T09:26:03.369000Z"},{"eventId":"c0n2tkvae9qf8j51p9og","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":22.35,"updateTime":"2021-02-18T09:09:39.064000Z"}},"timestamp":"2021-02-18T09:09:39.064000Z"},{"eventId":"c0n2s3nlq0bla05dqod0","targetName":"projects/bv2b8auslfo000c8vh1g/devices/bjejbgfbluqg00dltv60","eventType":"temperature","data":{"temperature":{"value":20.5,"updateTime":"2021-02-18T09:06:22.336000Z"}},"timestamp":"2021-02-18T09:06:22.336000Zā€}];
Highchart source code which is also in https://jsfiddle.net/f0n31uqx/
Zoom feature is not working.
Also rangeselector also not working
function formatData(data) {
let formattedData = [];
for(i = 0; i < data.length; i++) {
formattedData.push([
Math.floor(Date.parse(data[i]['data']['temperature']['updateTime'])),
data[i]['data']['temperature']['value']
])
}
return formattedData;
}
const formattedData = formatData(rawData);
console.log(formattedData);
Highcharts.stockChart('container', {
rangeSelector: {
selected: 1
},
title: {
text: 'Temprature'
},
series: [{
name: 'Temp',
data: formattedData,
tooltip: {
valueDecimals: 2
}
}]
});
For the record, I have checked the "include dependencies with Provided scope" option in Intellij. Also, I have excluded log4j-over-slf4j from my Dependencies so as not to cause conflicts in SLF4J, using the following line
You have unsorted data - Highcharts error #15 in a console: https://www.highcharts.com/errors/15/. You need to sort it before creating a chart.
formattedData.sort(function(a, b) {
return a[0] - b[0];
});
Live demo: https://jsfiddle.net/BlackLabel/859zy6vw/

Highchart World map with pie

Here is the highchart demo of map with pie charts.
US map with pie charts
But this map is only for US. Here is my js fiddle.
World wide map with pie charts
// Add the pies after chart load, optionally with offset and connectors
Highcharts.each(chart.series[0].points, function (state) {
if (!state.id) {
return; // Skip points with no data, if any
}
var pieOffset = state.pieOffset || {},
centerLat = parseFloat(state.properties.latitude),
centerLon = parseFloat(state.properties.longitude);
// Add the pie for this state
chart.addSeries({
type: 'mappie',
name: state.id,
zIndex: 6, // Keep pies above connector lines
sizeFormatter: function () {
var yAxis = this.chart.yAxis[0],
zoomFactor = (yAxis.dataMax - yAxis.dataMin) /
(yAxis.max - yAxis.min);
return Math.max(
this.chart.chartWidth / 45 * zoomFactor, // Min size
this.chart.chartWidth / 11 * zoomFactor * state.sumVotes / maxVotes
);
},
tooltip: {
// Use the state tooltip for the pies as well
pointFormatter: function () {
return state.series.tooltipOptions.pointFormatter.call({
id: state.id,
hoverVotes: this.name,
demVotes: state.demVotes,
repVotes: state.repVotes,
libVotes: state.libVotes,
grnVotes: state.grnVotes,
sumVotes: state.sumVotes
});
}
},
data: [{
name: 'Democrats',
y: state.demVotes,
color: demColor
}, {
name: 'Republicans',
y: state.repVotes,
color: repColor
}, {
name: 'Libertarians',
y: state.libVotes,
color: libColor
}, {
name: 'Green',
y: state.grnVotes,
color: grnColor
}],
plotOptions: {
pie: {
center: [state.plotX+400, state.plotY]
}
}
}, false);
// Draw connector to state center if the pie has been offset
/* if (pieOffset.drawConnector !== false) {
var centerPoint = chart.fromLatLonToPoint({
lat: centerLat,
lon: centerLon
}),
offsetPoint = chart.fromLatLonToPoint({
lat: centerLat + (pieOffset.lat || 0),
lon: centerLon + (pieOffset.lon || 0)
});
chart.series[2].addPoint({
name: state.id,
path: 'M' + offsetPoint.x + ' ' + offsetPoint.y +
'L' + centerPoint.x + ' ' + centerPoint.y
}, false);
} */
});
I want to show map world wide map where each pie represent a country. Everything is working fine but world.js file dont have lat and long values.due to which i am facing positon issue of pie on each location.i tried using plotx and ploty .but it doesnt works. So is there any way to show pie axactly on the country area the way it is working US map?
You can use plotX & plotY properties of the region when it doesn't have the lat & lon defined.
Replace these two pieces of code:
plotOptions: {
pie: {
center: [state.plotX+400, state.plotY]
}
}
// Handle lat/lon support
if (options.center.lat !== undefined) {
var point = chart.fromLatLonToPoint(options.center);
options.center = [
chart.xAxis[0].toPixels(point.x, true),
chart.yAxis[0].toPixels(point.y, true)
];
}
with these ones:
center: {
plotX: state.plotX,
plotY: state.plotY
}
// Replace lat/lon with plotX/plotY
if (options.center.plotX !== undefined) {
options.center = [options.center.plotX, options.center.plotY];
}
By the way: using plotOptions inside series options is not valid. plotOptions should be placed in the top level of the chart options structure. Here's more info on that: https://api.highcharts.com/highcharts/plotOptions
Live demo: https://jsfiddle.net/BlackLabel/k5mdL6vn/

Highstock - How to add point if I have different data on main chart and navigator

I want to have data on the chart with scale 1 hour for point and have navigator data with scale 1 day per point.
At the same time I want to add new points to the chart in real time.
When I run my example:
https://jsfiddle.net/antongrinenko/aj7m2euk/3/
$(function () {
var val = 0;
function generateValue() {
val++;
if (val > 5) {
val = 0;
}
return val;
}
function generateData(backInDays, pointDuration) {
var points = [];
var d = new Date();
d.setDate(d.getDate() - backInDays);
for (var i = d.getTime(); i<new Date().getTime(); i += pointDuration) {
points.push([i, generateValue()]);
}
return points;
};
var weekData = generateData(30, 1000 * 60 * 60 * 24); //1 day per point
var oneDayData = generateData(1, 1000 * 60 * 60); //1 hour per point
$('#chart').highcharts('StockChart', {
chart: {
type: 'line'
},
series: [{
name: 'SomeData',
data: oneDayData
}],
navigator : {
adaptToUpdatedData: false,
series: {
data: weekData
},
},
scrollbar: {
liveRedraw: false
},
yAxis: {
floor: 0
}
});
setInterval(function() {
$('#chart').highcharts().series[0].addPoint([new Date().getTime(), generateValue()]);
}, 2000);
});
all works fine. But when I scroll a litte left and then back to right main chart stops updating with new points.
How can I fix this problem?
try commenting adaptToUpdatedData: false, working well

Highcharts: How to access range values in formatter for "columnrange" type?

I want to customize the tooltips of my Highcharts graph. The y-axis is of type "columnrange", i.e. it has an interval for the y-value:
series: [{
data: [
[-0.547571175, 0.401498266],
[-0.960011899, 0.444655955],
[-0.660727717, 0.862639688],
[-0.446911722, 0.660380453],
[-0.863925256, 0.619544707],
.......
]
}]
The tooltip formatter should look something like this:
tooltip: {
formatter: function() {
var point = this.points[0];
return '<b>'+ point.x +'</b><br />Interval:'+ point.low +' - '+ point.high;
},
shared: true
}
But point.low and point.high are not defined... How to get these low/high values?
Here you find a sample graph: http://jsfiddle.net/dmN3N/21/
In case when you use shared option in tooltip then you need to use this.points[0] etc, if you have shared option disabled you should use this.point
Take look at example shared
http://jsfiddle.net/dmN3N/24/
tooltip: {
shared:true,
valueSuffix: '',
formatter:function(){
return 'LOW: '+this.points[0].point.low+' HIGH: '+this.points[0].point.high ;
}
},
and not shared
http://jsfiddle.net/dmN3N/22/
tooltip: {
valueSuffix: '',
formatter:function(){
return 'LOW: '+this.point.low+' HIGH: '+this.point.high;
}
},
This code works fine for the formatter of tooltips:
tooltip: {
formatter: function() {
var point = this.points[0];
return '<b>'+ point.x +'</b><br />Interval:'+ point.series.data[0].low +' - '+ point.series.data[0].high;
},
shared: true
}
See here for a sample: http://jsfiddle.net/c2gVe/1/
To use the basic pointFormat property you can do:
tooltip: { pointFormat: '{point.low}' }
Aren't they just point[0] and point[1] for low and high respectively?
Try this, for your formatter function:
formatter: function() {
var lowPoint = getLow(this.series.data, 'x');
var highPoint = getHigh(this.series.data, 'x');
return '<b>'+ this.x +'</b><br />Interval:'+ lowPoint +' - '+ highPoint;
}
The getLow() and getHigh() functions simply take the list of points and returns the low/high points respectively.
Here is one way of implementing it, but you're free to use whatever algorithm you like.
I'm assuming you wanted the highest/lowest x value (you can easily get y by passing in 'y' as axis argument):
var getLow = function(list, axis) {
var low = null;
for (var i = 0; i < list.length; i++){
if (low !== null) {
low = list[i][axis] < low ? list[i][axis] : low;
} else {
low = list[i][axis];
}
}
return low;
};
var getHigh = function(list, axis) {
var high = null;
for (var i = 0; i < list.length; i++){
if (high !== null) {
high = list[i][axis] > high ? list[i][axis] : high;
} else {
high = list[i][axis];
}
}
return high;
};
Here is the fiddle to demonstrate: http://jsfiddle.net/tKB7y/

Highcharts Legend titles changing after drilldown and back?

I have sample code for question here: http://jsfiddle.net/MuydK/
The problem relates to legend title in the key under chart are changing after I have drilled in and out.
They should stay as
"actual" and
"target"
And are changing to "series 1" and "series 2".
$(function () {
var chart;
$(document).ready(function () {
var colors = Highcharts.getOptions().colors,
categories1 = ['1011', '1112', '1213', '1415'],
name1 = 'Actual',
I think I may be missing something in drilldown configuration or setChart code?
I got the same problem with a couple if charts based on code posted above.
Many Thanks
Hope this is what you need,
JSFiddle - Legend Name Problem
code:
function setChart(name, categories, data, color) {
console.log(name, categories, data, color);
chart.xAxis[0].setCategories(categories);
while (chart.series.length > 0) {
chart.series[0].remove(true);
}
for (var i = 0; i < data.length; i++) {
chart.addSeries({
name: name[i],
data: data[i],
color: color[i]
});
}
}
Edit2: The problem is in your else statement in the function bellow.
click: function() {
var drilldown = this.drilldown;
if (drilldown) { // drill down
setChart(drilldown.name, drilldown.categories, [drilldown.data], drilldown.color);
} else { // restore
setChart(name, categories1, [data1, data2], 'white');
}
}ā€‹
Instead get rid of name1 = 'Actual' and only have data1 and data2 and add name and color to them then you could do like this instead
click: function() {
var drilldown = this.drilldown;
if (drilldown) { // drill down
chart.xAxis[0].setCategories(drilldown.categories);
setChart([drilldown.data]);
} else { // restore
chart.xAxis[0].setCategories(categories);
setChart([data1, data2]);
}
}
// add code for removing series
chart.addSeries({
data
});ā€‹
I hope you understand, but it will be easier if you build data1/2as a highcharts object, and just add the drilldown part to it. So you can change;
series: [{
name: name1,
data: data1,
color: colors[0]},
{
name: name2,
data: data2,
color: colors[1]}],
to:
series: [data1, data2],ā€‹
Edit: When you are doing operations bellow you should not set redraw to true, it will be much faster. The same goes for adding the series. You do not need to call chart.redraw() until you have removed and added the charts. And removing stuff is easier backwards. So change:
while (chart.series.length > 0) {
chart.series[0].remove(true);
}
To
for (var i = chart.series.length; i >= 0; i--){
chart.series[i].remove(false);
}
// add series with redraw == false
chart.redraw();

Resources