Group Abstract Group Abstract

Message Boards Message Boards

Trying to reproduce the behavior of Graph objects with visual representation

Posted 2 years ago
POSTED BY: Paul Cousin
4 Replies

I posted a simple answer to your question on stack exchange here https://mathematica.stackexchange.com/a/303798/9490

myObject /: MakeBoxes[myObject[data_], form_] := With[
    {interp = Interpretation[visualRepresentation[myObject[data]], myObject[data]]},
    MakeBoxes[interp, form]
]
POSTED BY: Jason Biggs
Posted 2 years ago

It works exactly as I wished and is indeed super simple. Thank you so much!

POSTED BY: Paul Cousin

I was facing the same issue while trying to make the Hypergraph object that behaves exactly like Graph and Tree. I just looked into their FormatValues and copied stuff from there. You can see this hack that overloads GraphicsBox here: https://github.com/WolframInstitute/Hypergraph/blob/main/Kernel/Formatting.m

POSTED BY: Nikolay Murzin
Posted 2 years ago

Excellent, I'll try to use your code as a template. Thank you!

POSTED BY: Paul Cousin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard