pivot-table

by azeq

HTML

<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>SquashQL</title>
  </head>

  <body>
    <div id="container" />
  </body>
  <script src="https://unpkg.com/@antv/s2/dist/s2.min.js"></script>

</html>

JavaScript

const squashQLResponse = {
  "cells": [{
      "sales": 16200
    },
    {
      "month": "Jan",
      "sales": 6700
    },
    {
      "month": "Feb",
      "sales": 5150
    },
    {
      "month": "Mar",
      "sales": 4350
    },
    {
      "product": "ProductA",
      "sales": 6450
    },
    {
      "product": "ProductA",
      "month": "Jan",
      "sales": 2200
    },
    {
      "product": "ProductA",
      "month": "Feb",
      "sales": 2000
    },
    {
      "product": "ProductA",
      "month": "Mar",
      "sales": 2250
    },
    {
      "product": "ProductA",
      "region": "North",
      "sales": 2850
    },
    {
      "product": "ProductA",
      "month": "Jan",
      "region": "North",
      "sales": 1000
    },
    {
      "product": "ProductA",
      "month": "Feb",
      "region": "North",
      "sales": 900
    },
    {
      "product": "ProductA",
      "month": "Mar",
      "region": "North",
      "sales": 950
    },
    {
      "product": "ProductA",
      "region": "South",
      "sales": 3600
    },
    {
      "product": "ProductA",
      "month": "Jan",
      "region": "South",
      "sales": 1200
    },
    {
      "product": "ProductA",
      "month": "Feb",
      "region": "South",
      "sales": 1100
    },
    {
      "product": "ProductA",
      "month": "Mar",
      "region": "South",
      "sales": 1300
    },
    {
      "product": "ProductB",
      "sales": 6450
    },
    {
      "product": "ProductB",
      "month": "Jan",
      "sales": 2300
    },
    {
      "product": "ProductB",
      "month": "Feb",
      "sales": 2050
    },
    {
      "product": "ProductB",
      "month": "Mar",
      "sales": 2100
    },
    {
      "product": "ProductB",
      "region": "North",
      "sales": 2250
    },
    {
      "product": "ProductB",
      "month": "Jan",
      "region": "North",
      "sales": 800
    },
   ...