Skip to content

iRON5/echarts-ts-describer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Echarts TS Describer

Helps convert huge echarts documentation to typescript definitions.


It was developed to generate doc for echarts.series but it can be used for any other options field. As echarts is huge it is preferred to use this tool for specific options field (otherwise compilation time could be too big and review will too painful).

How to retrieve echarts doc data (for Chrome):

  1. Go to echarts options documentation
  2. Go to dev tools and open main.js?<some hash>
  3. Press "Pretty print" and look for a line like this:
f.isFrozen() || f._toggleSingleItem(f._findItemEl(i(this)))

, it should be placed inside of _initMouse function.

  1. Set debugger on this line
  2. Click expand button on UI options sidebar (debugger should stop on this line)
  3. Enter to console (to observe whole data):
f._dataItemMap.root
  1. Execute something like this (to be able copy this data to clipboard):
f._dataItemMap.root.clean = function(item) {
    const itemForClean = item || this;

    delete itemForClean.parent;

    if (!itemForClean.children) {
        return;
    }

    itemForClean.children.forEach(item => {
        delete item.parent;

        if (item.children) {
            this.clean(item);
        }
    });
};
f._dataItemMap.root.clean();

Note: you can remove any redundant fields (as most of them are auxiliary)

  1. Now you can copy any child from root.children, e.g.:
copy(f._dataItemMap.root.children[24]);

Now Chrome should copy this object to clipboard and you can put it into json file.

Review generated doc and contribute to DefinitelyTyped


Licence

MIT

About

Helps generate huge amount of echarts definitions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published