Pen Settings

HTML

CSS

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

HTML

              
                <link href="https://cdn.webdatarocks.com/latest/webdatarocks.min.css" rel="stylesheet"/>
<script src="https://cdn.webdatarocks.com/latest/webdatarocks.toolbar.min.js"></script>
<script src="https://cdn.webdatarocks.com/latest/webdatarocks.js"></script>
<div id="wdr-component"></div>
              
            
!

CSS

              
                
              
            
!

JS

              
                var pivot = new WebDataRocks({
  container: "#wdr-component",
  toolbar: true,
  height: 490,
  report: {
    dataSource: {
      data: getData()
    },
    slice: {
      rows: [
        {
          uniqueName: "Item"
        }
      ],
      columns: [
        {
          uniqueName: "Measures"
        }
      ],
      measures: [
        {
          uniqueName: "Price",
          aggregation: "sum"
        },
        {
          uniqueName: "Description_identifier",
          aggregation: "count",
          grandTotalCaption: "Description",
          format: "left"
        }
      ]
    },
    options: {
      grid: {
        showTotals: "off",
        showGrandTotals: "off"
      }
    },
    formats: [
      {
        name: "left",
        textAlign: "left"
      }
    ]
  }
});

descriptions = [
  "Aliqua ex eiusmod aute tempor aliquip aute consequat et excepteur pariatur nostrud laborum occaecat.",
  "Quis et anim nulla esse duis elit proident.",
  "Excepteur proident quis ut dolor cillum esse sit culpa nulla.",
  "Qui est voluptate quis laborum enim reprehenderit.",
  "Tempor pariatur nisi nostrud ad occaecat non laboris duis consequat amet.",
  "Esse anim eu irure proident tempor ex proident consectetur fugiat ipsum quis.",
  "Nisi eiusmod velit ea eu et est.",
  "Incididunt sint occaecat consectetur voluptate cillum dolor excepteur eu.",
  "Nulla veniam magna consequat in non ad esse."
];

pivot.customizeCell(function customizeCellFunction(cell, data) {
  if (
    data.measure &&
    data.type != "header" &&
    data.measure.uniqueName == "Description_identifier"
  )
        cell.text = descriptions[data.value];
});

function getData() {
  return [
    {
      Item: "Cars",
      Price: 4562,
      Description_identifier: 0
    },
    {
      Item: "Bikes",
      Price: 4809,
      Description_identifier: 1
    },
    {
      Item: "Bikes",
      Price: 8222,
      Description_identifier: 2
    },
    {
      Item: "Bikes",
      Price: 7807,
      Description_identifier: 3
    },
    {
      Item: "Boats",
      Price: 9445,
      Description_identifier: 4
    },
    {
      Item: "Bikes",
      Price: 5121,
      Description_identifier: 5
    },
    {
      Item: "Boats",
      Price: 7660,
      Description_identifier: 6
    },
    {
      Item: "Boats",
      Price: 4118,
      Description_identifier: 7
    },
    {
      Item: "Bikes",
      Price: 2646,
      Description_identifier: 8
    }
  ];
}

              
            
!
999px

Console