简体   繁体   中英

how to change the title in highcharts

 $.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"});

 });
 });

when i click on this anchor tag the title should change, i have set a id="b" as below POWERFACTOR

but it gives e error saying chart not defined. could u help lik how to change the title and also the series

Have you seen this example: http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/members/chart-settitle/ from documentation ?

$('#title').click(function () {
    chart.setTitle({
        text: 'New title '
    });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM