我必須做些什麼才能覆蓋javascript函數?在Kendo UI中覆蓋javascript函數
我將plotAreaClick
事件從Kendo UI圖表綁定到javascript onPlotAreaClick
函數。我的目標是在onPlotAreaClick
中使用/顯示placeholder
變量。
這些不工作(的jsfiddle線:45):
onPlotAreaClick(Placeholder)
onPlotAreaClick(this, Placeholder)
參見:http://jsfiddle.net/rule_34/gpurwayr/1/
var seriesData = [{
productname: "Product One",
volume: 65.50
}];
function onPlotAreaClick(e) {
alert(kendo.format("Plot area click :: {0} : {1:N0}", e.category, e.value));
}
$(document).ready(function() {
// -----------------------------------------------------------------------
function createChart(ChartType, Placeholder, MaxValue) {
$("#" + Placeholder).kendoChart({
theme: "metro",
title: {
font: "12px Arial,Helvetica,sans-serif",
color: "#29952D",
text: "Name: " + Placeholder
},
dataSource: {
data: seriesData
},
seriesDefaults: {
labels: {
template: "#=kendo.format('{0:n2}', (Math.abs(value)))# ltr",
position: "outsideEnd",
visible: true,
background: "transparent"
}
},
series: [{
type: ChartType,
field: "volume",
categoryField: "productname",
}],
valueAxis: [{
min: 0,
max: MaxValue
}],
chartArea: {
width: 125,
height: 175
},
plotAreaClick: onPlotAreaClick, /* HERE */
}) // kendoChart
} // function
// -------------------------------------------------------------------
createChart("column", "example_1", 200);
// -----------------------------------------------------------------------
}); // $(document).ready(function()
的鏈接的jsfiddle按預期工作,並顯示當我點擊圖的消息框。 –