strathausen / dracula

JavaScript layout and representation of connected graphs.
https://www.graphdracula.net
MIT License
835 stars 132 forks source link

Can now pass attributes for a label on an edge. #2

Closed ms-ati closed 13 years ago

ms-ati commented 13 years ago

Also, enabled style callbacks for edges.

Example: addEdge(n1, n2, { label: "label text", "label-style" : { "font-size": 10 });

(merged from https://github.com/wowstrongdrink/dracula-js-fork/commit/30028ef89ab310a20a59988bd6eeb013eeefbb00)

Signed-off-by: Marc Siegel marc@usainnov.com

strathausen commented 13 years ago

Looks good, I will look at it soon! Thanks a lot!

strathausen commented 13 years ago

Hi, I can't seem to get it working. Did the merge and stuff, and then tried to do like:

g.addNode("id35", {
    label : "meat\nand\ngreed" ,
    /* filling the shape with a color makes it easier to be dragged */
    /* arguments: r = Raphael object, n : node object */
    "label-style" : {
        "font-size": 15
    },
    render : render
});

But the label doesn't look any different. Do I have to also pass a callback function that evaluates the style?

ms-ati commented 13 years ago

Hi,

Try it with g.addEdge...

-Marc

On Fri, Apr 8, 2011 at 8:51 AM, strathausen reply@reply.github.com wrote:

Hi, I can't seem to get it working. Did the merge and stuff, and then tried to do like:

   g.addNode("id35", {        label : "meat\nand\ngreed" ,        /* filling the shape with a color makes it easier to be dragged /        / arguments: r = Raphael object, n : node object */        "label-style" : {            "font-size": 15        },        render : render    });

But the label doesn't look any different. Do I have to also pass a callback function that evaluates the style?

Reply to this email directly or view it on GitHub: https://github.com/strathausen/dracula/pull/2#issuecomment-973532

Marc Siegel Technology Specialist American Technology Innovations

Email: marc@usainnov.com Phone: 617-399-8145 Cell: 617-223-1220 Fax: 267-219-0735

strathausen commented 13 years ago

Of course :-) silly me! Merged it. Thanks!

ms-ati commented 13 years ago

Awesome!

Do you think the same mechanism should be added for the label on a Node? (I didn't have a need for that yet, so I don't know if it already exists)

-Marc

On Fri, Apr 8, 2011 at 10:49 AM, strathausen reply@reply.github.com wrote:

Of course :-) silly me! Merged it. Thanks!

Reply to this email directly or view it on GitHub: https://github.com/strathausen/dracula/pull/2#issuecomment-974066

Marc Siegel Technology Specialist American Technology Innovations

Email: marc@usainnov.com Phone: 617-399-8145 Cell: 617-223-1220 Fax: 267-219-0735

strathausen commented 13 years ago

Well, sure, somehow... I already have a render callback function for customising the nodes, but no declarative way yet. I'll keep it in mind for the next coding session!

ms-ati commented 13 years ago

Ok great -- my only suggestion would be that it is consistent between Nodes and Edges -- how do you feel about using "label-style" as the Raphael attrs node for the Node label as well?

-Marc

On Fri, Apr 8, 2011 at 11:08 AM, strathausen reply@reply.github.com wrote:

Well, sure, somehow... I already have a render callback function for customising the nodes, but no declarative way yet. I'll keep it in mind for the next coding session!

Reply to this email directly or view it on GitHub: https://github.com/strathausen/dracula/pull/2#issuecomment-974149

Marc Siegel Technology Specialist American Technology Innovations

Email: marc@usainnov.com Phone: 617-399-8145 Cell: 617-223-1220 Fax: 267-219-0735

strathausen commented 13 years ago

Hi, actually I was even thinking about a more generic way of describing the node appearence, like the label being only one of the parts of the node representation. So you would have some text, a rectangle or other geometric forms declared as from the Raphaël documentation. Maybe the edge could be like that as well. I am still thinking. You're right, it should be consistent.