PMSI-AlignAlytics/dimple — pull request #9 by kbuchanan (2013-08-30 14:25:14+00:00)
Title: Adding logAxis to line charts (positive or negative range)

I added the ability for line charts to have a log axis. It's very minor code to add the functionality.

And since log 0 returns -Infinity, I made it so the domain starts at either 0.1 or -0.1. I use clamp(true) so the chart starts at 0 if there are 0 values. You can't have both positive and negative values in your range since log is either positive or negative, not both.

I've also added code for logAxis cases in the line.js for the tooltip so it draws the appropriate value and not what is returned by the _getFormat.

Since d3.scale.log does not allow a set tick amount using the ticks function, I've had to use tickFormat and set it to a value (4 default). This hides the tick labels, but not the tick lines. I added a case in _getFormat.js to return the unique way logs get formatted.

Let me know what you think (i.e. comments/suggestions). This makes drawing a chart where you have a large variance in values (One value ranges from 8,000 to 10,000, while others from 50 to 500), but staying on a single graph. We're looking to use this scale to see trends over time for several keys with varying values.