• 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,
        #myChart {
          height: 100%;
          width: 100%;
        }
    
        .info {
          padding: 1rem 0 0;
          background: #fff;
          box-sizing: border-box;
        }
    
        .control-bar {
          margin: 0 auto;
          padding: 0 0 1rem;
          display: flex;
          align-items: center;
          justify-content: center;
        }
    
        .control-bar.loaded {
          display: flex !important;
          opacity: 1;
        }
    
        .control-bar>div {
          display: flex;
          align-items: center;
        }
    
        .control-bar>*+* {
          margin-left: 10px;
        }
    
        .control-bar span {
          margin-left: 7px;
          display: inline-block;
        }
    
        .control-bar select {
          min-width: 45px;
          height: 40px;
          background: #fff;
          border: 1px solid #ebebeb;
          border-radius: 4px;
        }
    
        .control-bar .sel-wide {
          min-width: 60px;
        }
    
        .control-bar button {
          min-width: 45px;
          height: 40px;
          cursor: pointer;
          color: #fff;
          background: #074361;
          border: 1px solid #074361;
          border-radius: 4px;
        }
      </style>
    </head>
    
    <body>
      <div class="info">
    
        <div data-jsref="control-bar" class="control-bar">
          <div>
            <span>Radar Type: &nbsp;</span>
            <select data-jsref="aspect">
              <option value="line">line</option>
              <option value="area">area</option>
              <option value="rose">rose</option>
              <option value="scatter">scatter</option>
            </select>
            <span>aspect, </span>
          </div>
          <div>
            <select data-jsref="stacked">
              <option value="false">no</option>
              <option value="true">normal</option>
            </select>
            <span>stacking, and </span>
          </div>
          <div>
            <select data-jsref="scalek">
              <option value="star">star</option>
              <option value="circle">circle</option>
            </select>
            <span>scale-k. </span>
          </div>
          <button data-jsref="renderBtn">Render</button>
        </div>
      </div>
      <div id='myChart'></div>
      <script>
        ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"]; // DOM ELEMENTS
        // -----------------------------
        var controlBar = document.querySelector('[data-jsref="control-bar"]');
        var aspect = document.querySelector('[data-jsref="aspect"]');
        var stacked = document.querySelector('[data-jsref="stacked"]');
        var scalek = document.querySelector('[data-jsref="scalek"]');
        var renderBtn = document.querySelector('[data-jsref="renderBtn"]');
    
    
        var myConfig = {
          "type": "radar",
          "plot": {
            "aspect": aspect.value,
            "stacked": stacked.value
          },
          "scale-k": {
            aspect: scalek.value,
          },
          "scale-v": {
            "values": "0:200:100"
          },
          "series": [{
              "values": [59, 30, 65, 34, 40]
            },
            {
              "values": [76, 60, 11, 21, 99]
            },
            {
              "values": [34, 0, 0, 30, 10]
            }
          ]
        };
    
        renderBtn.addEventListener('click', render);
    
        zingchart.render({
          id: 'myChart',
          data: myConfig,
          height: '100%',
          width: '100%'
        });
    
        function render() {
          zingchart.exec('myChart', 'modify', {
            data: {
              plot: {
                aspect: aspect.value,
                stacked: stacked.value,
              },
              "scale-k": {
                aspect: scalek.value
              }
            }
          });
        }
      </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="info">
    
        <div data-jsref="control-bar" class="control-bar">
          <div>
            <span>Radar Type: &nbsp;</span>
            <select data-jsref="aspect">
              <option value="line">line</option>
              <option value="area">area</option>
              <option value="rose">rose</option>
              <option value="scatter">scatter</option>
            </select>
            <span>aspect, </span>
          </div>
          <div>
            <select data-jsref="stacked">
              <option value="false">no</option>
              <option value="true">normal</option>
            </select>
            <span>stacking, and </span>
          </div>
          <div>
            <select data-jsref="scalek">
              <option value="star">star</option>
              <option value="circle">circle</option>
            </select>
            <span>scale-k. </span>
          </div>
          <button data-jsref="renderBtn">Render</button>
        </div>
      </div>
      <div id='myChart'></div>
    </body>
    
    </html>
    html,
    body,
    #myChart {
      height: 100%;
      width: 100%;
    }
    
    .info {
      padding: 1rem 0 0;
      background: #fff;
      box-sizing: border-box;
    }
    
    .control-bar {
      margin: 0 auto;
      padding: 0 0 1rem;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .control-bar.loaded {
      display: flex !important;
      opacity: 1;
    }
    
    .control-bar>div {
      display: flex;
      align-items: center;
    }
    
    .control-bar>*+* {
      margin-left: 10px;
    }
    
    .control-bar span {
      margin-left: 7px;
      display: inline-block;
    }
    
    .control-bar select {
      min-width: 45px;
      height: 40px;
      background: #fff;
      border: 1px solid #ebebeb;
      border-radius: 4px;
    }
    
    .control-bar .sel-wide {
      min-width: 60px;
    }
    
    .control-bar button {
      min-width: 45px;
      height: 40px;
      cursor: pointer;
      color: #fff;
      background: #074361;
      border: 1px solid #074361;
      border-radius: 4px;
    }
    // DOM ELEMENTS
    // -----------------------------
    var controlBar = document.querySelector('[data-jsref="control-bar"]');
    var aspect = document.querySelector('[data-jsref="aspect"]');
    var stacked = document.querySelector('[data-jsref="stacked"]');
    var scalek = document.querySelector('[data-jsref="scalek"]');
    var renderBtn = document.querySelector('[data-jsref="renderBtn"]');
    
    
    var myConfig = {
      "type": "radar",
      "plot": {
        "aspect": aspect.value,
        "stacked": stacked.value
      },
      "scale-k": {
        aspect: scalek.value,
      },
      "scale-v": {
        "values": "0:200:100"
      },
      "series": [{
          "values": [59, 30, 65, 34, 40]
        },
        {
          "values": [76, 60, 11, 21, 99]
        },
        {
          "values": [34, 0, 0, 30, 10]
        }
      ]
    };
    
    renderBtn.addEventListener('click', render);
    
    zingchart.render({
      id: 'myChart',
      data: myConfig,
      height: '100%',
      width: '100%'
    });
    
    function render() {
      zingchart.exec('myChart', 'modify', {
        data: {
          plot: {
            aspect: aspect.value,
            stacked: stacked.value,
          },
          "scale-k": {
            aspect: scalek.value
          }
        }
      });
    }