• Edit
  • Download
  • <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingSoft Demo</title>
    
      <script nonce="undefined" src="https://cdn.zingchart.com/zingchart.min.js"></script>
      <style>
        html,
        body {
          height: 100%;
          width: 100%;
          margin: 0;
          padding: 0;
        }
    
        #myChart {
          margin-left: 10%;
          height: 100%;
          min-height: 150px;
        }
    
        .zc-ref {
          display: none;
        }
    
        .controls {
          z-index: 1000;
          position: fixed;
          top: 0;
          left: 0;
          bottom: 0;
          width: 10%;
          background-color: #9e9e9e;
          padding: 15px;
        }
    
        .controls label {
          width: 75px;
          display: inline-block;
        }
    
        .controls input {
          margin-bottom: 5px;
          width: 90%;
        }
      </style>
    </head>
    
    <body>
      <div class="controls">
    
        <label for="a-value">|A|</label>
        <input id="a-value" name="a-value" type="number" value="16" min=1>
    
        <label for="b-value">|B|</label>
        <input id="b-value" name="b-value" type="number" value="16" min=1>
    
        <label for="c-value">|C|</label>
        <input id="c-value" name="c-value" type="number" value="12" min=1>
    
        <label for="ab-value">|A∩B|</label>
        <input id="ab-value" name="ab-value" type="number" value="4" min=1>
    
        <label for="bc-value">|B∩C|</label>
        <input id="bc-value" name="bc-value" type="number" value="4" min=1>
    
        <label for="ca-value">|C∩A|</label>
        <input id="ca-value" name="ca-value" type="number" value="3" min=1>
    
        <p><strong>Note: </strong> |A∩B∩C| is calculated by ZingChart</p>
        <hr>
        <button onclick="window.parent.location.reload()">Reload Data</button>
        <!--<label for="abc-value"></label>
      	    <input id="abc-value" name="abc-value" type="number" value="2" disabled>
      	    -->
    
      </div>
      <div id="myChart"><a class="zc-ref" href="https://www.zingchart.com">Powered by ZingChart</a></div>
      <script>
        ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
        var myConfig = {
          "type": "venn",
          "plot": {
            "value-box": {
              "text": "%t:<br>%v",
              "joined": {
                "text": "Joined:<br>%joined-value"
              },
              "shared": {
                "text": "Shared:<br>%shared-value"
              }
            }
          },
          "series": [{
              "values": [16],
              "join": [4],
              "text": "Set One"
            },
            {
              "values": [16],
              "join": [3],
              "text": "Set Two"
            },
            {
              "values": [12],
              "join": [4],
              "text": "Set Three"
            }
          ]
        };
    
        zingchart.render({
          id: 'myChart',
          data: myConfig,
          height: "100%",
          width: "100%"
        });
    
        function updateChart() {
          zingchart.exec('myChart', 'setdata', {
            data: myConfig
          });
        }
    
        function updateChartValue(updateValue, seriesIndex, valuesIndex) {
          if (updateValue <= 0)
            return false;
          myConfig.series[seriesIndex].values[valuesIndex] = updateValue;
        }
    
        function updateChartJoin(updateValue, seriesIndex, valuesIndex) {
          if (updateValue <= 0)
            return false;
          myConfig.series[seriesIndex].join[valuesIndex] = updateValue;
        }
    
        document.getElementById('a-value').addEventListener('input', function(e) {
          updateChartValue(Number(e.target.value), 0, 0);
          updateChart();
        });
        document.getElementById('b-value').addEventListener('input', function(e) {
          updateChartValue(Number(e.target.value), 1, 0);
          updateChart();
        });
        document.getElementById('c-value').addEventListener('input', function(e) {
          updateChartValue(Number(e.target.value), 2, 0);
          updateChart();
        });
        document.getElementById('ab-value').addEventListener('input', function(e) {
          updateChartJoin(Number(e.target.value), 0, 0);
          updateChart();
        });
        document.getElementById('bc-value').addEventListener('input', function(e) {
          updateChartJoin(Number(e.target.value), 1, 0);
          updateChart();
        });
        document.getElementById('ca-value').addEventListener('input', function(e) {
          updateChartJoin(Number(e.target.value), 2, 0);
          updateChart();
        });
      </script>
    </body>
    
    </html>
    <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingSoft Demo</title>
    
      <script src="https://cdn.zingchart.com/zingchart.min.js"></script>
    </head>
    
    <body>
      <div class="controls">
    
        <label for="a-value">|A|</label>
        <input id="a-value" name="a-value" type="number" value="16" min=1>
    
        <label for="b-value">|B|</label>
        <input id="b-value" name="b-value" type="number" value="16" min=1>
    
        <label for="c-value">|C|</label>
        <input id="c-value" name="c-value" type="number" value="12" min=1>
    
        <label for="ab-value">|A∩B|</label>
        <input id="ab-value" name="ab-value" type="number" value="4" min=1>
    
        <label for="bc-value">|B∩C|</label>
        <input id="bc-value" name="bc-value" type="number" value="4" min=1>
    
        <label for="ca-value">|C∩A|</label>
        <input id="ca-value" name="ca-value" type="number" value="3" min=1>
    
        <p><strong>Note: </strong> |A∩B∩C| is calculated by ZingChart</p>
        <hr>
        <button onclick="window.parent.location.reload()">Reload Data</button>
        <!--<label for="abc-value"></label>
      	    <input id="abc-value" name="abc-value" type="number" value="2" disabled>
      	    -->
    
      </div>
      <div id="myChart"><a class="zc-ref" href="https://www.zingchart.com">Powered by ZingChart</a></div>
    </body>
    
    </html>
    html,
    body {
      height: 100%;
      width: 100%;
      margin: 0;
      padding: 0;
    }
    
    #myChart {
      margin-left: 10%;
      height: 100%;
      min-height: 150px;
    }
    
    .zc-ref {
      display: none;
    }
    
    .controls {
      z-index: 1000;
      position: fixed;
      top: 0;
      left: 0;
      bottom: 0;
      width: 10%;
      background-color: #9e9e9e;
      padding: 15px;
    }
    
    .controls label {
      width: 75px;
      display: inline-block;
    }
    
    .controls input {
      margin-bottom: 5px;
      width: 90%;
    }
    var myConfig = {
      "type": "venn",
      "plot": {
        "value-box": {
          "text": "%t:<br>%v",
          "joined": {
            "text": "Joined:<br>%joined-value"
          },
          "shared": {
            "text": "Shared:<br>%shared-value"
          }
        }
      },
      "series": [{
          "values": [16],
          "join": [4],
          "text": "Set One"
        },
        {
          "values": [16],
          "join": [3],
          "text": "Set Two"
        },
        {
          "values": [12],
          "join": [4],
          "text": "Set Three"
        }
      ]
    };
    
    zingchart.render({
      id: 'myChart',
      data: myConfig,
      height: "100%",
      width: "100%"
    });
    
    function updateChart() {
      zingchart.exec('myChart', 'setdata', {
        data: myConfig
      });
    }
    
    function updateChartValue(updateValue, seriesIndex, valuesIndex) {
      if (updateValue <= 0)
        return false;
      myConfig.series[seriesIndex].values[valuesIndex] = updateValue;
    }
    
    function updateChartJoin(updateValue, seriesIndex, valuesIndex) {
      if (updateValue <= 0)
        return false;
      myConfig.series[seriesIndex].join[valuesIndex] = updateValue;
    }
    
    document.getElementById('a-value').addEventListener('input', function(e) {
      updateChartValue(Number(e.target.value), 0, 0);
      updateChart();
    });
    document.getElementById('b-value').addEventListener('input', function(e) {
      updateChartValue(Number(e.target.value), 1, 0);
      updateChart();
    });
    document.getElementById('c-value').addEventListener('input', function(e) {
      updateChartValue(Number(e.target.value), 2, 0);
      updateChart();
    });
    document.getElementById('ab-value').addEventListener('input', function(e) {
      updateChartJoin(Number(e.target.value), 0, 0);
      updateChart();
    });
    document.getElementById('bc-value').addEventListener('input', function(e) {
      updateChartJoin(Number(e.target.value), 1, 0);
      updateChart();
    });
    document.getElementById('ca-value').addEventListener('input', function(e) {
      updateChartJoin(Number(e.target.value), 2, 0);
      updateChart();
    });