Javascript examples for highcharts:Chart Size
Style chart size and offset
<html> <head> <title>Highcharts Demo</title> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <script src="https://code.highcharts.com/modules/export-data.js"></script> <div id="container" style="position: absolute; min-width: 310px; max-width: 75%; height: 400px; float: left"></div> <div id="adjacentToBar" style="position: absolute; background: red; width: 100px; height: 20px;"> Hello /*from w w w .j a v a 2s . c o m*/ </div> <script type="text/javascript"> var chart = Highcharts.chart('container', { chart: { type: 'bar', spacingTop: 0 }, title: { text: 'Historic World Population by Region' }, subtitle: { text: 'Source: <a href="https://en.wikipedia.org/wiki/World_population">Wikipedia.org</a>' }, xAxis: { categories: ['Africa', 'America', 'Asia', 'Europe', 'Oceania'], title: { text: null } }, yAxis: { min: 0, title: { text: 'Population (millions)', align: 'high' }, labels: { overflow: 'justify' } }, tooltip: { valueSuffix: ' millions' }, plotOptions: { bar: { dataLabels: { enabled: true } } }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'top', x: -40, y: 80, floating: true, borderWidth: 1, backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'), shadow: true }, credits: { enabled: false }, series: [{ name: 'Year 1800', data: [107, 31, 635, 203, 2] }] }); var div = document.getElementById('adjacentToBar'), point = chart.series[0].points[1]; div.style.top = chart.plotSizeX - point.plotX + chart.plotTop + 'px'; div.style.left = chart.chartWidth + chart.plotLeft + 'px'; </script> </body> </html>