maps.blade.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <script>
  2. var mapChart;
  3. var data = [
  4. @foreach(\App\Model\Region\Provinsi::all() as $provinsi => $value)
  5. ['{{$value->id_map}}',{{$value->region_color}}],
  6. @endforeach
  7. ];
  8. Highcharts.wrap(Highcharts.Point.prototype, 'select', function (proceed) {
  9. proceed.apply(this, Array.prototype.slice.call(arguments, 1));
  10. var points = mapChart.getSelectedPoints();
  11. if (points.length) {
  12. if (points.length === 1) {
  13. $('#info #flag').attr('class', 'flag ' + points[0].flag);
  14. // $('#info h2').html(points[0].name);
  15. $('#info #map').attr('value', points[0].options['hc-key']);
  16. } else {
  17. $('#info #flag').attr('class', 'flag');
  18. // $('#info h2').html('Comparing countries');
  19. $('#info #map').attr('value', '');
  20. }
  21. } else {
  22. $('#info #flag').attr('class', '');
  23. }
  24. });
  25. // Create the chart
  26. mapChart = Highcharts.mapChart('maps', {
  27. chart: {
  28. map: 'countries/id/id-all'
  29. },
  30. title: {
  31. enabled: false,
  32. text: ''
  33. },
  34. mapNavigation: {
  35. enabled: true,
  36. buttonOptions: {
  37. verticalAlign: 'top'
  38. }
  39. },
  40. colorAxis: {
  41. dataClasses: [{
  42. to: 4,
  43. color: "#FF0087"
  44. }, {
  45. from: 5,
  46. to: 10,
  47. color: "#E9FB06"
  48. }, {
  49. from: 11,
  50. to: 16,
  51. color: "#FB0606"
  52. }, {
  53. from: 17,
  54. color: "#06FBE7"
  55. }, {
  56. from: 18,
  57. to: 21,
  58. color: "#10A421"
  59. },{
  60. from: 23,
  61. to: 28,
  62. color: "#FF7B00"
  63. },
  64. {
  65. from: 29,
  66. to: 30,
  67. color: "#6309B1"
  68. },
  69. {
  70. from: 31,
  71. to: 32,
  72. color: "#69390D"
  73. },
  74. {
  75. from: 33,
  76. to: 34,
  77. color: "#001DFB"
  78. },
  79. {
  80. from: 1000,
  81. color: "black"
  82. }]
  83. },
  84. series: [{
  85. data: data,
  86. name: 'UPT',
  87. allowPointSelect: true,
  88. cursor: 'pointer',
  89. states: {
  90. hover: {
  91. color: '#BADA55'
  92. }
  93. }
  94. }]
  95. });
  96. </script>