highcharts style modification in R -


i hope change attributes in highcharts, part of rcharts r package. also, hope using r, not web related or other language.

in highcharts example, can see default attributes under style tag follow:

 <style>      .rchart {           display: block;           margin-left: auto;            margin-right: auto;           width: 800px;           height: 400px;         }      </style> 

i hope modify to:

<style>     .rchart {       display: block;       margin-left: auto;        margin-right: auto;       width: 100%;       height: 100%;       position: absolute     }   </style> 

i tried find how in reference (https://media.readthedocs.org/pdf/rcharts/latest/rcharts.pdf), not find it. i'd appreciate if let me know this.

i think best way generate highcharts-specific code , insert in html file containing custom css. otherwise, if want adjust style direclty r, can access width , height attributes of chart through chart$params$width , chart$params$height respectively. however, seems need provide value in pixels, hence recommendation adjust property outside of rcharts.

here small example, based on code provided in quick start page of package's website, adjust width , height r:

library(rcharts) h1 <- hplot(x = "wr.hnd", y = "nw.hnd", data = mass::survey, type = c("line",  "bubble", "scatter"), group = "clap", size = "age") h1$params$width <- 1000 h1$params$height <- 1000 print(h1) # display chart 

if want highcharts-specififc code (div + chart js), use in external web page:

 chartcode <- capture.output(chart$print("chart_id"))  chartcode <- paste(chartcode, collapse='') # if want single string containing code, can exported please. 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -