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.


	<!-- Load plotly.js into the DOM -->
	<script src=''></script>

  <h1>Plotly.js WebGL Context Limits test</h1>
  <p>Creates 30 WebGL charts at once. When WebGL context limit is hit, old charts start disappearing. Check the <strong>Console for WebGL errors</strong></p>
  <div class="flex">
    <div class="flex-child" id="chart0"></div>
    <div class="flex-child" id="chart1"></div>
    <div class="flex-child" id="chart2"></div>
    <div class="flex-child" id="chart3"></div>
    <div class="flex-child" id="chart4"></div>
    <div class="flex-child" id="chart5"></div>
    <div class="flex-child" id="chart6"></div>
    <div class="flex-child" id="chart7"></div>
    <div class="flex-child" id="chart8"></div>
    <div class="flex-child" id="chart9"></div>
    <div class="flex-child" id="chart10"></div>
    <div class="flex-child" id="chart11"></div>
    <div class="flex-child" id="chart12"></div>
    <div class="flex-child" id="chart13"></div>
    <div class="flex-child" id="chart14"></div>
    <div class="flex-child" id="chart15"></div>
    <div class="flex-child" id="chart16"></div>
    <div class="flex-child" id="chart17"></div>
    <div class="flex-child" id="chart18"></div>
    <div class="flex-child" id="chart19"></div>
    <div class="flex-child" id="chart20"></div>
    <div class="flex-child" id="chart21"></div>
    <div class="flex-child" id="chart22"></div>
    <div class="flex-child" id="chart23"></div>
    <div class="flex-child" id="chart24"></div>
    <div class="flex-child" id="chart25"></div>
    <div class="flex-child" id="chart26"></div>
    <div class="flex-child" id="chart27"></div>
    <div class="flex-child" id="chart28"></div>
    <div class="flex-child" id="chart29"></div>


                body {
  font-family: "Arial";

.flex {
  display: flex;
  flex-wrap: wrap;

.flex-child {
  flex: 1 1 15%;
  height: 20%;
  display: inline;


                var xValues = [];
var yValues = [];
for(let i = 0; i < 80; i++) { // only 80 points per chart

var trace1 = {
  x: xValues,
  y: yValues,
  type: 'scattergl' // enables webgl

var data = [trace1];

var createChart = (i) => {
   var layout = {
     title: "WebGL Chart " + (i+1),
   console.log("Creating " + layout.title);
   Plotly.newPlot("chart" + i, data, layout);  

// Create one chart every 500ms
// After N created, old ones start disappearing 
// (depends on browser WebGL context limit)
for(let i = 0; i < 30; i++) {
   setTimeout(() => createChart(i), i*0);