简体   繁体   English

Raphael / Mapael-由单个图例控制的地块和区域

[英]Raphael/Mapael - plots and areas controlled by a single legend

I've been working on few custom SVG maps based on Raphael.js but Mapael is the library that I'm working with. 我一直在研究基于Raphael.js一些定制SVG地图,但是Mapael是我正在使用的库。 I have setup a jsfiddle of the example to be better explain my. 我设置了示例的jsfiddle以便更好地解释我的情况。

http://jsfiddle.net/arnabsaha/3jNE9/ http://jsfiddle.net/arnabsaha/3jNE9/

As you can see, I have mapped the different paths to show tooltips of different descriptions. 如您所见,我已经映射了不同的路径以显示不同描述的工具提示。 Alongwith plots for things like stairs/escalators (in a mall environment) with it's legend. 带有图例的楼梯/自动扶梯(在商场环境中)的地块。 And another legend for the different sections/paths of the map. 以及地图不同部分/路径的另一个图例。

Now what I need to do is find a way where for eg. 现在,我需要做的是找到一种方法,例如。 click on the legend item to hide/show a path/area of the map (which is achieved) along with the tooltip description that is shown when hovered on that particular path/area. 单击图例项以隐藏/显示地图的路径/区域(已实现)以及将鼠标悬停在该特定路径/区域上时显示的工具提示说明。

Now, after trying few unsuccessful things, I was thinking of a workaround where clicking on the legend item for the path/area to also hide/show a plot with a text description attribute. 现在,在尝试了一些不成功的事情之后,我想到了一种解决方法,即单击路径/区域的图例项以隐藏/显示带有文本描述属性的图。 For eg. 例如。 In the fsfiddle example, click on 'Azul by moussy', (first item in the areas legend) the area is highlighted, along with this, if I could also hide/show a plot (with text attribute) which is the description for that particular path/area? 在fsfiddle示例中,单击“ Azul by moussy”(区域图例中的第一项),该区域将突出显示,如果我还可以隐藏/显示一个图(具有text属性),则该区域也将被突出显示特定的路径/区域?

I hope I was able to explain my situation clearly. 我希望我能够清楚地说明我的情况。

Any ideas/help will be much appreciated! 任何想法/帮助将不胜感激!

Thanks, 谢谢,

Arnab ARNAB

code snippet: 代码段:

$(function(){
$(".maparea6").mapael({
    map : {
        name : "world_countries",
        zoom: {
            enabled: true,
            maxLevel : 10
        },
        defaultPlot: {
            size: 10
        },
        defaultArea: {
            attrs : {
                stroke : "#000", 
                "stroke-width" : 0.5
            }
        }
    },
    legend : {
        area : {
            display : true,
            title :"", 
            slices : [
                    {

                    max :63,
                    min :61, 
                    attrs : {
                        fill : "#f0eeb5"
                    },
                    label :"AZUL by moussy"
                }
                ,
                {

                    max :11,
                    min :9, 
                    attrs : {
                        fill : "#f0eeb5"

If anyone is interested, $(".areaLegend svg text:eq(X)"); 如果有人感兴趣,$(“。areaLegend svg text:eq(X)”); allows you to add events on the legend items but this solution isn't very handy to use ... 允许您在图例项上添加事件,但是此解决方案使用起来不是很方便...

And, the paths and plots already have this feature, they can be easily selected ie : $("[data-id='path_ad']"); 并且,路径和图已经具有此功能,可以轻松选择它们,例如:$(“ [data-id ='path_ad']”); in order to add some events or anything on them. 为了添加一些事件或事件。

And the developer's github: https://github.com/neveldo/jQuery-Mapael 和开发人员的github: https : //github.com/neveldo/jQuery-Mapael

Thanks for reporting this issue about the elements in the legend. 感谢您报告有关图例中元素的问题。 It has been solved by the version 1.0.0 of jQuery Mapael : https://github.com/neveldo/jQuery-Mapael/commit/50baf1600d393a736a434c4ee400081da69ede9b jQuery Mapael的1.0.0版本已解决此问题: https : //github.com/neveldo/jQuery-Mapael/commit/50baf1600d393a736a434c4ee400081da69ede9b

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM