3

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)?

Samo
  • 2,065
  • 20
  • 41
  • 1
    Last I checked the MorrisJS library was starting to support `y-axis` labels at least, and perhaps `x-axis` labels, for some context here https://github.com/ramnathv/rCharts/issues/296 – sckott Mar 04 '14 at 21:16
  • As @ScottChamberlain has pointed out, I dont think that pull request made it to the stable version of Morris, at which point I will update the binding. Note that you can always melt your data, to use with other libraries. – Ramnath Mar 04 '14 at 21:35

1 Answers1

2

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')
Ramnath
  • 54,439
  • 16
  • 125
  • 152
  • Are the Morris charts just a mess to customize? Which of the other charts is easiest to customize? `nPlot`, `rPlot`, or `hPlot`? Thanks. – PatrickT May 05 '14 at 04:16