Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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.


Save Automatically?

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="chart" style="width:100%; height: 100%;"></div>




                const pool =;

class ChartIO {
  constructor(dpLen, chartContainerId, chartTitle="ChartIO Graph",
      channelSize=1) {
    const dataSeries = new Array(channelSize);
    const dataPointsBuffer = new Array(channelSize);
    for (let i = 0; i < channelSize; i++) {
      dataPointsBuffer[i] = new Array(dpLen);
      for (let j = 0; j < dpLen; j++)
        dataPointsBuffer[i][j] = { x: j, y: 0 };
      dataPointsBuffer[i].cur = dpLen+1;
      dataSeries[i] = {
        type: "line",
        dataPoints: dataPointsBuffer[i],
        name: `Channel ${i}`,
        showInLegend: true
    this.dataPointsBuffer = dataPointsBuffer;
    this.dpLen = dpLen;
    this.chart = new CanvasJS.Chart(chartContainerId, {
       title: { text: chartTitle },
       axisY: { includeZero: true },
       data: dataSeries
  addData(dataPoint, channelIndex=0) {// channel-index=data-series
    const dpBuf = this.dataPointsBuffer[channelIndex];
    const dpLen = this.dpLen;
    const rcyc = dpBuf[0];// recycle the first data-point object
    for (let i = 1; i < dpLen; i++) {
      dpBuf[i-1] = dpBuf[i];// shift left everything
    rcyc.x = dpBuf.cur++;
    rcyc.y = dataPoint;
    dpBuf[dpLen - 1] = rcyc;// placed the recycled data-point obj

const chart = new ChartIO(500, "chart", "Object Pool Correlation Graph", 3)


let m = 0;
PIXI.Ticker.shared.add(() => {
   const toss = Math.floor(Math.random() * 150000);
   const arr = [];
   for(let i = 0; i < toss; i++) {
   for (let i = 0; i < toss; i++) {
     const r = arr.pop();
     r.x = 10;

   if (m%2 === 0) {
     chart.addData(pool.capacity, 0)
     chart.addData(pool._freeCount, 1)
     chart.addData(toss, 2)
    /* chart.addData(pool._borrowRateAverageProvider._average, 3)
     chart.addData(pool._marginAverage, 4)
     chart.addData(pool._borrowRateAverageProvider.absDev(), 5)*/
      chart.chart.render();// render now!