Open TonyDIRL opened 10 years ago
good catch! The unintended, explicit rounding happens in RJSONIO::toJSON
, which is still part of rCharts I guess, @ramnathv ? (fyi @timelyportfolio )
str(mychart) # explore object components
mychart$params$data # no explicit rounding here
# t SPY.Open
# 2014-01-02 #!new Date(1388620800000)!# 183.9825
# 2014-01-03 #!new Date(1388707200000)!# 183.2325
RJSONIO::toJSON(mychart$params$data) # it happens here dammit!
# ... \n\"SPY.Open\": [ 183.98, 183.23, 183.49 ...
This might help https://github.com/ramnathv/rCharts/issues/248 . I will confirm when I get on a computer.
After reading around the issue and some tickering I believe the digits parameter of toJSON
toJSON(num, digits = 10)
will solve the issue. @danielkrizian would you consider making 'digits' a parameter within the dygraph() call facilitating more flexibility for the user?
Hi @TonyDIRL , Dygraph
class does not even call toJSON directly. Ability to add digits
as a parameter of toJSON
and the function call itself is down in the rCharts
class in Ramnath's package, which Dygraph
class inherits from.
I 've created a pull request for @ramnathv to review: https://github.com/ramnathv/rCharts/pull/449.
If my guess is correct, I will add inside the dygraph
constructor the following code: Dygraph$addParams(digits=digits)
.
Guys let me know if you have a better idea.
Thank you
Perhaps I'm missing something obvious but I can't get beyond two decimal points of precision on y-axis variables.
The relevant dygraph parameters are digitsAfterDecimal, yaxisLabelWidth and a custom yaxisLabelFormatter function as can be seen in this jsfiddle: http://jsfiddle.net/TonyDIRL/fGZ2D/
Reviewing the generated source from the above R code shows
I've walked through the parseData function within the library but I can't see where the explicit rounding occurs.
Please advise.