我想重新繪製我的jqplot圖表。jqplot replot不工作
$(document).ready(function(){
var dataseries = [[[10,20]]];
var plot = $.jqplot('placeholder', dataseries ,
{ title:'<%= @question.text%>',
axes:{
yaxis:{min:-100, max:100, tickInterval:10, showTicks:true, label:"<%[email protected]%>"},
xaxis:{min:-100, max:100, tickInterval:10, showTicks:true, label: "<%[email protected]%>"},
y2axis:{min:-100, max:100, tickInterval:10, showTicks:true, label:"<%[email protected]%>", show:true},
x2axis:{min:-100, max:100, tickInterval:10, showTicks:true, label:"<%[email protected]%>", show:true}},
seriesDefaults:{showLine:false},
series:<%=itemNames.html_safe%>,
highlighter:{
show:true,
tooltipContentEditor:tooltipContentEditor}
});
});
function tooltipContentEditor(str, seriesIndex, pointIndex, plot) {
return plot.series[seriesIndex]["label"];
}
$("#placeholder").bind("jqplotClick", function(ev, gridpos, datapos, neighbor) {
var x = Math.round(datapos.xaxis);
var y = Math.round(datapos.yaxis);
var item = $('li.item_button_selected').attr('id');
if (item > 0){
var requestObj = {
question_id: "<%[email protected]%>",
user_id: "1",
}
requestObj["item_id"]=item
requestObj["x"]=x
requestObj["y"]=y
plot.series[0].data = [[50,50]];
plot.replot();
BLAH BLAH BLAH...
<%= itemNames.html_safe%>通常如下所示:[{標籤: 「薇諾娜賴德」},{標號: 「巴黎希爾頓」},{標號: 「撒切爾」},{標籤:「Snooki」},{label:「Natalie Portman」},]
當頁面加載時,圖表繪製正常;當我點擊圖表時,沒有任何反應。我知道點擊正在被抓到;如果我在那裏提醒,我就會看到它。幫幫我!
確保您標記這是答案! – Charlie