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

Character vector on x-axis and numeric vector on y axis #17

Closed ncdingari closed 9 years ago

ncdingari commented 9 years ago

I am unable to plot character vector and corresponding numeric vector.

hrbrmstr commented 9 years ago

Can you provide a small example?

ncdingari commented 9 years ago

iris %>%group_by(Species) %>% summarise(Sepal=sum(Sepal.Length))%>% mjs_plot(x=Species, y=Sepal) %>% mjs_bar()

hrbrmstr commented 9 years ago

The MetricsGraphics.js bar charts API is unstable (it has changed numerous times since starting this package) and I won't be putting effort into it until it stabilizes. That means you can only do horizontal bar charts:

iris %>%
  mjs_plot(x=Sepal.Length, y=Species) %>% mjs_bar()

and, even then, it's geared towards display metrics (hence the name of the JavaScript library having "metrics" in it). The need for the bullet-chart-type lines is a new 2.1.0 feature and immutable (not my fault).

MetricsGraphics.js line charts do not support generalized text labels. From the MetricsGraphics.js main site:

MetricsGraphics.js is a library built on top of D3 that is optimized for visualizing and laying out time-series data.

So, it's not a general purpose charting library. That's more what ggvis is supposed to be.

ncdingari commented 9 years ago

Thank you and thanks for your great work