javascript - g.raphael js(graphaeljs), line, hoverColumn problem -


i using graphael js lib draw line chart. , have problem havercolumn function. simplified hovercolumn function.

var line = raphael.g.linechart(50, 20, 650, 120, xary, yary, options).hovercolumn(function (){     ...     console.log(this.x+","+this.y);     .... } 

when mouse hovering on chart, hovercolumn function called, , log function executed. but, area doesn't call hovercolumn function.

so, did debugging using firebug, found reason. there big rect area on line chart, when mouse on area, hovercolumn doesn't call despite mouse on chart's column.

here captured image understanding. fire bug, , rect.

enter image description here

when remove rect manually using firebug, hovercolumn function works well~ -_-;

the area code made graphael-js automatically.

so, there way solve problem? idea please~

i found solution @ last(takes 1 day hacking...=_=;). problem in g.line.js, graphael js library.

in source code, there createcolumns function this,

function createcolumns(f) {         // unite xs         var xs = [];         (var = 0, ii = valuesx.length; < ii; i++) {             xs = xs.concat(valuesx[i]);         }         xs.sort();         ....         ...         .. } 

the problem sorting function. xs.sort() sort x values, function returns sorted array errors. so, if input array is,

valuesx = [0.05076044713698533, 9.579202857778233, 10.93181619059174]; valuesx.sort(); 

the result

[0.05076044713698533, 10.93181619059174, 9.579202857778233] not [0.05076044713698533, 9.579202857778233, 10.93181619059174] 

as result, column broken~

so, changed sort function, xs.sort() this:

xs.sort(function(a, b){             return - b;         }); 

works well~ ^^; hope helps~


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -