• 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>
        .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;
        }
    
        html,
        body,
        #myChart {
          height: 100%;
          width: 100%;
        }
      </style>
    </head>
    
    <body>
      <div class="info">
    
        <div data-jsref="control-bar" class="control-bar">
          <div>
            <span>Bullet Type: &nbsp;</span>
            <select data-jsref="aspect">
              <option value="bar">bar</option>
              <option value="cone">cone</option>
              <option value="histogram">histogram</option>
            </select>
            <span>aspect and </span>
          </div>
          <div>
            <select data-jsref="stacked">
              <option value="false">no</option>
              <option value="normal">normal</option>
              <option value="100%">100%</option>
            </select>
            <span>stacking </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 renderBtn = document.querySelector('[data-jsref="renderBtn"]');
    
        var myConfig7 = {
          "type": "bullet",
          "plot": {
            "aspect": aspect.value,
          },
          "series": [{
              "values": [20, 40, 25, 50, 15, 45, 33, 34],
              "goals": [25, 43, 30, 40, 21, 59, 35, 31]
            },
            {
              "values": [5, 30, 21, 18, 59, 50, 28, 33],
              "goals": [21, 35, 23, 29, 61, 55, 33, 30]
            }
          ]
        };
        renderBtn.addEventListener('click', render);
        zingchart.render({
          id: 'myChart',
          data: myConfig7,
          height: "100%",
          width: "100%"
        });
    
        function render() {
          var stackedVal = stacked.value != 'false' ? true : false;
          var stackType = stacked.value != 'false' ? stacked.value : "none";
          zingchart.exec('myChart', 'modify', {
            object: 'plot',
            data: {
              aspect: aspect.value,
              stacked: stackedVal,
              'stack-type': stackType,
            }
          });
        }
      </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>Bullet Type: &nbsp;</span>
            <select data-jsref="aspect">
              <option value="bar">bar</option>
              <option value="cone">cone</option>
              <option value="histogram">histogram</option>
            </select>
            <span>aspect and </span>
          </div>
          <div>
            <select data-jsref="stacked">
              <option value="false">no</option>
              <option value="normal">normal</option>
              <option value="100%">100%</option>
            </select>
            <span>stacking </span>
          </div>
          <button data-jsref="renderBtn">Render</button>
        </div>
      </div>
      <div id='myChart'></div>
    </body>
    
    </html>
    .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;
    }
    
    html,
    body,
    #myChart {
      height: 100%;
      width: 100%;
    }
    // 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 renderBtn = document.querySelector('[data-jsref="renderBtn"]');
    
    var myConfig7 = {
      "type": "bullet",
      "plot": {
        "aspect": aspect.value,
      },
      "series": [{
          "values": [20, 40, 25, 50, 15, 45, 33, 34],
          "goals": [25, 43, 30, 40, 21, 59, 35, 31]
        },
        {
          "values": [5, 30, 21, 18, 59, 50, 28, 33],
          "goals": [21, 35, 23, 29, 61, 55, 33, 30]
        }
      ]
    };
    renderBtn.addEventListener('click', render);
    zingchart.render({
      id: 'myChart',
      data: myConfig7,
      height: "100%",
      width: "100%"
    });
    
    function render() {
      var stackedVal = stacked.value != 'false' ? true : false;
      var stackType = stacked.value != 'false' ? stacked.value : "none";
      zingchart.exec('myChart', 'modify', {
        object: 'plot',
        data: {
          aspect: aspect.value,
          stacked: stackedVal,
          'stack-type': stackType,
        }
      });
    }