Bulk draw items via an api call

  • 21 March 2023
  • 3 replies
  • 74 views

Badge +1

Hi, 

My use case is to create a diagram (similar to a uml class diagram) on the micro canvas. I basically parse complex code bases and after filtering and structuring relevant tokens parsed, I end up with a complex json data that has information about the different files, classes, variables, api calls etc. I want to draw a visual representation of that code base where an application is represented by a frame, and each file inside it forms a separate frame, which further contains shapes representing api calls and variables etc. I want to maintain the hierarchy in the diagram just like in the code itself- for example, a file containing a class, which in turn contains an api call, must be rendered as a frame (the file), containing another frame (the class) as its child, which finally contains a box representing the api call as its child.

So, now that I have provided a context, I’ll come straight to the point. I did not find an api call where I could pass data for multiple items (frames, shapes, tags etc) and it draws a diagram from it, automatically calculating the positions each item would take. It's clearly not possible to send thousands of separate api calls to draw each item separately. Additionally, sending position for each new item in the api call won’t work in my case, as I am to draw a complex diagram where calculating the position of each element in synchrony with other items manually won’t be possible. 

Thanks in advance


3 replies

Userlevel 2
Badge +1

I believe you could simulate the collapse and expand by dynamicaly adding or removing the items and resizing the frame to fit the items. This could be triggered by clicking the app icon or a button in app panel.

Badge +1

Hi @Abdullah, we currently don’t have an endpoint to create items in a batch, but we are currently working on it. You can find this on our public roadmap: https://portal.productboard.com/bs3msuyjdbfr8dfxd84wngpn/c/82-bulk-operations.

However, it will most likely not support auto-layout the way you describe it.

Maybe to decrease the complexity of positioning you could create each item with a hardcoded size (width/height, this should make calculating the positions easier. Is that possible in your case?

Thanks for your help Josip. If auto-layout is not possible, then I believe it won’t be impossible to find a work-around (like how you have suggested). We could maybe just render everything on top on each other, or at random, the first time, and get the user to drag the items around into a desired outlook?

 

There is another issue that I want to discuss with you. Is it possible in some way to replicate “collapsing” and “expanding” of a frame? In my case, a frame could potentially contain a lot of content, which the user might want to shown in a “collapsed” view with only a handful of data shown, and only upon clicking an “expand” button does he get to view the entire picture. And this is where auto-layout would be handy, because the computer needs to automatically compute the positions of items upon expanding and collapsing. 

 

Thanks again 

Userlevel 2
Badge +1

Hi @Abdullah, we currently don’t have an endpoint to create items in a batch, but we are currently working on it. You can find this on our public roadmap: https://portal.productboard.com/bs3msuyjdbfr8dfxd84wngpn/c/82-bulk-operations.

However, it will most likely not support auto-layout the way you describe it.

Maybe to decrease the complexity of positioning you could create each item with a hardcoded size (width/height, this should make calculating the positions easier. Is that possible in your case?

Reply