How to code custom indicator for export to DOM

I am trying to figure out how the plot of an indicator value shows up on the DOM…using JavaScript and the custom indicators. I have an example of one that does it, but I am having a hard time figuring out what in the code actually does it. Any help is great appreciated! Oh, and I have an array or list of values I need to plot like this, so keeping that in mind, thanks!