Maps.js 5.3 KB

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