zserio icon indicating copy to clipboard operation
zserio copied to clipboard

Draw a graph containing a tree structure for easy viewing.

Open kancve opened this issue 3 years ago • 1 comments

I refer to the xml extension to implement the json extension, generate a json file, and use echarts to render the tree structure diagram, the effect is quite good. lanelayer

I deployed the final rendering result here, and the data to be displayed is here.

kancve avatar Oct 09 '22 12:10 kancve

Hi!

Firstly, thanks a lot for sharing your idea and sources. We really appreciate it.

I tried your new extension and I successfully generated JSON files together to Menus.json. Now, I am trying to show result using echarts. I am not very familiar with that and I have generated 130 Json files together with Menus.json, so doing it by hand is not an option. Do you have please some advice how to do it automatically? Is there any easy guide for dummies how to do it?

Thanks!

mikir avatar Oct 20 '22 06:10 mikir

Hi, mikir

I am very glad to receive your comments! So glad!

I think that if the displayed template is stable, we can submit the artifacts of the zserio-echarts repo to the directory 'extensions/json/runtime', similar to the doc extension. At this point, the output of the json extension includes all the results.

kancve avatar Oct 25 '22 10:10 kancve

We have investigated suggested extension more deeply and we like the idea to offer users the graph using echarts. Thanks again for sharing this idea. However, we would like to extend this feature to be more user friendly before integration.

The main potentially problem is that users would expect the one-package-solution which could be possible to run locally. Meaning, don't bother users to copy generated files to some application and build server. Ideally, it could work similarly like doc extension. Just generate something in output directory together with some starting point like index.html. Such extension could be called echarts extension. This name would be probably more intuitive because we expected that JSON extension will generate whole AST tree in JSON similarly to XML extension.

Besides of that, we have found out some issues which should be solved as well:

  • We should support all zserio types, e.g. we were not able to find graphs for enumeration types or choice types.
  • All schema elements from all packages are generated in one directory. This solution introduces clashes if two zserio entities have the same name but are located in different packages.
  • Generation of Menus.json file. This again introduces clash if user defines for example Menus structure in schema.
  • Everything is rendered to one screen without scroll bars which makes unreadable bigger trees with many leaves. This is probably only an echarts configuration problem.
  • To be able to integrate this extension, we will have to extend all *.sh scripts and use ant with build.xml. Unfortunally, we still do not have Contribution Guide, so this is our fault.

As soon as we have time, we will continue with this extension. In the meantime, we will be glad for any help.

mikir avatar Nov 14 '22 08:11 mikir

OK, the problems you listed will be gradually improved in the future. Let me synchronize the following information:

  • The main potentially problem is that users would expect the one-package-solution which could be possible to run locally... --> The artifacts of the zserio-echarts can be set to run locally, just change the configuration item 'publicPath' in vue.config.js to './'. However, the logic of requesting the json file needs to be modified, and I haven't found an appropriate method yet.

  • We should support all zserio types, e.g... --> At present, there is no distinction between types, but only their hierarchical relationship.

  • All schema elements from all packages are generated in one directory... --> Haha, in order to quickly implement it, I took a shortcut because I have not yet deeply understood the overall architecture of zserio. One solution is to attach the package name to the type of name, but it may be troublesome to detect references, and additional information may be required.

  • Generation of Menus.json file... --> Json files should be stored in multiple packages, right?

  • Everything is rendered to one screen... --> ECharts needs to initialize its size. I need to know more about it or replace it with another more suitable frame.

Thanks again.

kancve avatar Nov 16 '22 06:11 kancve

@kancve: I would suggest to create independent repository with your idea as an independent zserio extension according our Zserio Extension Sample. Then, we will add some link in our main README.md to this extension.

In this way, users will be to use this extension even if we won't have time to improve things mentioned above...

mikir avatar Feb 01 '24 10:02 mikir