neveldo / jQuery-Mapael

jQuery plugin based on raphael.js that allows you to display dynamic vector maps
https://www.vincentbroute.fr/mapael/
MIT License
1.01k stars 195 forks source link

Legend slice and plot cannot match in Mapael version 2 #349

Open Vincent-Lyu opened 7 years ago

Vincent-Lyu commented 7 years ago

Hi,

When I am using the new version of Mapael, it turned out that the legend cannot match the corresponding plots which works in version 1 of Mapael.

In version 1, if the 'sliceValue' attribute of a legend is the same as the 'value' attribute of plots, those plots will appear when I click the legend. When I replaced version 1 Mapael JS file by the newest version, without changing any code, it doesn't work in a sudden.

For example, a sample legend like this: { "legendSpecificAttrs": { "fill": "#0079c2", "opacity": 1, "stroke-width": 6, "r": 1, "stroke": "#0079c2", "stroke-opacity": 0.4 }, "clicked": true, "label": "this is a label", "sliceValue": "i_love_mapael" }

And a sample plot like this: "helloWorld": { "type": "circle", "size": 3, "text": {....}, "tooltip": {...}, "x": 123, // x coordinate of the plot "y": 123, // y coordinate of the plot "value": "i_love_mapael" }

The above legend and the plot should match, don't they?

I cannot see anything related with regard to this back-incompatibility in the documentation.

Did I explain my issue well?

neveldo commented 7 years ago

Hello @Vincent-Lyu ,

Thanks for reporting this issue. However, could you provide a JSFiddle example that highlight the issue ? It will be very useful for us in order to find the source of the bug.

I have made a little map from scratch, and the sliceValue seems to work fine.

However, I noticed a bug when using the options sliceValue and clicked": true together (cc @Indigo744) . The legend element seems to appear in state "clicked", but not the related areas / plots on the map.
Is this the behaviour you got ? Anyway, we will check it ASAP !

neveldo commented 7 years ago

Hello @Vincent-Lyu ,

It has been fixed by the modification brought by @Indigo744 : https://github.com/neveldo/jQuery-Mapael/commit/a74e84de266a5c83c9c8aa95419be453fa5c7ad6 . Does it solve your issue ?

(Sorry @Indigo744 , it seems that I have been credited by error in the fix commit, I think that it's due to the "squash and merge" process ...).

Indigo744 commented 7 years ago

@neveldo I don't mind. It was a four hands work! 😄