novus / nvd3

A reusable charting library written in d3.js
http://nvd3.org/
Other
7.22k stars 2.14k forks source link

scatter graphs don't seem to support log scale very well #620

Open marksandler2 opened 10 years ago

marksandler2 commented 10 years ago

When i use linear model i can do this and it works as expected (example from http://nvd3.org/livecode/index.html#)

nv.addGraph(function() { var chart = nv.models.lineChart() .useInteractiveGuideline(true) ;

chart.xAxis .axisLabel('Time (ms)') .tickFormat(d3.format(',r')) ; chart.xScale(d3.scale.log() ) // ***** <- set log scale chart.yScale(d3.scale.log() ) // ***** <-- set log scale chart.yAxis .axisLabel('Voltage (v)') .tickFormat(d3.format('.02f')) ;

d3.select('#chart svg') .datum(data()) .transition().duration(500) .call(chart) ;

nv.utils.windowResize(chart.update);

return chart; });

image

However the same two lines of code produce very odd result when i use scatte:

nv.addGraph(function() { var chart = nv.models.scatterChart() .showDistX(true) .showDistY(true) .color(d3.scale.category10().range());

chart.xAxis.tickFormat(d3.format('.02f')); chart.yAxis.tickFormat(d3.format('.02f')); ; chart.xScale(d3.scale.log() ) // **** <- set log scale chart.yScale(d3.scale.log() ) // **** <-- set log scale d3.select('#chart svg') .datum(data(4,40)) .transition().duration(500) .call(chart);

nv.utils.windowResize(chart.update);

return chart; });

It seems that the result should be identical, but it is not: graphs are drawn correctly but axes are not (see labels drawn on top of each other in top/left corner)

image

poc7667 commented 10 years ago

I have the same issue.

huynhquocmy commented 10 years ago

I have the same issue too. How can I resolve it ? Any help !

sodoku commented 10 years ago

Any update on this? I really need this.

huynhquocmy commented 10 years ago

Sorry but no update.

liquidpele commented 9 years ago

Please check out the development branch of my fork and see if this is still an issue. If so, then if you open an issue under my fork I'll see about fixing it. Unfortunatly novus isn't maintaining nvd3 anymore so my fork is the most updated.

sodoku commented 9 years ago

@liquidpele yes, your dev branch is much faster and makes nvd3 usable again. Thanks for that!

Unfortunately I allready switched to google graphs for my project. :(

liquidpele commented 9 years ago

:'(

No worries, google graphs are quite nice if you can require internet access to use them!

marksandler2 commented 9 years ago

Thanks for the update and a pointer. Will let you know if things work. Meanwhile - is there a sandbox area to play with the new and improved nvd3 examples?

m

On Sun, Dec 7, 2014 at 6:27 PM, liquidpele notifications@github.com wrote:

:'(

No worries, google graphs are quite nice if you can require internet access to use them!

— Reply to this email directly or view it on GitHub https://github.com/novus/nvd3/issues/620#issuecomment-65968928.

liquidpele commented 9 years ago

Not yet, just my examples page: http://liquidpele.github.io/nvd3/

liquidpele commented 9 years ago

Does the scatter graph support log scale? Not even sure about that one...

marksandler2 commented 9 years ago

Where can i test it?

On Wed, Feb 11, 2015 at 4:19 PM, liquidpele notifications@github.com wrote:

Does the scatter graph support log scale? Not even sure about that one...

— Reply to this email directly or view it on GitHub https://github.com/novus/nvd3/issues/620#issuecomment-73993923.

liquidpele commented 9 years ago

That was more of a question for the novus guys... not sure if they intended for a log axis to work or not...

robinfhu commented 9 years ago

We've never really tested our charts with Logarithmic scales. If we can setup some examples that would be great. We'll need to look into it.