OK, thank you
Your posted code needed quite a bit of cleanup, but I have made a fiddle for you, so it can bee addressed more easily:
I have the strangest thing now, since I am using ‘stackedArea’ I now have with a large dataset (and includeZero:false) that when a have a relative low value in the past and zoom in on a point “later in time” the “low value” is the low value of the complete dataset, not just of the zoomed part (so the zoom is now a bit messed up..).
I am working on quite a complex chart. But I’ll try to build a fiddle so you may be able to fix the bug
It was a bit of programming, but I thought of a solution:
– use a stackedArea – subtract the stacked value – set fillOpacity of the base value to zerro – custom toolTip (add the other value)
function makeStacked(stack,base) { if (stack.length != base.length) { alert('makeStacked: '+stack.length+' != '+base.length); return stack; } var stacked = []; for (var i = 0; i < stack.length; i++) { stacked[i] = stack[i]; stacked[i].y = stack[i].y - base[i].y; } return stacked; }
The fillOpacity is not an option in my case. Placing of the stripLines is a good idea. However, my Chart renders with an automatic grid line interval, I cannot detect the current (automatic) interval can I?
Slight improvement, On large datasets the “search speed up” doesn’t work right.
Change this section:
if( document.getElementById("xData"+i) ) { // to speed up the search! ii_start = document.getElementById("xData"+i).innerHTML-2; if (ii_start < 0 ) { ii_start = 0 } } if (typeof(dataPoints[ chart.options.data[i].name ]) == 'undefined') {
with:
if (typeof(dataPoints[ chart.options.data[i].name ]) == 'undefined' ) { if( document.getElementById("xData"+i) ) { // to speed up the search! ii_start = parseInt(document.getElementById("xData"+i).innerHTML); if (ii_start > 0 ) { while (ii_start > 0 && e.entries[0].dataPoint.x.getTime() - chart.options.data[i].dataPoints[ii_start].x.getTime() < 0) { ii_start = parseInt(ii_start*.9)-6; } } ii_start-= 6; if (ii_start < 0 ) { ii_start = 0 } }