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

Refactoring To Do #23

Closed
2 tasks done
ramnathv opened this issue Apr 21, 2013 · 2 comments
Closed
2 tasks done

Refactoring To Do #23

ramnathv opened this issue Apr 21, 2013 · 2 comments

Comments

@ramnathv
Copy link
Owner

  • Move common portions of the initialize method to the main rCharts class, and use callSuper() in the individual chart classes.
  • Figure out if users should be allowed to set width and height of plot from within the *Plot function.

A question that remains is whether or not to allow the users to set width and height of the plot from within the *Plot function. A case in favor is that most plots should be single line R commands and width and height of a plot are important components.

params <<- list(
  dom   = basename(tempfile('chart')),
  width  = getOption('RCHART_WIDTH', 700), 
  height = getOption('RCHART_HEIGHT', 300)
)

Example of using callSuper to override initialization inside child classes.

Class1 = setRefClass('Class1', fields = list(params = 'list'), methods = list(
  initialize = function(){
    params <<- list(x = 1, y = 2)
  }  
))

Class2 = setRefClass('Class2', fields = list(params = 'list'), contains = 'Class1', 
     methods = list(
  initialize = function(){
    callSuper()
    params <<- modifyList(params, list(x = 3))
  }  
))
@ramnathv
Copy link
Owner Author

  • Remove script.html altogether, using config.yml for specifying assets. Easiest way is to fix get_assets so that it accesses cdn assets when offline = F
get_assets <- function(lib, cdn = F, package = 'rCharts'){
 config = yaml.load_file(system.file(lib, 'config.yml', package = package))[[1]]
if (cdn) return(config$cdn) else return(config[names(config) != 'cdn'])
}
nvd3:
  css:
  jshead:
  cdn:
    css: http://nvd3.org/src/nv.d3.css
    jshead: 
      - "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"
      - "http://d3js.org/d3.v2.min.js"
      - "http://nvd3.org/nv.d3.js"
      - "http://nvd3.org/lib/fisheye.js"

@ramnathv
Copy link
Owner Author

Done

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

No branches or pull requests

1 participant