【问题标题】:Show properly x labels with rCharts and dimplejs使用 rCharts 和 dimplejs 正确显示 x 标签
【发布时间】:2014-02-26 15:08:32
【问题描述】:

您好,我使用dimple javascript 库用rCharts 绘制了一个图表,但是我遇到了一些无法正确显示的x 标签的问题,我尝试使用setBoundssetMargins 没有任何成功。欢迎任何帮助!谢谢

# my data (I put all because with less data there's no problem : x labels appears horizontally)
structure(list(date = c("2014-01-01", "2014-01-02", "2014-01-03", 
"2014-01-04", "2014-01-05", "2014-01-06", "2014-01-07", "2014-01-08", 
"2014-01-09", "2014-01-10", "2014-01-11", "2014-01-12", "2014-01-13", 
"2014-01-14", "2014-01-15", "2014-01-16", "2014-01-17", "2014-01-18", 
"2014-01-19", "2014-01-20", "2014-01-21", "2014-01-22", "2014-01-23", 
"2014-01-24", "2014-01-25", "2014-01-26", "2014-01-27", "2014-01-28", 
"2014-01-29", "2014-01-30"), value = c(198L, 391L, 353L, 176L, 
143L, 544L, 497L, 553L, 572L, 492L, 165L, 179L, 452L, 687L, 578L, 
561L, 529L, 182L, 191L, 494L, 515L, 592L, 576L, 598L, 203L, 199L, 
577L, 586L, 588L, 345L), date2 = c("mer. 01", "jeu. 02", "ven. 03", 
"sam. 04", "dim. 05", "lun. 06", "mar. 07", "mer. 08", "jeu. 09", 
"ven. 10", "sam. 11", "dim. 12", "lun. 13", "mar. 14", "mer. 15", 
"jeu. 16", "ven. 17", "sam. 18", "dim. 19", "lun. 20", "mar. 21", 
"mer. 22", "jeu. 23", "ven. 24", "sam. 25", "dim. 26", "lun. 27", 
"mar. 28", "mer. 29", "jeu. 30")), .Names = c("date", "value", 
"date2"), row.names = c(NA, -30L), class = "data.frame")

# the graph
library(rCharts)
d1 <- dPlot(
  value ~ date2,
  data = x, 
  type = 'line'
)
d1$xAxis(orderRule="date")
d1

【问题讨论】:

    标签: r rcharts dimple.js


    【解决方案1】:

    解决了!

    d1 <- dPlot(
      value ~ date2,
      data = x, 
      type = 'line',
      # Add bounds here
      bounds = list(x=70,y=10,height=320,width=500)
    )
    d1$xAxis(orderRule="date")
    d1
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-04
      • 2023-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多