svg文件使用highmap显示

svg文件使用highmap显示
highmap,ammap都是比较好的第三方插件用来显示svg图片;
    ammap导航可能更美观点(这个highmap后面可能也会赶上),
    highmap在ie8上可以正常显示,这点是这次没有使用ammap的主要原因;
步骤:
1、拥有一个svg文件;
2、使用Inkscape打开,直接另存为svg就可以了(此步骤主要是将普通的svg文件转换为highmap需要的数据格式),此工具的详细使用方法
3、在数据转换页面 将2中保存的svg文件进行转换;此时highmap所需的series数据格式已经生成;
  1. $(function () {
  2. Highcharts.setOptions({
  3. lang:{
  4. drillUpText:"< 返回"
  5. }
  6. });
  7. // Initiate the chart
  8. $('#container').highcharts('Map', {
  9. chart : {
  10. events: {
  11. drilldown: function (e) {
  12. }
  13. }
  14. },
  15. title : {
  16. text : '全省业绩概况图'
  17. },
  18. plotOptions:{
  19. series:{
  20. //allowPointSelect:true,
  21. cursor:"pointer"
  22. ,color:"#00ff00"
  23. ,states:{hover:{
  24. brightness:0.2
  25. }}
  26. ,dataLabels:{format:"{point.name}",enabled:true}
  27. ,point:{
  28. events:{
  29. click:function(e){
  30. //this.select(!this.selected);
  31. }
  32. }
  33. }
  34. }
  35. },
  36. legend:{
  37. enabled: false,
  38. },
  39. credits:{
  40. enabled: false,
  41. },
  42. mapNavigation: {
  43. enabled: true,
  44. buttonOptions: {
  45. verticalAlign: 'top'
  46. }
  47. },
  48. drilldown:{
  49. activeDataLabelStyle: {
  50. color: 'white',
  51. textDecoration: 'none'
  52. },
  53. drillUpButton: {
  54. relativeTo: 'spacingBox',
  55. position: {
  56. x: 0,
  57. y: 60
  58. }
  59. },
  60. series:DRILLDOWN
  61. },
  62. series : SERIES
  63. });
  64. });

    




原文地址:https://www.cnblogs.com/vvch/p/4867642.html