gpt4 book ai didi

javascript - Google 柱形图中的标签对齐方式

转载 作者:行者123 更新时间:2023-11-29 21:53:53 25 4
gpt4 key购买 nike

我在尝试更改此 Google 柱形图中标签的位置时遇到问题。该图表是通过 Keen.io JS SDK 呈现的。我的工作空间非常狭窄,我试图将标签放在图表下方而不是右侧(标签文本被 chop 的地方)。这是截图 -

graph

我在下面包含了我的配置对象。有没有我遗漏的选项 - 似乎没有任何东西可以从右侧移动标签。谢谢。

{
chartType: 'columnchart',
chartOptions: {
isStacked: true
},
fontName : 'Helvetica',
fontSize : '11px',
width : 270,
height : 220,
chartArea : {
left : 0,
top : 0,
width : '100%',
height : '100%'
},
colors : ['#abdd99', '#8dc7d9', '#eeeeee'],
colorMapping : {
'pro' : '#abdd99',
'basic' : '#8dc7d9'
},
labelMapping: {
"basic": "BASIC",
"pro": "PRO"
},
title : 'PROFILE VIEWS',
vAxis : {
viewWindowMode : 'maximized',
gridlines : { color : '#eeeeee' },
baselineColor : '#eeeeee',
textPosition : 'none'
},
hAxis : {
viewWindowMode : 'maximized',
gridlines : {
color : '#eeeeee'
},
baselineColor : '#eeeeee',
textPosition : 'none'
},
legend : {
position : 'bottom',
textStyle : {
color : '#cccccc',
fontName : 'Helvetica',
fontSize : '11px'
}
}
}

最佳答案

所有这些特定于 Google 的配置都应该放在 chartOptions 对象中。试一试,让我知道进展如何:

{
chartType: 'columnchart',
chartOptions: {
fontName : 'Helvetica',
fontSize : '11px',
isStacked: true,
chartArea : {
left : 0,
top : 0,
width : '100%',
height : '100%'
},
vAxis : {
viewWindowMode : 'maximized',
gridlines : { color : '#eeeeee' },
baselineColor : '#eeeeee',
textPosition : 'none'
},
hAxis : {
viewWindowMode : 'maximized',
gridlines : {
color : '#eeeeee'
},
baselineColor : '#eeeeee',
textPosition : 'none'
},
legend : {
position : 'bottom',
textStyle : {
color : '#cccccc',
fontName : 'Helvetica',
fontSize : '11px'
}
}
},
width : 270,
height : 220,
colors : ['#abdd99', '#8dc7d9', '#eeeeee'],
colorMapping : {
'pro' : '#abdd99',
'basic' : '#8dc7d9'
},
labelMapping: {
"basic": "BASIC",
"pro": "PRO"
},
title : 'PROFILE VIEWS'
}

更新:您可能还喜欢使用 C3.js更多.. 我们在 v3.1 中添加了一个 C3 适配器。这是一个演示如何使用它的 jsFiddle:http://jsfiddle.net/keen/0mL925vr/

关于javascript - Google 柱形图中的标签对齐方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27523889/

25 4 0