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 id='description'>
<p>Stack offset shift the  baseline of the chart to give more emphasis on the changing values. There are different ways to set the offset and by default it is set to <code>'stackOffsetNone'</code>. All the offset properties can be found <a href="" target="_blank">here</a>.</p>
<p>Stack order is the way of ordering the charts and by default set to<code>'stackOrderNone'</code>. All the stack order properties can be found 
 <a href="" target="_blank"> here.</a></p>
<p><code>StackOffset</code> works in relation with <code>stackOrder</code> to create streamgraph.</p>
<p>The offset is set to <code>'stackOffsetWiggle'</code> and order to <code>'stackOrderInsideOut'</code> on the chart below which is commonly used for streamgraph.</p>
<div id='chart'></div>  
<p>NOTE:<code>stacked()</code> need to be set to <code>true</code> for stacking to work.</code></p>  


  margin: 1em;


//shift the chart over or under the baseline 

let dataSet = [{ 'l': 1,'v': [1, 4, 5,4]}, 
               { 'l': 3,'v': [4, 3, 1,8]}, 
               { 'l': 6,'v': [5, 6, 6,2]},
               { 'l': 8,'v': [6, 7, 2,6]},
               { 'l': 9,'v': [10, 7, 5,2]}

let chart = d3_rs_lines.html()
  .stacked(true)              //stack chart enabled
  .stackOffset('stackOffsetWiggle') //set the offset
  .stackOrder('stackOrderInsideOut');  //set the order'#chart')