【发布时间】:2012-08-29 13:05:01
【问题描述】:
我正在为 GWT 使用 HighCharts 库,但遇到了问题。
我正在尝试这样的事情:stock chart example。我对这个问题唯一感兴趣的是rangeSelector 中的buttons 属性,我想在其中自定义按钮文本)。在javascript上代码是这样的:
rangeSelector: {
buttons: [{
type: 'day',
count: 3,
text: '3dias'
}, {
type: 'week',
count: 1,
text: '1w'
}, {
type: 'month',
count: 1,
text: '1m'
}, {
type: 'month',
count: 6,
text: '6MS'
}, {
type: 'year',
count: 1,
text: '1ano'
}, {
type: 'all',
text: 'All'
}],
selected: 3
}
现在我尝试在 GWT 中做同样的事情,使用图表上的 setOption() 方法。但似乎没有任何效果。
我认为我遇到了麻烦,因为 buttons 属性需要一组属性,而这就是我不知道如何解决的问题。
我尝试过的东西:
chart.setOption("/rangeSelector/buttons",
new String[]{"{type: 'day', count: 1, text: '1dia'}", "{type: 'day', count: 1, text: '1dia'}"});`
这是我能想到的最好的方法,它创建了两个空按钮并且没有任何操作。
任何帮助将不胜感激。非常感谢。
更新:(2012 年 12 月 13 日)
给出接受的答案后,我需要设置按钮witdh。
为此,只需使用:
buttonTheme: {
width: 80
}
类似:
rangeSelector: {
selected: 2,
inputBoxStyle: {
top: '40px',
right: '10px'},
buttons: [{
type: 'week',
count: 1,
text: '1 semana'
}],
buttonTheme: {
width: 80
}
}
【问题讨论】:
标签: javascript gwt highcharts highstock