Maps.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. import React, { Component } from 'react';
  2. import ContentWrapper from '@/components/Layout/ContentWrapper';
  3. import { jumlahLaporan } from "@/actions/pelaporan";
  4. import VectorMap from '@/components/Maps/VectorMap';
  5. import { Container, Row, Col, Card, CardHeader, CardBody } from "reactstrap";
  6. const defaultColors = {
  7. markerColor: '#f20226',
  8. bgColor: 'transparent',
  9. scaleColors: ["#146804", "#ff0000"],
  10. regionFill: '#bbbec6'
  11. };
  12. const RegionValues = {
  13. 'ID_su': 0,
  14. 'ID_su': 0,
  15. 'ID_ss': 0,
  16. 'ID_la': 0,
  17. 'ID_be': 0,
  18. 'ID_bb': 0,
  19. 'ID_jk': 33,
  20. 'ID_jb': 0,
  21. 'ID_bt': 0,
  22. 'ID_yo': 0,
  23. 'ID_jt': 0,
  24. 'ID_jl': 0,
  25. 'ID_ba': 0,
  26. 'ID_nb': 0,
  27. 'ID_sg': 0,
  28. 'ID_sn': 0,
  29. 'ID_sr': 0,
  30. 'ID_sb': 0,
  31. 'ID_ri': 0,
  32. 'ID_kr': 0,
  33. 'ID_ja': 0,
  34. 'ID_ks': 0,
  35. 'ID_kb': 0,
  36. 'ID_ki': 0,
  37. 'ID_kt': 0,
  38. 'ID_ku': 0,
  39. 'ID_ma': 0,
  40. 'ID_mu': 0,
  41. 'ID_ac': 0,
  42. 'ID_pa': 0,
  43. 'ID_pb': 0,
  44. 'ID_nt': 0,
  45. 'ID_go': 0,
  46. 'ID_st': 0,
  47. 'ID_sa': 0,
  48. }
  49. // const RegionValues = {
  50. // 'ID_su': 1,
  51. // 'ID_su': 2,
  52. // 'ID_ss': 3,
  53. // 'ID_la': 4,
  54. // 'ID_be': 5,
  55. // 'ID_bb': 6,
  56. // 'ID_jk': 2,
  57. // 'ID_jb': 9,
  58. // 'ID_bt': 9,
  59. // 'ID_yo': 8,
  60. // 'ID_jt': 5,
  61. // 'ID_jl': 1,
  62. // 'ID_ba': 2,
  63. // 'ID_nb': 1,
  64. // 'ID_sg': 1,
  65. // 'ID_sn': 1,
  66. // 'ID_sr': 1,
  67. // 'ID_sb': 10,
  68. // 'ID_ri': 10,
  69. // 'ID_kr': 10,
  70. // 'ID_ja': 10,
  71. // 'ID_ks': 11,
  72. // 'ID_kb': 11,
  73. // 'ID_ki': 11,
  74. // 'ID_kt': 11,
  75. // 'ID_ku': 11,
  76. // 'ID_ma': 12,
  77. // 'ID_mu': 12,
  78. // 'ID_ac': 13,
  79. // 'ID_pa': 14,
  80. // 'ID_pb': 14,
  81. // 'ID_nt': 15,
  82. // 'ID_go': 16,
  83. // 'ID_st': 16,
  84. // 'ID_sa': 16,
  85. // }
  86. const LLDIKTI = {
  87. 'ID_su': '<h5>LLDIKTI Wilayah I</h5>',
  88. 'ID_ss': '<h5>LLDIKTI Wilayah II</h5>',
  89. 'ID_la': '<h5>LLDIKTI Wilayah II</h5>',
  90. 'ID_be': '<h5>LLDIKTI Wilayah II</h5>',
  91. 'ID_bb': '<h5>LLDIKTI Wilayah II</h5>',
  92. 'ID_jk': '<h5>LLDIKTI Wilayah III</h5>',
  93. 'ID_jb': '<h5>LLDIKTI Wilayah IV</h5>',
  94. 'ID_bt': '<h5>LLDIKTI Wilayah IV</h5>',
  95. 'ID_yo': '<h5>LLDIKTI Wilayah V</h5>',
  96. 'ID_jt': '<h5>LLDIKTI Wilayah VI</h5>',
  97. 'ID_jl': '<h5>LLDIKTI Wilayah VII</h5>',
  98. 'ID_ba': '<h5>LLDIKTI Wilayah VIII</h5>',
  99. 'ID_nb': '<h5>LLDIKTI Wilayah VIII</h5>',
  100. 'ID_sg': '<h5>LLDIKTI Wilayah IX</h5>',
  101. 'ID_sn': '<h5>LLDIKTI Wilayah IX</h5>',
  102. 'ID_sr': '<h5>LLDIKTI Wilayah IX</h5>',
  103. 'ID_sb': '<h5>LLDIKTI Wilayah X</h5>',
  104. 'ID_ri': '<h5>LLDIKTI Wilayah X</h5>',
  105. 'ID_kr': '<h5>LLDIKTI Wilayah X</h5>',
  106. 'ID_ja': '<h5>LLDIKTI Wilayah X</h5>',
  107. 'ID_ks': '<h5>LLDIKTI Wilayah XI</h5>',
  108. 'ID_kb': '<h5>LLDIKTI Wilayah XI</h5>',
  109. 'ID_ki': '<h5>LLDIKTI Wilayah XI</h5>',
  110. 'ID_kt': '<h5>LLDIKTI Wilayah XI</h5>',
  111. 'ID_ku': '<h5>LLDIKTI Wilayah XI</h5>',
  112. 'ID_ma': '<h5>LLDIKTI Wilayah XII</h5>',
  113. 'ID_mu': '<h5>LLDIKTI Wilayah XII</h5>',
  114. 'ID_ac': '<h5>LLDIKTI Wilayah XIII</h5>',
  115. 'ID_pa': '<h5>LLDIKTI Wilayah XIV</h5>',
  116. 'ID_pb': '<h5>LLDIKTI Wilayah XIV</h5>',
  117. 'ID_nt': '<h5>LLDIKTI Wilayah XV</h5>',
  118. 'ID_go': '<h5>LLDIKTI Wilayah XVI</h5>',
  119. 'ID_st': '<h5>LLDIKTI Wilayah XVI</h5>',
  120. 'ID_sa': '<h5>LLDIKTI Wilayah XVI</h5>',
  121. }
  122. class Maps extends Component {
  123. state = {
  124. series: {
  125. regions: [{
  126. values: RegionValues,
  127. scale: defaultColors.scaleColors,
  128. normalizeFunction: 'polynomial'
  129. }]
  130. },
  131. markers: [
  132. // { latLng: [0.293347, 101.706825], name: 'aceh' },
  133. // { latLng: [4.695135, 96.749397], name: 'ID_ac' },
  134. // { latLng: [-0.52, 166.93], name: 'Nauru' },
  135. // { latLng: [-8.51, 179.21], name: 'Tuvalu' },
  136. // { latLng: [7.11, 171.06], name: 'Marshall Islands' },
  137. // { latLng: [17.3, -62.73], name: 'Saint Kitts and Nevis' },
  138. // { latLng: [3.2, 73.22], name: 'Maldives' },
  139. // { latLng: [35.88, 14.5], name: 'Malta' },
  140. // { latLng: [41.0, -71.06], name: 'New England' },
  141. // { latLng: [12.05, -61.75], name: 'Grenada' },
  142. // { latLng: [13.16, -59.55], name: 'Barbados' },
  143. // { latLng: [17.11, -61.85], name: 'Antigua and Barbuda' },
  144. // { latLng: [-4.61, 55.45], name: 'Seychelles' },
  145. // { latLng: [7.35, 134.46], name: 'Palau' },
  146. // { latLng: [42.5, 1.51], name: 'Andorra' }
  147. ],
  148. options: {
  149. map: 'id_ID',
  150. backgroundColor: defaultColors.bgColor,
  151. zoomMin: 1,
  152. zoomMax: 8,
  153. zoomOnScroll: true,
  154. regionStyle: {
  155. initial: {
  156. 'fill': defaultColors.regionFill,
  157. 'fill-opacity': 1,
  158. 'stroke': 'none',
  159. 'stroke-width': 1.5,
  160. 'stroke-opacity': 1
  161. },
  162. hover: {
  163. 'fill-opacity': 0.5,
  164. cursor: 'pointer'
  165. },
  166. selected: {
  167. fill: 'yellow'
  168. },
  169. selectedHover: {}
  170. },
  171. focusOn: {
  172. x: 0.4,
  173. y: 0.6,
  174. scale: 1
  175. },
  176. markerStyle: {
  177. initial: {
  178. fill: defaultColors.markerColor,
  179. stroke: defaultColors.markerColor
  180. }
  181. },
  182. onRegionLabelShow: (e, el, code) => {
  183. el.html(LLDIKTI[code] + el.html() + ' : ' + RegionValues[code] + ' pelaporan');
  184. }
  185. }
  186. }
  187. render() {
  188. return (
  189. <Card className="card-default">
  190. <CardBody>
  191. <VectorMap height="395px" options={this.state.options} series={this.state.series} markers={this.state.markers} />
  192. </CardBody>
  193. <div align="center">
  194. <span>Peta Geografis Wilayah LLDikti</span>
  195. </div>
  196. </Card>
  197. );
  198. }
  199. }
  200. export default Maps;