javascript - highcharts on top of google map -


i displaying highchart's polar chart on top of google map to show wind direction on map. please see example http://jsfiddle.net/rishad/azarpssv/

<html>     <head>         <title>simple polar chart on map</title>         <meta name="viewport" content="initial-scale=1.0">         <meta charset="utf-8">         <style>             #wrapper { position: relative; }             #over_map { position: absolute; top: 75px; left: 75px; z-index: 99; }         </style>         <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>         <script type="text/javascript">         $(function () {             $('#container').highcharts({                 chart: {                     polar: true,                     backgroundcolor:'rgba(255, 255, 255, 0.0)'                 },                 title: {                     text: ''                 },                 pane: {                     startangle: 0,                     endangle: 360                 },                 exporting: {                    enabled: false                  },                 legend: {                     enabled: false                 },                 xaxis: {                     tickinterval: 45,                     min: 0,                     max: 360,                     labels: {                         formatter: function () {                             return this.value + '°';                         }                     }                 },                 yaxis: {                     min: 0                 },                 plotoptions: {                     series: {                         pointstart: 0,                         pointinterval: 45                     },                     column: {                         pointpadding: 0,                         grouppadding: 0                     }                 },                 series: [{                     type: 'line',                     name: 'line 1',                     data: [8, 7, 6, 5, 4, 3, 2, 1],                     pointplacement: 'between'                 }, {                     type: 'line',                     name: 'line 2',                     data: [1, 2, 3, 4, 5, 6, 7, 8]                 }, {                     type: 'line',                     name: 'line 3',                     data: [1, 8, 2, 7, 3, 6, 4, 5]                 }]             });         });          </script>     </head>     <body>          <script src="js/highcharts.js"></script>         <script src="js/highcharts-more.js"></script>          <div id="wrapper">             <div id="map" style="width: 500px; height: 500px;"></div>             <div id="over_map">                 <div id="container" style="width: 350px; height: 350px;"></div>              </div>         </div>          <script>           var map;           function initmap() {           var mycenter = new google.maps.latlng (53.244661, -2.479360)             map = new google.maps.map(document.getelementbyid('map'), {               center: mycenter,               zoom: 16,               draggable:false,               scrollwheel:false             });             var marker = new google.maps.marker({                 position: mycenter,                 map: map,             });           }         </script>         <script src="https://maps.googleapis.com/maps/api/js?key=aizasycpmedrvxaqxiiguawfftbuhbuq76q2hlo&signed_in=true&callback=com/maps/api/js?sensor=false&callback=initmap"></script>    </body> </html> 

but unable make 1 element. instance, want put @ centre of html table row not work.

<table style="width: 100%;">     <tr align="center">         <td>             <div id="wrapper">                 <div id="map" style="width: 500px; height: 500px;"></div>                 <div id="over_map">                     <div id="container" style="width: 350px; height: 350px;"></div>                 </div>             </div>         </td>     </tr> </table> 

if change padding, not work different screen size. can me css. in advance.

the problem caused incorrect left parameter in css styles. should avoid use harcoded value (because in table have dynamic 100%). solution using calc(50% - 175px) 175px half of chart width.

css:

#wrapper { position: relative; } #over_map { position: absolute; top: 75px; left:calc(50% - 175px); z-index: 99; } 

example: - http://jsfiddle.net/sjmxke8g/


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -