Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="container clearfix">
		<h1>Chartworks Web Component Example</h1>
		<div class="left sample">Left content</div>
		<div class="web-component">
			<!-- Here is the Web Component -->
			<chartworks-element symbol="AAPL" exchange="NSQ" token="demo-token"></chartworks-element>
		<div class="right sample">Right content</div>
	<div class="bottom sample">Bottom content</div>



                body { font-family: "Roboto" }
.left { float: left; height: 210px; }
.right { float: left; height: 210px; }
.sample { background: #f8fafd; padding: 10px; margin: 0 10px; border: 1px solid #ccc; }
.web-component { float: left; margin-bottom: 10px; }
.container { width: 900px; }
.clearfix:after { content: ""; display: table; clear: both; }



                // create the HTML template that will contain the Chartworks chart
const template = document.createElement('template'); 
template.innerHTML = `
			#chartTarget {
				width: 500px;
				height: 300px;
    <div id="chartTarget"></div>

// create a custom HTMLElement
class ChartworksElement extends HTMLElement {
	constructor () {
		this.attachShadow({ mode: 'open' });
  // once the element exists, mount Chartworks
	connectedCallback () {
		// add template we created above
		// initialize chartworks
		this.chartworks = new ChartworksBuilder({
			"token": this.getAttribute("token"),
			"symbol": this.getAttribute("symbol"),
			"exchange": this.getAttribute("exchange"),
			"shadowTarget": "chartworks-element",
			"target": "#chartTarget",
			"feature.timeframe": true,
			"feature.indicators": true,
			"": false,
			"template.size": "large",
			"feature.panZoom": true,
      "panel.lower.indicator": "volume"
  // clean up if/when element is removed
	disconnectedCallback () {

// define our new DOM element as "chartworks-element"
window.customElements.define('chartworks-element', ChartworksElement);