add image in Title and subtitle - Javascript highcharts

Javascript examples for highcharts:Chart Title

Description

add image in Title and subtitle

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
      <script type="text/javascript">
$(function() {/* www  .j av  a  2 s  . c o  m*/
    var chart;
    $(document).ready(function() {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'ChartContainer',
                type: "spline",
                title: {text: ""}
            },
title: {text: ""},
            yAxis: {
                title: {
                    text: null
                },
            },
            series: [{
                data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]}],
        });
        chart.setTitle({
            useHTML: true,
            text: "Testing" + " " + "<img src='../images/appendImage.png' alt='' />"
            }, {
            text: "This is a test"
        });
        chart.options.title.text = "Testing";
        chart.options.subtitle.text = "This is a test";
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="ChartContainer" style="min-width: 400px; height: 400px; margin: 0 auto"></div>  
   </body>
</html>

Related Tutorials