Statistics plugin and utilities


Hi all,

I’ve put the Statistics plugin project online on github.

This shows creating a dialog, showing a list / basic datagrid of data with scrollbar, walking down the scenegraph and using recursive functions.

It shows creating classes to store form data and form references to UI controls and shows using a static getter and setter.

The project includes common XD icons, default plugin icons.

The utilities classes contain frequently used methods that have helped me during development. A few of those are:

  • log() - This is the same as console.log but adds the function name of where it’s called from and indents your message. If you call log again inside the same function it won’t write the function name again. For example, a few log messages, log("Opening element dialog"); inside the function showElementDialog() will show the following:
  • object() - Writes the objects properties and values in an easy to read name and value columns in the console. For example, calling, object({name:"Rectangle", x:10, y:10, width:100, height:100}); inside the function showElementDialog() will show the following:
  • DebugSettings.outlineOnClick() - Pass your dialog form into this and run your plugin. Command + click anywhere and an outline will show around the element and the element name will be written to the console.

I haven’t written any code examples for the utilities yet so let me know and I’ll add them.