Mouse behavior buggy? - javascript

I have a problem with this highcharts fiddle.
$(function() {
$('#container').highcharts({
lang: {
"noData": "no Data from 01.07.2016 until 01.08.2016"
},
"title": {
"text": ""
},
"series": [{
"zIndex": 10,
"color": "#2f7ed8",
"name": "Series 1",
"stickyTracking": false,
"marker": {
"symbol": "square",
"radius": 5
},
"lineWidth": 0,
"data": [{
"y": 291.0,
"x": Date.UTC(2015, 11, 10, 10, 45, 0),
}, {
"y": 156.0,
"x": Date.UTC(2015, 11, 10, 13, 0, 0),
}, {
"y": 215.0,
"x": Date.UTC(2015, 11, 10, 16, 30, 0),
}, {
"y": 212.0,
"x": Date.UTC(2015, 11, 10, 18, 45, 0),
}, {
"y": 232.0,
"x": Date.UTC(2015, 11, 10, 21, 15, 0),
}, {
"y": 73.0,
"x": Date.UTC(2015, 11, 10, 23, 15, 0),
}, {
"y": 112.0,
"x": Date.UTC(2015, 11, 11, 7, 30, 0),
}, {
"y": 264.0,
"x": Date.UTC(2015, 11, 11, 9, 30, 0),
}, {
"y": 152.0,
"x": Date.UTC(2015, 11, 11, 11, 15, 0),
}, {
"y": 138.0,
"x": Date.UTC(2015, 11, 11, 12, 0, 0),
}, {
"y": 133.0,
"x": Date.UTC(2015, 11, 11, 14, 30, 0),
}, {
"y": 272.0,
"x": Date.UTC(2015, 11, 11, 16, 30, 0),
}, {
"y": 106.0,
"x": Date.UTC(2015, 11, 11, 20, 15, 0),
}, {
"y": 239.0,
"x": Date.UTC(2015, 11, 11, 22, 45, 0),
}, {
"y": 220.0,
"x": Date.UTC(2015, 11, 11, 23, 45, 0),
}, {
"y": 257.0,
"x": Date.UTC(2015, 11, 12, 8, 45, 0),
}, {
"y": 140.0,
"x": Date.UTC(2015, 11, 12, 10, 45, 0),
}, {
"y": 86.0,
"x": Date.UTC(2015, 11, 12, 12, 0, 0),
}, {
"y": 96.0,
"x": Date.UTC(2015, 11, 12, 13, 45, 0),
}, {
"y": 230.0,
"x": Date.UTC(2015, 11, 12, 16, 0, 0),
}, {
"y": 262.0,
"x": Date.UTC(2015, 11, 12, 18, 30, 0),
}, {
"y": 133.0,
"x": Date.UTC(2015, 11, 12, 20, 15, 0),
}, {
"y": 167.0,
"x": Date.UTC(2015, 11, 12, 22, 0, 0),
}, {
"y": 59.0,
"x": Date.UTC(2015, 11, 13, 7, 45, 0),
}, {
"y": 207.0,
"x": Date.UTC(2015, 11, 13, 10, 15, 0),
}, {
"y": 133.0,
"x": Date.UTC(2015, 11, 13, 12, 0, 0),
}, {
"y": 127.0,
"x": Date.UTC(2015, 11, 13, 19, 45, 0),
}, {
"y": 207.0,
"x": Date.UTC(2015, 11, 13, 21, 15, 0),
}, {
"y": 88.0,
"x": Date.UTC(2015, 11, 14, 8, 15, 0),
}, {
"y": 161.0,
"x": Date.UTC(2015, 11, 14, 11, 0, 0),
}, {
"y": 142.0,
"x": Date.UTC(2015, 11, 14, 13, 30, 0),
}, {
"y": 155.0,
"x": Date.UTC(2015, 11, 14, 15, 45, 0),
}, {
"y": 197.0,
"x": Date.UTC(2015, 11, 14, 18, 45, 0),
}, {
"y": 310.0,
"x": Date.UTC(2015, 11, 14, 22, 15, 0),
}, {
"y": 89.0,
"x": Date.UTC(2015, 11, 15, 0, 15, 0),
}, {
"y": 182.0,
"x": Date.UTC(2015, 11, 15, 8, 15, 0),
}, {
"y": 96.0,
"x": Date.UTC(2015, 11, 15, 11, 30, 0),
}, {
"y": 70.0,
"x": Date.UTC(2015, 11, 15, 13, 0, 0),
}, {
"y": 111.0,
"x": Date.UTC(2015, 11, 15, 14, 30, 0),
}, {
"y": 233.0,
"x": Date.UTC(2015, 11, 15, 16, 0, 0),
}, {
"y": 191.0,
"x": Date.UTC(2015, 11, 15, 17, 45, 0),
}, {
"y": 162.0,
"x": Date.UTC(2015, 11, 15, 21, 15, 0),
}, {
"y": 248.0,
"x": Date.UTC(2015, 11, 16, 9, 15, 0),
}, {
"y": 77.0,
"x": Date.UTC(2015, 11, 16, 11, 0, 0),
}, {
"y": 94.0,
"x": Date.UTC(2015, 11, 16, 13, 15, 0),
}, {
"y": 100.0,
"x": Date.UTC(2015, 11, 16, 16, 15, 0),
}, {
"y": 101.0,
"x": Date.UTC(2015, 11, 16, 18, 15, 0),
}, {
"y": 154.0,
"x": Date.UTC(2015, 11, 16, 21, 30, 0),
}, {
"y": 162.0,
"x": Date.UTC(2015, 11, 17, 0, 15, 0),
}, {
"y": 132.0,
"x": Date.UTC(2015, 11, 17, 11, 15, 0),
}, {
"y": 151.0,
"x": Date.UTC(2015, 11, 17, 15, 30, 0),
}, {
"y": 144.0,
"x": Date.UTC(2015, 11, 17, 18, 30, 0),
}, {
"y": 84.0,
"x": Date.UTC(2015, 11, 17, 21, 30, 0),
}, {
"y": 136.0,
"x": Date.UTC(2015, 11, 17, 23, 15, 0),
}, {
"y": 55.0,
"x": Date.UTC(2015, 11, 18, 4, 45, 0),
}, {
"y": 131.0,
"x": Date.UTC(2015, 11, 18, 6, 0, 0),
}, {
"y": 182.0,
"x": Date.UTC(2015, 11, 18, 10, 15, 0),
}, {
"y": 203.0,
"x": Date.UTC(2015, 11, 18, 12, 15, 0),
}, {
"y": 332.0,
"x": Date.UTC(2015, 11, 18, 15, 0, 0),
}, {
"y": 177.0,
"x": Date.UTC(2015, 11, 18, 21, 0, 0),
}, {
"y": 85.0,
"x": Date.UTC(2015, 11, 18, 23, 30, 0),
}, {
"y": 63.0,
"x": Date.UTC(2015, 11, 19, 9, 0, 0),
}, {
"y": 189.0,
"x": Date.UTC(2015, 11, 19, 10, 30, 0),
}, {
"y": 170.0,
"x": Date.UTC(2015, 11, 19, 11, 15, 0),
}, {
"y": 175.0,
"x": Date.UTC(2015, 11, 19, 15, 15, 0),
}, {
"y": 204.0,
"x": Date.UTC(2015, 11, 19, 17, 30, 0),
}, {
"y": 169.0,
"x": Date.UTC(2015, 11, 19, 18, 45, 0),
}, {
"y": 115.0,
"x": Date.UTC(2015, 11, 19, 21, 45, 0),
}, {
"y": 117.0,
"x": Date.UTC(2015, 11, 20, 8, 15, 0),
}, {
"y": 83.0,
"x": Date.UTC(2015, 11, 20, 10, 0, 0),
}, {
"y": 49.0,
"x": Date.UTC(2015, 11, 20, 11, 30, 0),
}, {
"y": 195.0,
"x": Date.UTC(2015, 11, 20, 15, 15, 0),
}, {
"y": 273.0,
"x": Date.UTC(2015, 11, 20, 17, 30, 0),
}, {
"y": 227.0,
"x": Date.UTC(2015, 11, 20, 19, 45, 0),
}, {
"y": 243.0,
"x": Date.UTC(2015, 11, 20, 22, 0, 0),
}, {
"y": 190.0,
"x": Date.UTC(2015, 11, 20, 23, 15, 0),
}, {
"y": 170.0,
"x": Date.UTC(2015, 11, 21, 0, 15, 0),
}, {
"y": 86.0,
"x": Date.UTC(2015, 11, 21, 8, 15, 0),
}, {
"y": 311.0,
"x": Date.UTC(2015, 11, 21, 10, 45, 0),
}, {
"y": 244.0,
"x": Date.UTC(2015, 11, 21, 11, 45, 0),
}, {
"y": 129.0,
"x": Date.UTC(2015, 11, 21, 13, 30, 0),
}, {
"y": 119.0,
"x": Date.UTC(2015, 11, 21, 15, 30, 0),
}, {
"y": 125.0,
"x": Date.UTC(2015, 11, 21, 19, 30, 0),
}, {
"y": 206.0,
"x": Date.UTC(2015, 11, 21, 21, 0, 0),
}, {
"y": 230.0,
"x": Date.UTC(2015, 11, 21, 23, 45, 0),
}, {
"y": 229.0,
"x": Date.UTC(2015, 11, 22, 0, 15, 0),
}, {
"y": 137.0,
"x": Date.UTC(2015, 11, 22, 8, 30, 0),
}, {
"y": 118.0,
"x": Date.UTC(2015, 11, 22, 10, 30, 0),
}, {
"y": 57.0,
"x": Date.UTC(2015, 11, 22, 13, 15, 0),
}, {
"y": 211.0,
"x": Date.UTC(2015, 11, 22, 15, 15, 0),
}, {
"y": 88.0,
"x": Date.UTC(2015, 11, 22, 19, 15, 0),
}, {
"y": 290.0,
"x": Date.UTC(2015, 11, 22, 22, 30, 0),
},{
"y": 268.0,
"x": Date.UTC(2015, 11, 25, 20, 0, 0),
}, {
"y": 297.0,
"x": Date.UTC(2015, 11, 25, 21, 0, 0),
}, {
"y": 265.0,
"x": Date.UTC(2015, 11, 25, 22, 15, 0),
}, {
"y": 236.0,
"x": Date.UTC(2015, 11, 26, 8, 15, 0),
}, {
"y": 249.0,
"x": Date.UTC(2015, 11, 26, 10, 0, 0),
}, {
"y": 181.0,
"x": Date.UTC(2015, 11, 26, 11, 15, 0),
}, {
"y": 250.0,
"x": Date.UTC(2015, 11, 26, 12, 0, 0),
}, {
"y": 241.0,
"x": Date.UTC(2015, 11, 26, 15, 30, 0),
}, {
"y": 270.0,
"x": Date.UTC(2015, 11, 26, 17, 30, 0),
}, {
"y": 225.0,
"x": Date.UTC(2015, 11, 26, 18, 30, 0),
}, {
"y": 146.0,
"x": Date.UTC(2015, 11, 26, 20, 0, 0),
}, {
"y": 143.0,
"x": Date.UTC(2015, 11, 26, 21, 15, 0),
}, {
"y": 88.0,
"x": Date.UTC(2015, 11, 26, 22, 45, 0),
}, {
"y": 98.0,
"x": Date.UTC(2015, 11, 27, 0, 0, 0),
}, {
"y": 144.0,
"x": Date.UTC(2015, 11, 27, 8, 0, 0),
}, {
"y": 295.0,
"x": Date.UTC(2015, 11, 27, 10, 15, 0),
}, {
"y": 256.0,
"x": Date.UTC(2015, 11, 27, 11, 15, 0),
}, {
"y": 214.0,
"x": Date.UTC(2015, 11, 27, 16, 45, 0),
}, {
"y": 179.0,
"x": Date.UTC(2015, 11, 27, 19, 15, 0),
}, {
"y": 191.0,
"x": Date.UTC(2015, 11, 27, 21, 15, 0),
}, {
"y": 160.0,
"x": Date.UTC(2015, 11, 28, 0, 0, 0),
}, {
"y": 95.0,
"x": Date.UTC(2015, 11, 28, 9, 45, 0),
}, {
"y": 138.0,
"x": Date.UTC(2015, 11, 28, 12, 0, 0),
}, {
"y": 104.0,
"x": Date.UTC(2015, 11, 28, 13, 45, 0),
}, {
"y": 165.0,
"x": Date.UTC(2015, 11, 28, 17, 45, 0),
}, {
"y": 185.0,
"x": Date.UTC(2015, 11, 28, 18, 45, 0),
}, {
"y": 338.0,
"x": Date.UTC(2015, 11, 28, 21, 30, 0),
}, {
"y": 286.0,
"x": Date.UTC(2015, 11, 28, 23, 15, 0),
}, {
"y": 131.0,
"x": Date.UTC(2015, 11, 29, 3, 15, 0),
}, {
"y": 98.0,
"x": Date.UTC(2015, 11, 29, 8, 30, 0),
}, {
"y": 205.0,
"x": Date.UTC(2015, 11, 29, 10, 30, 0),
}, {
"y": 130.0,
"x": Date.UTC(2015, 11, 29, 11, 45, 0),
}, {
"y": 80.0,
"x": Date.UTC(2015, 11, 29, 13, 30, 0),
}, {
"y": 246.0,
"x": Date.UTC(2015, 11, 29, 16, 30, 0),
}, {
"y": 183.0,
"x": Date.UTC(2015, 11, 29, 18, 45, 0),
}, {
"y": 199.0,
"x": Date.UTC(2015, 11, 29, 19, 45, 0),
}, {
"y": 219.0,
"x": Date.UTC(2015, 11, 29, 21, 30, 0),
}, {
"y": 318.0,
"x": Date.UTC(2015, 11, 29, 23, 45, 0),
}, {
"y": 156.0,
"x": Date.UTC(2015, 11, 30, 8, 45, 0),
}, {
"y": 73.0,
"x": Date.UTC(2015, 11, 30, 11, 0, 0),
}, {
"y": 98.0,
"x": Date.UTC(2015, 11, 30, 11, 45, 0),
}, {
"y": 105.0,
"x": Date.UTC(2015, 11, 30, 14, 30, 0),
}, {
"y": 194.0,
"x": Date.UTC(2015, 11, 30, 17, 45, 0),
}, {
"y": 183.0,
"x": Date.UTC(2015, 11, 30, 20, 15, 0),
}, {
"y": 289.0,
"x": Date.UTC(2015, 11, 30, 21, 15, 0),
}, {
"y": 350.0,
"x": Date.UTC(2015, 11, 31, 0, 15, 0),
}, {
"y": 242.0,
"x": Date.UTC(2015, 11, 31, 8, 45, 0),
}, {
"y": 240.0,
"x": Date.UTC(2015, 11, 31, 10, 30, 0),
}, {
"y": 146.0,
"x": Date.UTC(2015, 11, 31, 11, 15, 0),
}, {
"y": 117.0,
"x": Date.UTC(2015, 11, 31, 13, 30, 0),
}, {
"y": 191.0,
"x": Date.UTC(2015, 11, 31, 15, 15, 0),
}, {
"y": 189.0,
"x": Date.UTC(2015, 11, 31, 17, 45, 0),
}, {
"y": 153.0,
"x": Date.UTC(2015, 11, 31, 20, 45, 0),
}, {
"y": 161.0,
"x": Date.UTC(2016, 0, 1, 0, 0, 0),
}, {
"y": 143.0,
"x": Date.UTC(2016, 0, 1, 0, 45, 0),
}, {
"y": 62.0,
"x": Date.UTC(2016, 0, 1, 8, 30, 0),
}, {
"y": 98.0,
"x": Date.UTC(2016, 0, 1, 13, 0, 0),
}, {
"y": 166.0,
"x": Date.UTC(2016, 0, 1, 14, 30, 0),
}, {
"y": 202.0,
"x": Date.UTC(2016, 0, 1, 17, 45, 0),
}, {
"y": 273.0,
"x": Date.UTC(2016, 0, 1, 21, 0, 0),
}, {
"y": 240.0,
"x": Date.UTC(2016, 0, 2, 0, 15, 0),
}, {
"y": 145.0,
"x": Date.UTC(2016, 0, 2, 8, 45, 0),
}, {
"y": 87.0,
"x": Date.UTC(2016, 0, 2, 12, 0, 0),
}, {
"y": 163.0,
"x": Date.UTC(2016, 0, 2, 16, 0, 0),
}, {
"y": 196.0,
"x": Date.UTC(2016, 0, 2, 19, 45, 0),
}, {
"y": 347.0,
"x": Date.UTC(2016, 0, 2, 22, 45, 0),
}, {
"y": 200.0,
"x": Date.UTC(2016, 0, 3, 0, 30, 0),
}, {
"y": 132.0,
"x": Date.UTC(2016, 0, 3, 8, 45, 0),
}, {
"y": 251.0,
"x": Date.UTC(2016, 0, 3, 10, 0, 0),
}, {
"y": 254.0,
"x": Date.UTC(2016, 0, 3, 12, 0, 0),
}, {
"y": 94.0,
"x": Date.UTC(2016, 0, 3, 14, 30, 0),
}, {
"y": 88.0,
"x": Date.UTC(2016, 0, 3, 18, 15, 0),
}, {
"y": 247.0,
"x": Date.UTC(2016, 0, 3, 21, 30, 0),
}, {
"y": 179.0,
"x": Date.UTC(2016, 0, 4, 0, 0, 0),
}, {
"y": 109.0,
"x": Date.UTC(2016, 0, 4, 10, 0, 0),
}, {
"y": 67.0,
"x": Date.UTC(2016, 0, 4, 12, 15, 0),
}, {
"y": 172.0,
"x": Date.UTC(2016, 0, 4, 15, 30, 0),
}, {
"y": 96.0,
"x": Date.UTC(2016, 0, 4, 17, 0, 0),
}, {
"y": 116.0,
"x": Date.UTC(2016, 0, 4, 18, 45, 0),
}, {
"y": 111.0,
"x": Date.UTC(2016, 0, 4, 21, 0, 0),
}, {
"y": 234.0,
"x": Date.UTC(2016, 0, 4, 22, 45, 0),
}, {
"y": 187.0,
"x": Date.UTC(2016, 0, 5, 0, 0, 0),
}, {
"y": 72.0,
"x": Date.UTC(2016, 0, 5, 9, 45, 0),
}, {
"y": 266.0,
"x": Date.UTC(2016, 0, 5, 11, 45, 0),
}, {
"y": 237.0,
"x": Date.UTC(2016, 0, 5, 13, 15, 0),
}, {
"y": 268.0,
"x": Date.UTC(2016, 0, 5, 16, 45, 0),
}, {
"y": 261.0,
"x": Date.UTC(2016, 0, 5, 18, 0, 0),
}, {
"y": 140.0,
"x": Date.UTC(2016, 0, 5, 21, 30, 0),
}],
"tooltip": {
"pointFormat": "<span style=\"color:{series.color}\">{series.name}</span>: <b>{point.y}</b> ",
"useHTML": true,
"crosshairs": true
}
}, {
"zIndex": 11,
"color": "#D6487E",
"name": "Series 2",
"marker": {
"symbol": "triangle-down",
"radius": 5
},
"lineWidth": 0,
"data": [],
"tooltip": {
"pointFormat": "<span style=\"color:{series.color}\">{series.name}</span>: <b>{point.y}</b> ",
"useHTML": true,
"crosshairs": true
}
}, {
"zIndex": 10,
"color": "#2f7ed8",
"name": "Series 3",
"marker": {
"symbol": "triangle",
"radius": 5
},
"lineWidth": 0,
"data": [],
"tooltip": {
"pointFormat": "<span style=\"color:{series.color}\">{series.name}</span>: <b>{point.y}</b> ",
"useHTML": true,
"crosshairs": true
}
}, {
"enableMouseTracking": false,
"zIndex": 3,
"isThreshold": true,
"name": "Background series",
"color": "#edf9d2",
"type": "arearange",
"data": [
[Date.UTC(2015, 11, 1, 0, 0, 0), 80.0, 160.0],
[Date.UTC(2016, 0, 10, 23, 59, 59), 80.0, 160.0],
[Date.UTC(2016, 0, 10, 23, 59, 59), 80.0, 160.0]
],
"scalingFix": true
}, {
"zIndex": 10,
"color": "#2f7ed8",
"name": "Test series",
"marker": {
"symbol": "circle",
"radius": 5
},
"lineWidth": 0,
"data": [],
"tooltip": {
"pointFormat": "<span style=\"color:{series.color}\">{series.name}</span>: <b>{point.y}</b> ",
"useHTML": true,
"crosshairs": true
}
}, {
"name": "scaling-fix",
"data": [
[Date.UTC(2016, 6, 31, 23, 59, 59), 80.0],
[Date.UTC(2016, 7, 1, 23, 59, 59), 80.0]
],
"zIndex": 0,
"visible": false,
"type": "line",
"showInLegend": false
} ],
"yAxis": {
"minRange": 20,
"startOnTick": true,
"plotBands": [],
"title": {
"text": "Values",
"enabled": true
},
"gridZIndex": 0,
"min": 0,
"endOnTick": false,
"plotLines": [],
"tickInterval": 20
},
"chart": {
"zoomType": "x",
"marginLeft": 70,
"resetZoomButton": {
"theme": {
"states": {
"hover": {
"style": {
"color": "white"
},
"fill": "#DA5430"
}
},
"stroke": "#DA5430",
"r": 0,
"style": {
"color": "white"
},
"fill": "#DA5430"
}
},
"type": "line",
},
"tooltip": {
"dateTimeLabelFormats": {
"millisecond": "%A, %e. %b., %H:%M:%S.%L",
"week": "Woche von %A, %e. %b. %Y",
"hour": "%A, %e. %b., %H:%M",
"month": "%B %Y",
"second": "%A, %e. %b., %H:%M:%S",
"year": "%Y",
"day": "%A, %e. %b. %Y",
"minute": "%A, %e. %b., %H:%M"
},
"snap": 0,
"shared": false,
"followPointer": false,
"useHTML": true
},
"credits": {
"enabled": false
},
"plotOptions": {
"series": {
"states": {
"hover": {
"lineWidth": 0,
"lineWidthPlus": 0
}
},
"cursor": "pointer",
"stickyTracking": false
},
"line": {
"zIndex": 6,
"marker": {
"enabled": true
},
"stickyTracking": false,
"dataLabels": {
"enabled": false,
"useHTML": true
}
},
"arearange": {},
"scatter": {
"marker": {
"enabled": true
},
"stickyTracking": false,
"dataLabels": {
"enabled": false,
"useHTML": true
}
},
"area": {
"stacking": true,
"enableMouseTracking": false,
"marker": {
"enabled": false
},
"shadow": false,
"lineWidth": 0,
"showInLegend": false
}
},
"xAxis": {
"minRange": 60000,
"min": Date.UTC(2015, 11, 1, 0, 0, 0),
"minPadding": 0.0,
"plotBands": [{
"zIndex": -100,
"to": Date.UTC(2016, 6, 3, 21, 59, 59),
"from": Date.UTC(2016, 6, 1, 22, 0, 0),
"color": "rgba(200,200,200,0.1)"
}, {
"zIndex": -100,
"to": Date.UTC(2015, 11, 6, 22, 59, 59),
"from": Date.UTC(2015, 11, 4, 23, 0, 0),
"color": "rgba(200,200,200,0.1)"
}, {
"zIndex": -100,
"to": Date.UTC(2015, 11, 13, 22, 59, 59),
"from": Date.UTC(2015, 11, 11, 23, 0, 0),
"color": "rgba(200,200,200,0.1)"
}, {
"zIndex": -100,
"to": Date.UTC(2015, 11, 20, 22, 59, 59),
"from": Date.UTC(2015, 11, 18, 23, 0, 0),
"color": "rgba(200,200,200,0.1)"
}, {
"zIndex": -100,
"to": Date.UTC(2015, 11, 27, 22, 59, 59),
"from": Date.UTC(2015, 11, 25, 23, 0, 0),
"color": "rgba(200,200,200,0.1)"
}],
"plotLines": [{
"zIndex": -100,
"width": 2,
"dashStyle": "ShortDash",
"color": "rgba(200,200,200,0.3)",
"value": Date.UTC(2015, 11, 6, 23, 0, 0)
}, {
"zIndex": -100,
"width": 2,
"dashStyle": "ShortDash",
"color": "rgba(200,200,200,0.3)",
"value": Date.UTC(2015, 11, 13, 23, 0, 0)
}, {
"zIndex": -100,
"width": 2,
"dashStyle": "ShortDash",
"color": "rgba(200,200,200,0.3)",
"value": Date.UTC(2015, 11, 20, 23, 0, 0)
}, {
"zIndex": -100,
"width": 2,
"dashStyle": "ShortDash",
"color": "rgba(200,200,200,0.3)",
"value": Date.UTC(2015, 11, 27, 23, 0, 0)
}],
"gridZIndex": 0,
"dateTimeLabelFormats": {
"millisecond": "%H:%M:%S.%L",
"week": "%e. %b. %y",
"hour": "%H:%M",
"month": "%B %y",
"second": "%H:%M:%S",
"year": "%Y",
"day": "%e. %b. %y",
"minute": "%H:%M"
},
"gridLineWidth": 0,
"maxPadding": 0.0,
"endOnTick": false,
"max": Date.UTC(2016, 0, 10, 23, 59, 59),
"minTickInterval": 60000,
"type": "datetime",
"events": {
"afterSetExtremes": function() {
var axis = "xAxis";
var axis2 = "yAxis";
var chartgroup = null;
if (typeof charts_p_allchartsmodule != 'undefined') {
chartgroup = charts_p_allchartsmodule;
}
if (typeof charts_container != 'undefined' && charts_container['p_allchartsmodule']) {
chartgroup = charts_container['p_allchartsmodule'];
}
if (chartgroup && this.chart.controllingChart == true) {
if (this.chart.inverted == true) {
var min = this.chart.xAxis[0].min;
var max = this.chart.xAxis[0].max;
} else {
var min = this.chart.xAxis[0].min;
var max = this.chart.xAxis[0].max;
}
for (key in chartgroup) {
if (this.chart != chartgroup[key]) {
if (chartgroup[key].inverted == true) {
chartgroup[key].xAxis[0].setExtremes(min, max, true);
} else {
chartgroup[key].xAxis[0].setExtremes(min, max, true);
}
}
}
this.chart.controllingChart = false;
}
}
}
},
"exporting": {
"url": "/m/hc-export/",
"chartOptions": {
"rangeSelector": {
"enabled": false
},
"navigator": {
"enabled": false
},
"scrollbar": {
"enabled": false
}
}
},
"rangeSelector": {
"buttons": [{
"text": "Alle",
"type": "all"
}],
"inputEnabled": false,
"enabled": true
},
"type": "scatter",
"legend": {
"draggable":true,
"floating":true,
"verticalAlign": "top",
"zIndex": 2000,
"title": {
"text": ":: Legend"
},
"itemStyle": {
"fontSize": "8px"
},
"align": "left",
"draggable": true,
"borderWidth": 1,
"backgroundColor": "rgba(234, 234, 234,0.8)",
"floating": true
}
});
});
When you hover over on of the points it will select a other point with nearly the same X-Axis. The Y-Axis is switching up and down but not to the point where the mouse hovers over. So the selection behavior isn´t precise, so you can´t see the right tooltip where your mouse hovers over.
Mouse = red dot
Please have a look at it.

Your series is treated as a "line" chart, which causes this behaviour of the tooltip popup. I found a problem in your configuration object. The type:"scatter" option must be placed in the "chart":{} object.
chart:{
type:"scatter"
}
see: http://jsfiddle.net/u9q2m9wp/2/
see also: Highcharts - only show tooltip when hovering directly on point

Related

Group data by weekdays in Highchart

I'm plotting a graph that needs to combine data of a selected date range to weekdays i mean if i selected a date range from ex: 2021-05-01 to 2021-05-31 in that consider 2021-05-01,2021-05-08,2021-05-15 these days are Friday so i need to combine datas of these dates and show as one data with label friday. With the current options that i used the chart is plotting like this. Is there any ways to display it correctly.
Demo Fiddle
This is the way that i currently getting the result
This is the result that i'm expecting
These are the current configd that i'm using in the highchart.
Highcharts.chart("multistackedbarchart-II", {
chart: {
type: "column",
},
title: {
text: "Sent/Received Comparison",
},
xAxis: {
title: {
text: "Day",
},
categories: [labels],
},
yAxis: {
min: 0,
title: {
text: "",
},
stackLabels: {
enabled: false,
style: {
fontWeight: "bold",
color:
// theme
(Highcharts.defaultOptions.title.style && Highcharts.defaultOptions.title.style.color) ||
"gray",
},
},
},
legend: {
align: "center",
verticalAlign: "bottom",
x: 0,
y: 0,
},
tooltip: {
headerFormat: "<b>{point.x}</b><br/>",
pointFormat: "{series.name}: {point.y}",
},
plotOptions: {
column: {
stacking: "normal",
dataGrouping: {
forced: true,
units: [['day', [1]]]
}
},
},
series: chartdata.multistackedbarchart,
credits: {
enabled: false,
},
});
Highcharts.setOptions({ lang: { noData: "No Data Available" } });
You can make a special function to do this sorting by using Array.map() and Array.filter() methods:
const categories = [
"2021-08-04",
"2021-08-05",
"2021-08-06",
"2021-08-07",
"2021-08-08",
"2021-08-09",
"2021-08-10",
"2021-08-11",
"2021-08-12",
"2021-08-13",
"2021-08-14",
"2021-08-15",
"2021-08-16",
"2021-08-17",
"2021-08-18",
"2021-08-19",
"2021-08-20",
"2021-08-21",
"2021-08-22",
"2021-08-23",
"2021-08-24",
"2021-08-25",
"2021-08-26",
"2021-08-27",
"2021-08-28",
"2021-08-29",
"2021-08-30",
"2021-08-31",
"2021-09-01",
"2021-09-02",
"2021-09-03",
"2021-09-04",
"2021-09-05",
"2021-09-06",
"2021-09-07",
"2021-09-08",
"2021-09-09",
"2021-09-10",
"2021-09-11",
"2021-09-12",
"2021-09-13",
"2021-09-14",
"2021-09-15",
"2021-09-16",
"2021-09-17",
"2021-09-18",
"2021-09-19",
"2021-09-20",
"2021-09-21",
"2021-09-22",
"2021-09-23",
"2021-09-24",
"2021-09-25",
"2021-09-26",
"2021-09-27",
"2021-09-28",
"2021-09-29",
"2021-09-30",
"2021-10-01",
"2021-10-02",
"2021-10-03",
"2021-10-04",
"2021-10-05",
"2021-10-06",
"2021-10-07",
"2021-10-08",
"2021-10-09",
"2021-10-10",
"2021-10-11",
"2021-10-12"]
const messagesSent = [ 32,
60,
71,
3,
1,
25,
16,
23,
28,
25,
2,
1,
43,
49,
32,
35,
26,
2,
1,
8,
36,
47,
15,
20,
2,
1,
2,
18,
20,
30,
43,
4,
4,
15,
14,
48,
39,
3,
2,
0,
48,
34,
15,
9,
1,
3,
1,
85,
27,
72,
11,
4,
2,
0,
29,
13,
21,
15,
32,
2,
0,
58,
37,
37,
24,
5,
1,
0,
0,
0]
const messagesReceived = [29,
79,
80,
7,
2,
24,
32,
23,
44,
42,
3,
1,
65,
69,
46,
47,
23,
3,
1,
28,
35,
65,
22,
19,
4,
1,
7,
10,
32,
31,
13,
8,
2,
4,
48,
53,
46,
7,
4,
0,
48,
40,
23,
18,
2,
6,
2,
79,
25,
86,
9,
8,
5,
0,
25,
18,
18,
14,
37,
2,
0,
52,
70,
27,
25,
17,
1,
0,
0,
0]
const organizeData = (days, sent, received) => {
const dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
// get name of weekday
const getDayOfWeek = date => {
const dayOfWeek = new Date(date).getDay();
return isNaN(dayOfWeek) ? null : dayNames[dayOfWeek];
}
return dayNames.map((dayName) => {
let correspondingMessagesSent = []
let correspondingMessagesReceived = []
const matchedDays = days.filter((day, index) => {
if(dayName === getDayOfWeek(day)) {
correspondingMessagesSent.push(sent[index])
correspondingMessagesReceived.push(received[index])
return day
}
})
return { [dayName]: { dates: matchedDays,
sent: correspondingMessagesSent,
received: correspondingMessagesReceived} }
})
}
console.log(organizeData(categories, messagesSent, messagesReceived))
/* This is not a part of answer. It is just to give the output fill height. So IGNORE IT */
.as-console-wrapper { max-height: 100% !important; top: 0; }

How to implement motion video highchart on Reactjs

I am able to make bubble chart using highchart library. But is there any way we can implement motion to it.
Example link is below
http://jsfiddle.net/gh/get/library/pure/larsac07/Motion-Highcharts-Plugin/tree/master/demos/map-australia-bubbles-demo/
My problem is motions.js and bubble.js are external files. Here in react we are using render method to render highchart.
Below state options will be having motion object and series like below
motion: {
enabled: true,
axisLabel: 'year',
loop: false,
series: 0, // The series which holds points to update
updateInterval: 100,
magnet: {
round: 'round', // ceil / floor / round
step: 0.1
},
labels: [20181031, 20181101, 20181102, 20181103, 20181104, 20181105, 20181106, 20181107, 20181108, 20181109, 20181110, 20181111, 20181112, 20181113]
},
series: [{
name: 'Things',
colorByPoint: true,
id: 'deep',
marker: {
fillColor: {
radialGradient: { cx: 0.4, cy: 0.3, r: 0.7 },
stops: [
[0, 'rgba(255,255,255,0.5)']
]
}
},
data: [{ "color": "rgba(67, 67, 72, 0.5)", "fillColor": "rgba(67, 67, 72, 0.5)", "x": 38.42, "y": 0, "z": 6, "name": "California" }, { "color": "rgba(67, 67, 72, 0.5)", "fillColor": "rgba(67, 67, 72, 0.5)", "x": 38.17, "y": 0, "z": 6, "name": "California" }, { "color": "rgba(67, 67, 72, 0.5)", "fillColor": "rgba(67, 67, 72, 0.5)", "x": 38.75, "y": 0, "z": 6, "name": "California" }, { "color": "rgba(67, 67, 72, 0.5)", "fillColor": "rgba(67, 67, 72, 0.5)", "x": 37.92, "y": 0, "z": 6, "name": "California" }, { "color": "rgba(67, 67, 72, 0.5)", "fillColor": "rgba(67, 67, 72, 0.5)", "x": 37.08, "y": 0, "z": 6, "name": "California" }, { "color": "rgba(67, 67, 72, 0.5)", "fillColor": "rgba(67, 67, 72, 0.5)", "x": 37.75, "y": 0, "z": 6, "name": "California" }, { "color": "rgba(67, 67, 72, 0.5)", "fillColor": "rgba(67, 67, 72, 0.5)", "x": 37.83, "y": 0, "z": 6, "name": "California" }, { "color": "rgba(67, 67, 72, 0.5)", "fillColor": "rgba(67, 67, 72, 0.5)", "x": 37.5, "y": 0, "z": 6, "name": "California" }, { "color": "rgba(67, 67, 72, 0.5)", "fillColor": "rgba(67, 67, 72, 0.5)", "x": 38.08, "y": 0, "z": 6, "name": "California" }, { "color": "rgba(67, 67, 72, 0.5)", "fillColor": "rgba(67, 67, 72, 0.5)", "x": 36.92, "y": 0, "z": 6, "name": "California" }, { "color": "rgba(67, 67, 72, 0.5)", "fillColor": "rgba(67, 67, 72, 0.5)", "x": 13, "y": 0, "z": 6, "name": "California" }, { "color": "rgba(67, 67, 72, 0.5)", "fillColor": "rgba(67, 67, 72, 0.5)", "x": 36, "y": 0, "z": 6, "name": "California" }, { "color": "rgba(67, 67, 72, 0.5)", "fillColor": "rgba(67, 67, 72, 0.5)", "x": 13, "y": 0, "z": 6, "name": "California" }, { "color": "rgba(67, 67, 72, 0.5)", "fillColor": "rgba(67, 67, 72, 0.5)", "x": 13, "y": 0, "z": 6, "name": "California" }]
}]
return (
<div>
<Highcharts
config={this.state.options}
/>
</div>
);
I recommend you to use highcharts-react-official wrapper: https://www.npmjs.com/package/highcharts-react-official
By using this wrapper, you can in easy way add additional plugins or modules. Below I created a live example with Motion-Highcharts-Plugin.
Live demo: https://codesandbox.io/s/6j359qpr6r

drawImage draw the image on canvas but after any event it disappear image fabricjs

I am drawing an image on canvas via drawImage method, it draw the image but when any event is called is become blank and disappear. I tried different ways but not success. I want to show the image on canvas and not disappear, Because I convas this canvas to dataUrl which become blank.
My working Link
Please anyone who know please guide me where i am going wrong.
Below is my code.
<!DOCTYPE html>
<html>
<head>
<title>Canvas.dataURL tainted(polluted) Issue</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="https://technology-architects.com/daulat/customizer_assets/js/bootstrap-slider.js"></script>
<script type="text/javascript" src="https://technology-architects.com/daulat/customizer_assets/js/jquery.liteuploader.js"></script>
<script type="text/javascript" src="https://files.codepedia.info/files/uploads/iScripts/html2canvas.js"></script>
<script type="text/javascript" src="https://technology-architects.com/daulat/customizer_assets/js/custom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.5.0/fabric.min.js"></script>
<script src="https://technology-architects.com/daulat/customizer_assets/cartjs/cart.js"></script>
<script src="https://technology-architects.com/daulat/customizer_assets/fabric-js/custom/fabricExtensions.js"></script>
<script type="text/javascript" src="https://technology-architects.com/daulat/customizer_assets/bgrins-spectrum/spectrum.js"></script>
<script type="text/javascript" src="https://technology-architects.com/daulat/customizer_assets/js/fabric.curvedText.js"></script>
</head>
<body>
<style>
.canvas-container{display:inline-block;vertical-align:middle;}
</style>
<canvas id="canvas" height=758 width=497 style="border:1px solid lightgrey;display:inline-block;"></canvas>
<img id="curveImg" src="http://production.technology-architects.com/doulat/curtains_new/3d_view/images/sample.png" alt="" style="display:inline-block;vertical-align:middle;">
<button type="button" id="clickme">Click Me!</button>
<script>
var canvas = new fabric.Canvas('canvas');
var offsetY=[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,29.5,30,30.1,30.2,30.3,30.4,30.5,30.6,30.7,30.8,30.9,30,29.5,29,28,27,26,25,24,23,22,21,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,29.5,30,30.1,30.2,30.3,30.4,30.5,30.6,30.7,30.8,30.9,30,29.5,29,28,27,26,25,24,23,22,21,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,29.5,30,30.1,30.2,30.3,30.4,30.5,30.6,30.7,30.8,30.9,30,29.5,29,28,27,26,25,24,23,22,21,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,29.5,30,30.1,30.2,30.3,30.4,30.5,30.6,30.7,30.8,30.9,30,29.5,29,28,27,26,25,24,23,22,21,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,29.5,30,30.1,30.2,30.3,30.4,30.5,30.6,30.7,30.8,30.9,30,29.5,29,28,27,26,25,24,23,22,21,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,29.5,30,30.1,30.2,30.3,30.4,30.5,30.6,30.7,30.8,30.9,30,29.5,29,28,27,26,25,24,23,22,21,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,29.5,30,30.1,30.2,30.3,30.4,30.5,30.6,30.7,30.8,30.9,30,29.5,29,28,27,26,25,24,23,22,21,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,29.5,30,30.1,30.2,30.3,30.4,30.5,30.6,30.7,30.8,30.9,30,29.5,29,28,27,26,25,24,23,22,21,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,29.5,30,30.1,30.2,30.3,30.4,30.5,30.6,30.7,30.8,30.9,30,29.5,29,28,27,26,25,24,23,22,21,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,29.5,30,30.1,30.2,30.3,30.4,30.5,30.6,30.7,30.8,30.9,30,29.5,29,28,27,26,25,24,23,22,21,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0.9,0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0]
var ctx = canvas.getContext("2d");
var immg = 'http://production.technology-architects.com/doulat/curtains_new/3d_view/images/sample.png';
fabric.util.loadImage(immg, function(img) {
for(var x=0;x<offsetY.length;x++){
ctx.drawImage(img,
// clip 1 pixel wide slice from the image
x,0,1,img.height,
// draw that slice with a y-offset
x,offsetY[x],1,img.height
);
}
},null, {crossOrigin:'anonymous'});
canvas.renderAll();
$(document).on('click','#clickme',function(){
var imagedatafinal = canvas.toDataURL('image/png');
console.log(imagedatafinal);
$('#curveImg').attr('src',imagedatafinal);
var imgdatafinal = imagedatafinal.replace(/^data:image\/(png|jpg);base64,/, "");
//ajax call to save image inside folder
$.ajax({
url: '../save_image.php',
data: {
imgdata:imgdatafinal
},
type: 'post',
success: function (response) {
$('#curveImg').attr('src',response);
console.log(response);
}
});
});
</script>
</body>
</html>
Check this Fiddle.
You are getting this problem because you are drawing that in context and not adding that to canvas object. So after drawing in context you get that context data using ctx.getImageData(0, 0, img.width, img.height); After that create a canvas element and put that image datac.getContext('2d').putImageData(data, 0, 0); then create an fabricjs image object from that canvas image data.
*Crossorigin problem is there so fiddle not working, you can check this in your local server
Working fiddle
You have to add image on fabric canvas as below.
var imgbase64 = new fabric.Image(img, {})
canvas.add(imgbase64);
And then it will work. Just make sure to check this on your local server as here it will throw CROS error.
I've changed image src to get it work as getting CORS error from your sample.
var canvas = new fabric.Canvas('canvas');
var offsetY = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 29.5, 30, 30.1, 30.2, 30.3, 30.4, 30.5, 30.6, 30.7, 30.8, 30.9, 30, 29.5, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 29.5, 30, 30.1, 30.2, 30.3, 30.4, 30.5, 30.6, 30.7, 30.8, 30.9, 30, 29.5, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 29.5, 30, 30.1, 30.2, 30.3, 30.4, 30.5, 30.6, 30.7, 30.8, 30.9, 30, 29.5, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 29.5, 30, 30.1, 30.2, 30.3, 30.4, 30.5, 30.6, 30.7, 30.8, 30.9, 30, 29.5, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 29.5, 30, 30.1, 30.2, 30.3, 30.4, 30.5, 30.6, 30.7, 30.8, 30.9, 30, 29.5, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 29.5, 30, 30.1, 30.2, 30.3, 30.4, 30.5, 30.6, 30.7, 30.8, 30.9, 30, 29.5, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 29.5, 30, 30.1, 30.2, 30.3, 30.4, 30.5, 30.6, 30.7, 30.8, 30.9, 30, 29.5, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 29.5, 30, 30.1, 30.2, 30.3, 30.4, 30.5, 30.6, 30.7, 30.8, 30.9, 30, 29.5, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 29.5, 30, 30.1, 30.2, 30.3, 30.4, 30.5, 30.6, 30.7, 30.8, 30.9, 30, 29.5, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 29.5, 30, 30.1, 30.2, 30.3, 30.4, 30.5, 30.6, 30.7, 30.8, 30.9, 30, 29.5, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0]
var ctx = canvas.getContext("2d");
var immg = 'http://i.imgur.com/3tU4Vig.jpg';
var img = new Image();
img.crossOrigin = "anonymous";
img.src = immg;
img.onload = function() {
var imgbase64 = new fabric.Image(img, {
width: 400,
height: 500
})
canvas.add(imgbase64);
canvas.deactivateAll().renderAll();
}
canvas.renderAll();
$(document).on('click', '#clickme', function() {
var imagedatafinal = canvas.toDataURL('image/png');
console.log(imagedatafinal);
$('#curveImg').attr('src', imagedatafinal);
var imgdatafinal = imagedatafinal.replace(/^data:image\/(png|jpg);base64,/, "");
//ajax call to save image inside folder
$.ajax({
url: '../save_image.php',
data: {
imgdata: imgdatafinal
},
type: 'post',
success: function(response) {
$('#curveImg').attr('src', response);
console.log(response);
}
});
});
<!DOCTYPE html>
<html>
<head>
<title>Canvas.dataURL tainted(polluted) Issue</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="https://technology-architects.com/daulat/customizer_assets/js/bootstrap-slider.js"></script>
<script type="text/javascript" src="https://technology-architects.com/daulat/customizer_assets/js/jquery.liteuploader.js"></script>
<script type="text/javascript" src="https://files.codepedia.info/files/uploads/iScripts/html2canvas.js"></script>
<script type="text/javascript" src="https://technology-architects.com/daulat/customizer_assets/js/custom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.5.0/fabric.min.js"></script>
<script src="https://technology-architects.com/daulat/customizer_assets/cartjs/cart.js"></script>
<script src="https://technology-architects.com/daulat/customizer_assets/fabric-js/custom/fabricExtensions.js"></script>
<script type="text/javascript" src="https://technology-architects.com/daulat/customizer_assets/bgrins-spectrum/spectrum.js"></script>
<script type="text/javascript" src="https://technology-architects.com/daulat/customizer_assets/js/fabric.curvedText.js"></script>
</head>
<body>
<style>
.canvas-container {
display: inline-block;
vertical-align: middle;
}
</style>
<canvas id="canvas" height=758 width=497 style="border:1px solid lightgrey;display:inline-block;"></canvas>
<img id="curveImg" alt="" style="display:inline-block;vertical-align:middle;">
<button type="button" id="clickme">Click Me!</button>
</body>
</html>

AmCharts.js - set default "compareto" set to all instead of none

Is it possible to set compare to all by default? When I refresh the page it shows only one line, I want chart to show all lines by default and user can hide them.
This is the default behaviour:
I want to somehow achieve this:
But I can't figure out what to change in settings of the graph. (in fact I don't need "comparing" attitude, just chart for all prices with multiple lines which can be hidden).
This is the chart (the {{ google_chart|safe }} is a variable for JSON - {"web_name": [[[year,month...], price], [[year,month..], price],...}):
<script>
var lines = [];
var dataSets = [];
generateChartData();
function generateChartData() {
var google_chart_json = {{ google_chart|safe }};
var loopcounter = -1;
$.each(google_chart_json, function (key, val) {
var line = [];
loopcounter = loopcounter + 1;
$.each(val, function (_, scan) {
var year = scan[0][0];
var month = scan[0][1];
var day = scan[0][2];
var hour = scan[0][3];
var minute = scan[0][4];
var price = scan[1];
var data = {
'date': new Date(year, month - 1, day, hour, minute),
'value': price
};
line.push(data);
});
line.sort(function (lhs, rhs) {
return lhs.date.getTime() - rhs.date.getTime();
});
lines.push([key, line]);
});
console.log('LINES');
console.log(lines);
$.each(lines, function (_, name_line) {
var dict = {
'title': name_line[0],
"fieldMappings": [{
"fromField": "value",
"toField": "value"
}],
"dataProvider": name_line[1],
"categoryField": "date"
};
dataSets.push(dict);
});
}
console.log(dataSets)
var chart = AmCharts.makeChart("chartdiv", {
categoryAxesSettings: {
minPeriod: "hh",//(at least that is not grouped)
groupToPeriods: ["DD", "WW", "MM"]//(Data will be grouped by day,week and month)
},
"type": "stock",
"theme": "light",
"dataSets": dataSets,
"panels": [{
"showCategoryAxis": false,
"title": "Value",
"percentHeight": 70,
"stockGraphs": [{
"id": "g1",
"valueField": "value",
"comparable": true,
"compareField": "value",
"balloonText": "[[date]][[title]]:<b>[[value]]</b>",
"compareGraphBalloonText": "[[title]]:<b>[[value]]</b>"
}],
"stockLegend": {
"periodValueTextComparing": "[[percents.value.close]]%",
"periodValueTextRegular": "[[value.close]]"
}
}],
"chartScrollbarSettings": {
"graph": "g1"
},
"chartCursorSettings": {
"valueBalloonsEnabled": true,
"fullWidth": true,
"cursorAlpha": 0.1,
"valueLineBalloonEnabled": true,
"valueLineEnabled": true,
"valueLineAlpha": 0.5
},
"periodSelector": {
"position": "left",
"periods": [{
"period": "MM",
"selected": true,
"count": 1,
"label": "1 month"
}, {
"period": "YYYY",
"count": 1,
"label": "1 year"
}, {
"period": "YTD",
"label": "YTD"
}, {
"period": "MAX",
"label": "MAX"
}]
},
"dataSetSelector": {
"position": "left"
},
"export": {
"enabled": true
}
});
chart.panelsSettings.recalculateToPercents = "never";
</script>
Set compared to true in each dataSet that you want compared/visible by default. The first dataSet doesn't need to have this set, so you'll want to check your index value before setting the property or else it will appear twice:
$.each(lines, function (idx, name_line) {
var dict = {
'title': name_line[0],
"fieldMappings": [{
"fromField": "value",
"toField": "value"
}],
"dataProvider": name_line[1],
"categoryField": "date"
};
if (idx > 0) {
dict.compared = true;
}
dataSets.push(dict);
});
Demo below using the data from your previous question.
var lines = [];
var dataSets = [];
generateChartData();
function generateChartData() {
var google_chart_json = {"fotolab.sk": [[[2016, 12, 19, 20, 38], 338.36], [[2016, 12, 18, 20, 38], 341.82], [[2016, 12, 17, 20, 38], 382.92], [[2016, 12, 16, 20, 38], 384.24], [[2016, 12, 15, 20, 38], 393.16], [[2016, 12, 14, 20, 38], 319.6], [[2016, 12, 13, 20, 38], 329.64], [[2016, 12, 12, 20, 38], 300.1], [[2016, 12, 11, 20, 38], 324.66], [[2016, 12, 10, 20, 38], 377.9], [[2016, 12, 20, 18, 52], 359.0]], "hej.sk": [[[2016, 12, 19, 20, 38], 380.18], [[2016, 12, 18, 20, 38], 327.4], [[2016, 12, 17, 20, 38], 382.5], [[2016, 12, 16, 20, 38], 389.76], [[2016, 12, 15, 20, 38], 385.23], [[2016, 12, 14, 20, 38], 355.48], [[2016, 12, 13, 20, 38], 328.39], [[2016, 12, 12, 20, 38], 311.35], [[2016, 12, 11, 20, 38], 350.8], [[2016, 12, 10, 20, 38], 389.81], [[2016, 12, 20, 18, 52], 399.0]], "mall.sk": [[[2016, 12, 19, 20, 38], 341.9], [[2016, 12, 18, 20, 38], 319.2], [[2016, 12, 17, 20, 38], 360.81], [[2016, 12, 16, 20, 38], 315.76], [[2016, 12, 15, 20, 38], 347.37], [[2016, 12, 14, 20, 38], 353.97], [[2016, 12, 13, 20, 38], 300.64], [[2016, 12, 12, 20, 38], 302.87], [[2016, 12, 11, 20, 38], 308.8], [[2016, 12, 10, 20, 38], 351.25], [[2016, 12, 20, 18, 52], 399.0]], "shoppie.sk": [[[2016, 12, 19, 20, 38], 363.41], [[2016, 12, 18, 20, 38], 315.55], [[2016, 12, 17, 20, 38], 369.09], [[2016, 12, 16, 20, 38], 369.85], [[2016, 12, 15, 20, 38], 354.29], [[2016, 12, 14, 20, 38], 305.96], [[2016, 12, 13, 20, 38], 387.4], [[2016, 12, 12, 20, 38], 303.95], [[2016, 12, 11, 20, 38], 384.83], [[2016, 12, 10, 20, 38], 303.81], [[2016, 12, 20, 18, 52], 399.0]], "k24.sk": [[[2016, 12, 19, 20, 38], 329.87], [[2016, 12, 18, 20, 38], 349.04], [[2016, 12, 17, 20, 38], 317.51], [[2016, 12, 16, 20, 38], 386.28], [[2016, 12, 15, 20, 38], 371.44], [[2016, 12, 14, 20, 38], 321.24], [[2016, 12, 13, 20, 38], 391.55], [[2016, 12, 12, 20, 38], 372.62], [[2016, 12, 11, 20, 38], 383.1], [[2016, 12, 10, 20, 38], 337.88], [[2016, 12, 20, 18, 52], 310.58]], "ello24.com": [[[2016, 12, 19, 20, 38], 327.53], [[2016, 12, 18, 20, 38], 395.58], [[2016, 12, 17, 20, 38], 366.37], [[2016, 12, 16, 20, 38], 328.88], [[2016, 12, 15, 20, 38], 330.78], [[2016, 12, 14, 20, 38], 349.29], [[2016, 12, 13, 20, 38], 327.62], [[2016, 12, 12, 20, 38], 396.08], [[2016, 12, 11, 20, 38], 336.72], [[2016, 12, 10, 20, 38], 345.49], [[2016, 12, 20, 18, 52], 304.0]]};
var loopcounter = -1;
$.each(google_chart_json, function (key, val) {
var line = [];
loopcounter = loopcounter + 1;
$.each(val, function (_, scan) {
var year = scan[0][0];
var month = scan[0][1];
var day = scan[0][2];
var hour = scan[0][3];
var minute = scan[0][4];
var price = scan[1];
var data = {
'date': new Date(year, month - 1, day, hour, minute),
'value': price
};
line.push(data);
});
line.sort(function (lhs, rhs) {
return lhs.date.getTime() - rhs.date.getTime();
});
lines.push([key, line]);
});
console.log('LINES');
console.log(lines);
$.each(lines, function (idx, name_line) {
var dict = {
'title': name_line[0],
"fieldMappings": [{
"fromField": "value",
"toField": "value"
}],
"dataProvider": name_line[1],
"categoryField": "date"
};
if (idx > 0) {
dict.compared = true;
}
dataSets.push(dict);
});
}
console.log(dataSets)
var chart = AmCharts.makeChart("chartdiv", {
categoryAxesSettings: {
minPeriod: "hh",//(at least that is not grouped)
groupToPeriods: ["DD", "WW", "MM"]//(Data will be grouped by day,week and month)
},
"type": "stock",
"theme": "light",
"dataSets": dataSets,
"panels": [{
"showCategoryAxis": false,
"title": "Value",
"percentHeight": 70,
"stockGraphs": [{
"id": "g1",
"valueField": "value",
"comparable": true,
"compareField": "value",
"balloonText": "[[date]][[title]]:<b>[[value]]</b>",
"compareGraphBalloonText": "[[title]]:<b>[[value]]</b>"
}],
"stockLegend": {
"periodValueTextComparing": "[[percents.value.close]]%",
"periodValueTextRegular": "[[value.close]]"
}
}],
"chartScrollbarSettings": {
"graph": "g1"
},
"chartCursorSettings": {
"valueBalloonsEnabled": true,
"fullWidth": true,
"cursorAlpha": 0.1,
"valueLineBalloonEnabled": true,
"valueLineEnabled": true,
"valueLineAlpha": 0.5
},
"periodSelector": {
"position": "left",
"periods": [{
"period": "MM",
"selected": true,
"count": 1,
"label": "1 month"
}, {
"period": "YYYY",
"count": 1,
"label": "1 year"
}, {
"period": "YTD",
"label": "YTD"
}, {
"period": "MAX",
"label": "MAX"
}]
},
"dataSetSelector": {
"position": "left"
},
"export": {
"enabled": true
}
});
chart.panelsSettings.recalculateToPercents = "never";
#chartdiv {
width: 100%;
height: 400px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//www.amcharts.com/lib/3/amcharts.js"></script>
<script src="//www.amcharts.com/lib/3/serial.js"></script>
<script src="//www.amcharts.com/lib/3/amstock.js"></script>
<div id="chartdiv"></div>

AmCharts: is there a way to enable zooming only by X axis on XYChart?

I'm using amcharts 3 for xychart and I would like to disable possibility for user to zoom y axis, but still make it possible to zoom x axis by ChartCursor.
Yes, you should set:
"hideYScrollbar":true
Full source:
var chart = AmCharts.makeChart("chartdiv", {
"type": "xy",
"theme": "light",
"marginRight": 80,
"marginTop": 17,
"hideYScrollbar":true,
"dataProvider": [{
"y": 10,
"x": 14,
"value": 59,
"y2": -5,
"x2": 0,
"value2": 44
}, {
"y": 5,
"x": 3,
"value": 50,
"y2": -15,
"x2": -8,
"value2": 12
}, {
"y": -10,
"x": -3,
"value": 19,
"y2": -4,
"x2": 6,
"value2": 35
}, {
"y": -6,
"x": 5,
"value": 65,
"y2": -5,
"x2": -6,
"value2": 168
}, {
"y": 15,
"x": -4,
"value": 92,
"y2": -10,
"x2": -8,
"value2": 102
}, {
"y": 13,
"x": 1,
"value": 8,
"y2": -2,
"x2": -3,
"value2": 41
}, {
"y": 1,
"x": 6,
"value": 35,
"y2": 0,
"x2": 1,
"value2": 16
}],
"valueAxes": [{
"position": "bottom",
"axisAlpha": 0
}, {
"minMaxMultiplier": 1.2,
"axisAlpha": 0,
"position": "left"
}],
"startDuration": 1.5,
"graphs": [{
"balloonText": "x:<b>[[x]]</b> y:<b>[[y]]</b><br>value:<b>[[value]]</b>",
"bullet": "bubble",
"lineAlpha": 0,
"valueField": "value",
"xField": "x",
"yField": "y",
"fillAlphas": 0,
"bulletBorderAlpha": 0.2,
"maxBulletSize": 80
}, {
"balloonText": "x:<b>[[x]]</b> y:<b>[[y]]</b><br>value:<b>[[value]]</b>",
"bullet": "bubble",
"lineAlpha": 0,
"valueField": "value2",
"xField": "x2",
"yField": "y2",
"fillAlphas": 0,
"bulletBorderAlpha": 0.2,
"maxBulletSize": 80
}],
"marginLeft": 46,
"marginBottom": 35,
"chartScrollbar": {},
"chartCursor": {},
"balloon":{
"fixedPosition":true
},
"export": {
"enabled": true
}
});
Codepen: http://codepen.io/team/amcharts/pen/cdd55aa9f4f761686a4027d6895263da

Categories

Resources