简体   繁体   中英

rCharts polychart change color of lines

Working with the polychart library in rCharts and creating a bar chart with a line chart overlaid. Basically the bars represent performance of different programs on a single metric, and I am laying a horizontal line where the national average is.

Here's the script I've written, including dummy data:

dummy<-setNames(
  data.frame(c("x1","x2","x3","x4"),
             c(3,4,2,6),
             rep(4,4)),
  c("program","score","national")
)

testplot<-rPlot(score~program,data=dummy,type="bar")
testplot$layer(national~program,data=dummy,type="line")

I'd like the national line to be a different color, like bright red or something (and if you can tell me how to make it thicker, much obliged). I know nothing about javascript, so digging into polycharts programming is a little scary for me. Perhaps the best answer is "go and learn javascript", but please refrain from that answer:)

OK,随机找到我的答案:

testplot$layer(national~program,data=dummy,type="line",color = list(const = 'blue'))

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