JSFiddle - React, Tailwind, and code Playground

by Flexmonster Pivot Table

HTML

<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>

<div id="pivotContainer"></div>

JavaScript

let pivot = new Flexmonster({
  container: "pivotContainer",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  report: {

    dataSource: {
      type: "csv",
      filename: "data/data.csv"
    },
    slice: {
      rows: [{
        uniqueName: "Country"
      }],
      columns: [{
        uniqueName: "[Measures]"
      }],
      measures: [{
        uniqueName: "Price"
      }, {
        uniqueName: "Quantity"
      }]
    },
    options: {
      viewType: "charts",
      chart: {
        type: "line",
        multipleMeasures: true
      }
    },
  }
});

const r = 5;

pivot.customizeChartElement((element, data) => {
  if (data.type === 'legend' && element.tagName) {

    if (data.measure.uniqueName === 'Price') {
      const color = element.firstElementChild.style["background-color"];
      element.firstElementChild.outerHTML = `<span class="fm-ui-element fm-text-display" style='color:${color}' >&#x25B3; &nbsp;
     </span>`
    }
    if (data.measure.uniqueName === 'Quantity') {
      const color = element.firstElementChild.style["background-color"];
      element.firstElementChild.outerHTML = `<span class="fm-ui-element fm-text-display" style='color:${color}' >&#x25EF; &nbsp;
     </span>`
    }


  }

  if (element.tagName != "circle") return;
  if (data.measure.uniqueName === 'Price') {
    const attr = {
      x: Number.parseFloat(element.getAttribute("cx")),
      y: Number.parseFloat(element.getAttribute("cy")),
      stroke: element.style.stroke
    }
    let triangle = document.createElement("polygon");

    triangle.setAttribute("points",
      `${attr.x - r},${attr.y + r} ${attr.x + r},${attr.y + r} ${attr.x},${attr.y - r}`);
    triangle.setAttribute("fill", "#ffffff");
    triangle.setAttribute("stroke", attr.stroke);
    triangle.append(element.childNodes[0]);
    element.outerHTML = triangle.outerHTML;
  }
});