rubycritic
rubycritic copied to clipboard
Complexity vs Churn graph: Log scaling option wise?
I'm trying to determine how useful it would be to add a log scaling option, though not as a default. Seems like it would be helpful in ensuring that the graph isn't quite as clustered or distorted by outliers. The data would need to be adjusted slightly to avoid log(0) issues. I've done this by manually adjusting the highchart and it seems to work fairly well.
I'm trying to determine how useful it would be to add a log scaling option, though not as a default.
I believe this might be very useful indeed, would be great if you could give it a shot ;)
I'll give it a shot. I've started working out the design but after a couple hours I ran into a couple issues.
- Spent a fair bit of time trying to get around simply incrementing each by one to avoid log(0) issues. The best overall solution seems to be to use a linear scale and simulate log scaling by manipuating the data set and output formatting. So plot them as
Math.log10(x+1)but display the values asxviaMath.pow(x, 10)(and a bit of rounding). This seems to require converting line 95 in application.js to usepointFormatterinstead ofpointFormatso you can. However, I've been unable to get it to work at all even after trying code from several places and reading a number of StackOverflow answers. Perhaps my JavaScript skills are lacking. For now I'll just go with the simple +1 method. - I'm still filling in some gaps in my Ruby knowledge and I'm not sure how best to go about adjusting the code to allow toggling between log and linear scaling. I'm currently looking at the
initializefunction of overview.rb as a place to put a@use_log_scalevariable to handle whether they should be used or not. The main reason being that@turbulence_datais also defined here which will need to be adjusted to handle the log(0) issue. The issue is that I'm also trying to working out how that will be set in the first place. Seems I'll have to take a look into the commands section of this repo before I can continue on this front as I've been focusing on the first point so far.
Any tips in were relevant code is would be helpful. This repo isn't exactly small.
Just leaving this here: http://www.highcharts.com/docs/chart-concepts/axes
Adding type: 'logarithmic' to an axis should have some effect.
@guilhermesimoes: Thanks. I'll have to revisit this a bit, as it's been a few months and I've learned a fair bit more since then. Still probably needs a bit of work to deal with values of zero.