Pregunta

I am trying to persuade morris through rcharts to show graph title and axis labels (name of x and y axis). Without success. Example below.

require(rCharts)
tmp <- data.frame(a=c(1, 2, 3, 4, 5),
                  b=c(0.1, 0.2, 0.3, 0.4, 0.5),
                  c=c(0.2, 0.3, 0.4, 0.5, 0.6))

morrisPlot <- mPlot(x="a", y=c("b", "c"), data=tmp, 
                    type="Line", pointSize=4, parseTime=FALSE, hideHover="auto")
morrisPlot$set(height=500) # works
morrisPlot$set(width=500) # works
#morrisPlot$xAxis(axisLabel="a") # Error
#morrisPlot$yAxis(axisLabel="b") # Error
morrisPlot$set(title="Some Title") # doesn't show

morrisPlot

How o properly set and display chart title and axis names/labels?

Due to frustration: I am disappointed on morris due to basically making my browser unresponsive trying to draw a simple multiline plot (a bit more complex with a bit more datapoints as example above). Are there any alternatives (with examples) of other libraries supporting multiline graphs? I mean where I have data in different columns (not having group)?

¿Fue útil?

Solución

This may not address your question directly, but should provide you with directions on alternates to MorrisJS.

require(rCharts)
tmp <- data.frame(
  a = c(1, 2, 3, 4, 5),
  b = c(0.1, 0.2, 0.3, 0.4, 0.5),
  c = c(0.2, 0.3, 0.4, 0.5, 0.6)
)

options(stringsAsFactors = F)
library(reshape2)
tmp_m = melt(tmp, id = "a")
library(rCharts)
# NVD3
nPlot(value ~ a, group = 'variable', data = tmp_m, type = 'lineChart')

# Polychart
rPlot(value ~ a, color = 'variable', data = tmp_m, type = 'line')

# Highcharts
hPlot(value ~ a, group = 'variable', data = tmp_m, type = 'line')
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top