图表有线性和对数按钮。如何让活动的按钮被高亮显示?下面的代码只在悬停时改变颜色。
navigation: {
buttonOptions: {
theme: {
states: {
hover: {
fill: '#00f'
},
select: {
fill: '#f00'
}
}
}
}
myButton: {
symbol: 'circle',
symbolStrokeWidth: 1,
symbolFill: '#bada55',
symbolStroke: '#330033',
onclick: function() {
// Something happens here
var self = this.exportSVGElements[2]; // 0-1 is first button, 2-3 is second button etc.
self.setState(2);
console.log('clicked!');
},
theme: {
states: {
hover: {
fill: '#FF0000'
},
select: {
fill: '#0000FF'
}
}
},
通过设置选择状态,你将会在点击按钮后得到颜色的改变,你还需要为该按钮调用setState()。你还需要为该按钮调用setState()。请看一下这个例子