• openlayersol3在地图上添加highcharts图表


     
    html中添加一个div容器:
     
     <div style="display: none;">
                <div id='canvasDiv' ></div>
                <div id="popup" title="Welcome to ol3"></div>
            </div>
    canvasDiv绑定到地图中:
     var pie = new ol.Overlay({
                    position: pos,
                    positioning: ol.OverlayPositioning.CENTER_CENTER,
                    element: document.getElementById('canvasDiv')
                });
                map.addOverlay(pie);
    定义饼图,填充canvasDiv:
     $(function () {
                        $('#canvasDiv').highcharts({
                            chart: {
                                backgroundColor: 'rgba(255, 255, 255, 0)',
                                plotBorderColor: null,
                                plotBackgroundColor: null,
                                plotBackgroundImage: null,
                                plotBorderWidth: null,
                                plotShadow: false,
                                 200,
                                height: 200,
                            },
                            tooltip: {
                                pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
                            },
                            plotOptions: {
                                pie: {
                                    allowPointSelect: true,
                                    cursor: 'pointer'
                                }
                            },
                            title: {
                                text: ''
                            },
                            dataLabels: {  
                                enabled: false,  
                                color: '#000000',  
                                //distance: -20,  
                                connectorColor: '#000000',  
                                formatter: function() {  
                                    return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';  
                                }  
      
                            },
                            series: [{
                                type: 'pie',
                                name: 'Browser share',
                                data: [
                                    ['Firefox', 45.0],
                                    ['IE', 26.8],
                                    {
                                        name: 'Chrome',
                                        y: 12.8,
                                        sliced: true,
                                        selected: true
                                    },
                                    ['Safari', 8.5],
                                    ['Opera', 6.2],
                                    ['Others', 0.7]
                                ]
                            }]
                        });
                    });
    效果如下:
    0
    0
    0
    分类: Openlayers
     
  • 相关阅读:
    JDK和TOMCAT的安装与配置环境变量
    jsp_类的封装_集合的应用
    eclipse的安装
    动态JSP的了解
    Xamarin GitHub 下载的源码运行不了
    VS2017 移动开发(Android and IOS) 序
    C# 移动开发 MasterDetailPage 侧滑
    C# 获取本机IP(优化项目实际使用版)
    C# 调用第三方DLL缓冲区溢出导致的异常
    后台安装 SQL Server 无人值守 安装
  • 原文地址:https://www.cnblogs.com/devgis/p/16385102.html
Copyright © 2020-2023  润新知