How to use a descreteMapper like on cytoscapeweb?

你说的曾经没有我的故事 提交于 2019-12-08 13:29:22

问题


My nodes contain an attribute "classid". For every classid I would like to use a specific background-image. How can I map data to a node-attribute, like it was possible on cytoscapeweb by using the descretemapper (http://cytoscapeweb.cytoscape.org/documentation/mappers#section/DiscreteMapper)?

Here my code from cytoscapeweb:

var iconMapper = {
        defaultValue: "icons/BMC_BASEELEMENT.png",
        discreteMapper: {
            attrName: "classid",
            entries: [
                { attrValue: "BMC_CHASSIS", value: "icons/BMC_CHASSIS.png" },
                { attrValue: "BMC_CLUSTER", value: "icons/BMC_CLUSTER.png" },
                { attrValue: "BMC_ACTIVITY", value: "icons/BMC_ACTIVITY.png" },
                (...)
                { attrValue: "BMC_COMPUTERSYSTEM", value: "icons/BMC_COMPUTERSYSTEM.png" }

            ]
        }
    };

回答1:


Use the data mapper:

e.g. "data(classid)"

http://cytoscape.github.io/cytoscape.js/#style/mappers



来源:https://stackoverflow.com/questions/16933384/how-to-use-a-descretemapper-like-on-cytoscapeweb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!