hrbrmstr / metricsgraphics

:chart_with_upwards_trend: htmlwidget interface to the MetricsGraphics.js D3 chart library
http://hrbrmstr.github.io/metricsgraphics/
Other
132 stars 35 forks source link

unable to set x axis limits for histogram #29

Open stevetbright opened 9 years ago

stevetbright commented 9 years ago

I have a dataset that has a range of 30 to 99 and I would like to force the x axis to run from 0 to 100

However, the code below produces a chart that starts at ~30 in shiny / shinydashboard

Is there something I'm missing?

Thanks

output$histo_demo<-renderMetricsgraphics({

  dfz<-data.frame(x=c(30,30,90,96,99,45))

  mjs_plot(dfz, x) %>%
    mjs_histogram(bins=20) %>%
    mjs_labs(y_label="Count ") %>%  
    mjs_axis_x(min_x=0, max_x=100)
})

session info:

R version 3.1.2 (2014-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C         LC_TIME=C            LC_COLLATE=C         LC_MONETARY=C        LC_MESSAGES=C        LC_PAPER=C           LC_NAME=C           
 [9] LC_ADDRESS=C         LC_TELEPHONE=C       LC_MEASUREMENT=C     LC_IDENTIFICATION=C 

attached base packages:
[1] tcltk     stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] uuid_0.1-1            DT_0.0.39             xts_0.9-7             zoo_1.7-12            dygraphs_0.4.3        magrittr_1.5          scales_0.2.4          reshape2_1.4         
 [9] ggplot2_1.0.0         plyr_1.8.1            rjson_0.2.15          metricsgraphics_0.8.5 htmlwidgets_0.3.3     rCharts_0.4.5         RJDBC_0.2-4           rJava_0.9-6          
[17] lubridate_1.3.3       sqldf_0.4-10          RSQLite_1.0.0         DBI_0.3.1             gsubfn_0.6-6          proto_0.3-10          shinyBS_0.61          shinydashboard_0.2.3 
[25] shiny_0.11.1.9004    

loaded via a namespace (and not attached):
 [1] MASS_7.3-35      R6_2.0.1         RJSONIO_1.3-0    Rcpp_0.11.3      chron_2.3-45     colorspace_1.2-4 digest_0.6.4     grid_3.1.2       gtable_0.1.2     htmltools_0.2.6 
[11] httpuv_1.3.2     lattice_0.20-29  memoise_0.2.1    mime_0.3         munsell_0.4.2    stringr_0.6.2    tools_3.1.2      whisker_0.3-2    xtable_1.7-4     yaml_2.1.13     
hrbrmstr commented 9 years ago

Greetings. Thx for both trying the package and taking the time to post an issue. It looks like this is related to this issue in the Mozilla MetricsGraphics javascript/D3 implementation. I'm keeping this open and tracking that issue to ensure I catch when it will support this functionality.