简体   繁体   中英

R metricsgraphics - multiline plots not animated and no legend

I am trying to plot a multiline graph. Facing two issues: 1. No Animation 2. Legend not coming up

Below is my code:

plotForecast <- data.frame(hourIndex=1:24,testHourP=1:24,d1P=25:48,enerDataP=49:72)

plotForecast %>%
mjs_plot(x=hourIndex, y=testHourP) %>%
mjs_line() %>%
mjs_add_line(d1P) %>%
mjs_add_line(enerDataP) %>%

mjs_add_legend(legend=c("X", "Y", "Z"))

The legend is ok, it is appearing under the graph.

However the animation seem to be working only when the x axis is in "date" mode.

plotForecast %>%
  mjs_plot(x=hourIndex, y=testHourP) %>%
  mjs_line() %>%
  mjs_add_line(d1P) %>%
  mjs_add_line(enerDataP) %>%
  mjs_axis_x(xax_format="date") %>%
  mjs_add_legend(legend=c("X", "Y", "Z")

I know it is strange but it works. You could file a ticket to the developers of the package.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM