r - Highcharts X 轴类别名称仅显示 1 个字符

标签 r highcharts

我使用 highcharts 创建了柱形图和折线图。

X 轴类别名称在使用相同代码创建的其他图表中显示得很好,但现在我遇到一个问题,整个类别名称被缩短,仅第一个字母仅显示在图表中。

例如,类别应为“Run”,但它仅显示为“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")

最佳答案

我发布此消息后立即找到了答案。显然这是一个常见问题。当只有一个类别时,必须以列表的形式提供类别。引用:https://github.com/jbkunst/highcharter/issues/173

关于r - Highcharts X 轴类别名称仅显示 1 个字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53315427/

相关文章:

R 按数字方式对文件列表进行排序

Highcharts折线图当有多个点具有相同的X轴时所有点都会消失

javascript - 使用 HIGHCHARTS (xAxis dateTime) 添加点

javascript - Highchart默认限制系列数量

javascript - Highcharter/Highmap : change legend label format for billions

r - 在str_remove : Combine a pattern with a regex in one line中

r rticle 包在最近更新后停止编译

r - 通过仅取组中与另一列上所选行相等的行的平均值来在组中进行变异

r - 如何获得随机效应模型矩阵?

javascript - Highcharts - 从顶部开始的位置柱形图