我用高图创建了一个柱形图和折线图。
在使用相同代码创建的其他图表中,X轴类别名称显示得很好,但是现在我遇到了一个问题,整个类别名称被缩短了,只在图表中只显示了第一个字母。
例如,类别应显示为“运行”,但仅显示为“ R”。
我还注意到,这种情况发生在仅显示1个类别的图表中(例如,仅显示一个列的孤立柱形图)。
在此感谢您的帮助:)
highchart() %>%
hc_title(text = "Creative Performance") %>%
hc_yAxis_multiples(
list(title = list(text = "Spend"),labels=list(format ='${value:,.2f}'), min=0, max=max(data_creative_trueview$Spend), showFirstLabel= TRUE,showLastLabel=TRUE,opposite = FALSE),
list(title = list(text = "TrueView: CPCV"),min=0,max = max(data_creative_trueview$`TrueView: CPCV`)+0.5, labels = list(format = "${value:,.2f}"),showLastLabel = FALSE, opposite = TRUE)) %>%
hc_add_series(data = data_creative_trueview, type= "column", hcaes(y=Spend), name="Spend") %>%
hc_add_series(data = data_creative_trueview, type = "line", hcaes(y=`TrueView: CPCV`), name="TrueView: CPCV", yAxis=1) %>%
hc_xAxis(title="Creative", categories=data_creative_trueview$Creative) %>%
hc_tooltip(pointFormat = '${point.y:,.2f}') %>%
emphasized text hc_legend(align = "right", verticalAlign = "top")
答案 0 :(得分:1)
发布此消息后,我立即找到了答案。显然,这是一个常见问题。如果只有一个类别,则必须将类别作为列表提供。请参阅:https://github.com/jbkunst/highcharter/issues/173
答案 1 :(得分:0)
在我的情况下,xlabel={{"64"}}
仅显示6个,而xlabel={{"64",}}
给了我64个,这正是我想要的。