-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Render console.log() to browser javascript console instead of visualization? #60
Comments
This should work correctly, For instance, consider the following example, notice the // !preview r2d3 data=c(0.3, 0.6, 0.8, 0.95, 0.40, 0.20)
//
// r2d3: https://rstudio.github.io/r2d3
//
var barHeight = Math.ceil(height / data.length);
svg.selectAll('rect')
.data(data)
.enter().append('rect')
.attr('width', function(d) {
console.log("test");
return d * width;
})
.attr('height', barHeight)
.attr('y', function(d, i) { return i * barHeight; })
.attr('fill', 'steelblue'); This code triggers both, an update in the console and the visualization, notice the Could you perhaps provide the sources of your visualization since is probably specific to that particular code or environment? |
Yes, your example does write "test" to the console. But if the output is not text, then it just has a generic return. To see this, let's simplify your code above:
which only sends the console,
I cross-posted on stack overflow, and someone posted the following workaround: including,
as the first line of the javascript gives an inspectable object, where you can expand its hierarchy like so, Being able to inspect the actual objects like this can be very useful. |
Did this bug ever get fixed? This issue is kind of a deal-breaker for being able to effectively use r2d3. I've documented the issue here, if it's helpful: Thank you! |
JavaScript console output from
r2d3
is rendered directly into the RStudio viewer visualization instead of the javascript console. See documentation.This also seems to be the behavior when
r2d3::r2d3(..., viewer = 'browser')
I.e., the
console.log()
does not output to the console even in the browser. But sometimes I'd like to inspect objects written to the browser console because they are not text.Is there a clean way to change this behavior, for
console.log()
information in anr2d3
D3.js to be sent to the browser console?The text was updated successfully, but these errors were encountered: