$.ajax({
type : type,
data: form_data,
url : geturl(a),
dataType : 'json',
error : function(result) {
alert("error");
// alert("Error occured!!");
},
success : function(result,data)
{
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'line',
marginRight: 300,
marginBottom: 75,
marginLeft:50,
marginTop:80
},
title: {
marginTop:100,
text:' True Power '
},
xAxis: {
categories: result[0]
},
yAxis: {
title: {
text: 'Units Of Time'
}
},
});
}
})
}
$(function(){
$('#b').click( function(event) {
event.preventDefault();
alert("tgg");
chart.setTitle = ({text:"Power Factor"});
});
});
当我点击这个锚标签时标题应该改变,我已经设置了如下id =“b” 功率因数
但它给出了错误,表示图表未定义。你可以帮助改变标题和系列
答案 0 :(得分:2)
您是否在文档中看到了这个示例:http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/members/chart-settitle/?
$('#title').click(function () {
chart.setTitle({
text: 'New title '
});
});