Skip to content
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

Could not run example code given in 'rCharts: Highcharts example' #251

Closed
ghost opened this issue Sep 14, 2013 · 2 comments
Closed

Could not run example code given in 'rCharts: Highcharts example' #251

ghost opened this issue Sep 14, 2013 · 2 comments

Comments

@ghost
Copy link

ghost commented Sep 14, 2013

Hi all,

I was trying to replicate the example given here: http://rstudio-pubs-static.s3.amazonaws.com/5548_c3b680696b084e5db17eecf8c079a3c1.html

However could not run that at all. Below is the situation what happened:

library(rCharts)

Prepare data

x <- data.frame(USPersonalExpenditure)
colnames(x) <- substr(colnames(x), 2, 5)

Create chart

a <- rCharts:::Highchart$new()
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) :
object 'Highchart' not found

Next I tried with this:

a <- rCharts:::Highcharts$new()

However now I got following error:

a$chart(type = "column")
a$title(text = "US Personal Expenditure")
a$xAxis(categories = rownames(x))
a$yAxis(title = list(text = "Billions of dollars"))
a$data(x)

Print chart

a$printChart()
Error in envRefInferField(x, what, getClass(class(x)), selfEnv) :
‘printChart’ is not a valid field or method name for reference class “Highcharts”

I would really appreciate if someone points me how to run them correctly.

I also want Horizontal plot, not Vertical plot as given in that example. Can someone tell me about the adjustment, if any?

Thanks and regards,

@tinu-schneider
Copy link

Same happened to me and for your first question I found the reason: It's a typo in the demo-code, should be Highchart_s_ instead of Highchart

a <- rCharts:::Highcharts$new()

Your second question could be solved with print instead of printChart

a$print('chart 1', include_assets = TRUE)

See here for other chart-types from Highcharts

@ramnathv
Copy link
Owner

The chart you see was made with a really old version of rCharts. We have made lot of changes to the API since then. The answers by @tinu-schneider should help you correct your code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants