@@ -15,10 +15,15 @@ $(function(){
1515 , zoom : {
1616 enabled : true
1717 }
18+ , defaultPlot : {
19+ attrs : {
20+ opacity : 0.6
21+ }
22+ }
1823 } ,
1924 areas : {
2025 "department-56" : {
21- text : "56" ,
26+ text : { content : "56" } ,
2227 tooltip : { content : "Morbihan (56)" }
2328 }
2429 } ,
@@ -33,22 +38,71 @@ $(function(){
3338 latitude :45.758888888889 ,
3439 longitude : 4.8413888888889 ,
3540 value : 700000 ,
36- href : "# " ,
41+ href : "http://fr.wikipedia.org/wiki/Lyon " ,
3742 tooltip : { content : "<span style=\"font-weight:bold;\">City :</span> Lyon" } ,
38- text : "Lyon"
43+ text : { content : "Lyon" }
3944 } ,
4045 'rennes' : {
4146 type :"square" ,
4247 size :20 ,
4348 latitude : 48.114166666667 ,
4449 longitude : - 1.6808333333333 ,
4550 tooltip : { content : "<span style=\"font-weight:bold;\">City :</span> Rennes" } ,
46- text : "Rennes" ,
47- attrs : { href : "#" }
51+ text : { content : "Rennes" } ,
52+ href : "http://fr.wikipedia.org/wiki/Rennes"
4853 }
4954 }
5055 } ) ;
5156
57+ $ ( '#refreshmaparea2' ) . on ( 'click' , function ( ) {
58+
59+ // Update some plots and areas attributes ...
60+ var updatedOptions = { 'areas' : { } , 'plots' : { } } ;
61+ updatedOptions . areas [ "department-56" ] = {
62+ tooltip : {
63+ content : "Morbihan (56) (2)"
64+ } ,
65+ attrs : {
66+ fill : "#0088db"
67+ } ,
68+ text : { content : "56 (2)" }
69+ } ;
70+ updatedOptions . plots [ "rennes" ] = {
71+ tooltip : {
72+ content : "Rennes (2)"
73+ } ,
74+ attrs : {
75+ fill : "#f38a03"
76+ }
77+ , text : { position : "top" }
78+ , size : 5
79+ } ;
80+
81+ // add some new plots ...
82+ var newPlots = {
83+ "Limoge" : {
84+ latitude : 45.834444 ,
85+ longitude : 1.261667 ,
86+ text : { content : "Limoge" } ,
87+ tooltip : { content : "Limoge" }
88+ }
89+ , "Dijon" : {
90+ size :60 ,
91+ latitude : 47.323056 ,
92+ longitude : 5.041944 ,
93+ text : {
94+ content : "Dijon" ,
95+ position : "left" ,
96+ margin : 5
97+ }
98+ }
99+ }
100+
101+ // and delete some others ...
102+ var deletedPlots = [ "paris" , "lyon" ] ;
103+ $ ( ".maparea2" ) . trigger ( 'update' , [ updatedOptions , newPlots , deletedPlots , { animDuration : 1000 } ] ) ;
104+ } ) ;
105+
52106 // Example #3
53107 $ ( ".maparea3" ) . mapael ( {
54108 map : {
@@ -65,13 +119,15 @@ $(function(){
65119 attrsHover : {
66120 animDuration :0
67121 } ,
68- textAttrs : {
69- cursor : "pointer" ,
70- "font-size" : 10 ,
71- fill :"#000"
72- } ,
73- textAttrsHover : {
74- animDuration :0
122+ text : {
123+ attrs : {
124+ cursor : "pointer" ,
125+ "font-size" : 10 ,
126+ fill :"#000"
127+ } ,
128+ attrsHover : {
129+ animDuration : 0
130+ }
75131 } ,
76132 eventHandlers : {
77133 click : function ( e , id , mapElem , textElem ) {
@@ -89,18 +145,17 @@ $(function(){
89145 }
90146 } ;
91147 }
92- $ ( ".maparea3" ) . trigger ( 'update' , [ newData , false , false , 0 ] ) ;
148+ $ ( ".maparea3" ) . trigger ( 'update' , [ newData ] ) ;
93149 }
94150 }
95151 }
96152 } ,
97153 areas : {
98154 "department-29" : {
99- text : "dblclick" ,
155+ text : { content : "dblclick" , position : "top" } ,
100156 attrs : {
101157 fill :"#0088db"
102158 } ,
103- textPosition : "top" ,
104159 tooltip : { content : "Finistère (29)" } ,
105160 eventHandlers : {
106161 click : function ( ) { } ,
0 commit comments