0
 $.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" 如下 POWERFACTOR

但它给出了错误,说图表未定义。你能帮忙看看如何改变标题和系列吗

4

1 回答 1

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 '
    });
});
于 2013-02-22T13:52:00.393 回答