【发布时间】:2014-05-02 11:14:59
【问题描述】:
我有以下代码(使用 chartkick gem):
<%= pie_chart [[t('result.positive'), @rating_positive], [t('result.negative'), @rating_negative], [t('result.neutral'), @rating_neutral]],
colors: ['#B3D986', '#E04848', '#C9C9C9'],
library: {
chart: {
backgroundColor: '#EEEEEE',
width: 300,
height: 250
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true,
events: {
click: function(event, i) {
alert("test");
}
}
}
}
}
%>
我只想将点击事件函数作为参数传递,但 rails 会解释它。 html_safeand 辅助函数没有用。有什么建议吗?
【问题讨论】:
标签: javascript ruby-on-rails chartkick