netjsongraph.js icon indicating copy to clipboard operation
netjsongraph.js copied to clipboard

support for images in properties

Open bittorf opened this issue 10 years ago • 2 comments

i like to have e.g. RRD images when hovering over a node or click on it. the images and the links are known. there must "just" be some magic. e.g.:

"node": [
  "id": "foo",
  ...
  "properties": {
    "image": "path/to/image"
  }
]

bittorf avatar Sep 10 '15 20:09 bittorf

@bittorf, +1, I agree your suggestions about json structure implementation, so I want to ask to @nemesisdesign: I'm very interested to netJson implementation too, and I'd like to propose and suggest some enhancements, but I'm not sure if here is the real place to submit. Perhaps in netJson repo?

gubi avatar Sep 10 '15 21:09 gubi

@bittorf you can accomplish what you need by supplying a custom onClickNode option, the default function is here: https://github.com/interop-dev/netjsongraph.js/blob/master/src/netjsongraph.js#L216-L235

As you can see, the function controls the generated HTML, so you can inject a bit of code that the images the way you prefer. You should also style the CSS differently as they likely won't fit in the small overlay.

Afterwards we can talk about how to avoid duplicating the entire function to add custom bits to the overlay.

I don't think we should address this now in the library itself or in NetJSON, there are just too many ways of doing it and we won't be able to please everybody.

nemesifier avatar Sep 11 '15 16:09 nemesifier