我想及时查看具有不同类别的堆叠图 我对该库有一些问题,因为对于非常相似的数据,输出是不同的... 任何帮助,将不胜感激 谢谢
数据和图形:
x = structure(list(stat_motif = c("controle_cadastre", "controle_cadastre",
"controle_cadastre", "controle_cadastre", "doc_apres_travaux",
"doc_apres_travaux"), nb_motif_mois = c(2L, 1L, 1L, 1L, 1L, 1L
), mois_modif_stat = structure(c(18078, 18383, 18293, 18201,
18383, 18048), class = "Date"),
col_motif = c("#FAA43A", "#FAA43A", "#FAA43A", "#FAA43A", "#264D00", "#264D00")),
row.names = c(NA, -6L), class = "data.frame", .Names = c("stat_motif", "nb_motif_mois", "mois_modif_stat", "col_motif"))
dput(as.data.frame(y))
y = structure(list(stat_motif = c("autre", "controle_cadastre", "controle_cadastre",
"controle_cadastre", "controle_cadastre", "controle_cadastre",
"doc_apres_travaux", "doc_apres_travaux", "doc_apres_travaux"),
nb_motif_mois = c(1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L),
mois_modif_stat = structure(c(18293, 18293, 18201, 18078, 18322, 18383, 18048, 18353, 18383), class = "Date"),
col_motif = c("#7CFC00", "#FAA43A", "#FAA43A", "#FAA43A", "#FAA43A", "#FAA43A", "#264D00", "#264D00", "#264D00")),
row.names = c(NA, -9L), class = "data.frame", .Names = c("stat_motif", "nb_motif_mois", "mois_modif_stat", "col_motif"))
y数据似乎可以正常工作,但x数据却不能正常工作
hchart(
# as.data.frame(y)
as.data.frame(x),
"column",
hcaes(x = mois_modif_stat, y = nb_motif_mois, group = stat_motif, label = stat_motif)
) %>%
hc_plotOptions(column = list(stacking = "normal"), type = "datetime") %>%
hc_xAxis(
title = list(text = 'Date'),
type = 'datetime',
dateTimeLabelFormats = list(month = "%b-%y")
) %>%
hc_yAxis(
title = list(text = "N"),
allowDecimals=FALSE
) %>%
hc_add_theme(hc_theme_gridlight())