dygraphs icon indicating copy to clipboard operation
dygraphs copied to clipboard

toDomXCoord doesn't take log scale into account

Open bloer opened this issue 8 years ago • 1 comments

fiddle at http://jsfiddle.net/04h3r3aL/3/ shows the issue clearly. toDataXCoord seems to produce a reasonable value, but going the other way it's pretty obvious that it's treating the scale as linear. It does work correctly for the y axis.

I'm seeing this on firefox 47, windows 7 with the current dygraph version.

bloer avatar Jul 21 '16 20:07 bloer

FWIW fix looks like:

range = graph.xAxisRange();
return area.x + (Math.log10(x) - Math.log10(range[0])) / (Math.log10(range[1]) - Math.log10(range[0])) * area.w;

ollierob avatar Jun 14 '18 14:06 ollierob