Postingan lainnya
Kelas Premium!
Belajar Javascript untuk website
Gunakan kupon "mulaijs" untuk diskon 75 ribu!
Masukkan Data ke Array
<script type="text/javascript">
var provinsi = <?php echo json_encode($provinsi) ?>;
AmCharts.makeChart( "mapdiv", {
/**
* this tells amCharts it's a map
*/
"type": "map",
/**
* create data provider object
* map property is usually the same as the name of the map file.
* getAreasFromMap indicates that amMap should read all the areas available
* in the map data and treat them as they are included in your data provider.
* in case you don't set it to true, all the areas except listed in data
* provider will be treated as unlisted.
*/
"dragMap":false,
"mouseWheelZoomEnabled" : false,
"zoomOnDoubleClick" : false,
"dataProvider": {
"map": "indonesiaHigh",
"getAreasFromMap": true,
"areas":[
{ "id": "ID-AC", "color": "#2980b9", "url":"{{base_url('buku/pilih_zona')}}" },
{ "id": "ID-AC", "color": "#0000CC" }
]
},
"zoomControl": {
"zoomControlEnabled": false,
"homeButtonEnabled":false,
},
/**
* create areas settings
* autoZoom set to true means that the map will zoom-in when clicked on the area
* selectedColor indicates color of the clicked area.
*/
"areasSettings": {
"autoZoom": false,
"selectedColor": "#CC0000"
},
/**
* let's say we want a small map to be displayed, so let's create it
*/
"smallMap": {
"enabled":false
}
} );
</script>
saya ingin "areas" itu mulai dari id sampai dengan color dan url terisi dari database, saya sudah parse json object dari php, lalu bagaimana cara memasukkan nya ke "areas"
0
2 Jawaban:
Jawaban Terpilih
bisa ditampilkan hasil dari parse jsonnya? alias hasil dari "provinsi" bisa di console.log biar kelihata strukturnya
0