• Edit
  • Download
  • <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingSoft Demo</title>
      <script nonce="undefined" src='http://cdn.zingchart.com/zingchart.min.js'></script>
      <script nonce="undefined">
        zingchart.MODULESDIR = 'http://cdn.zingchart.com/modules/'
      </script>
    
      <script nonce="undefined" src="https://cdn.zingchart.com/zingchart.min.js"></script>
      <style></style>
    </head>
    
    <body>
      <div id='myChart'></div>
      <script>
        ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
        var first_x1y1 = [1, 6];
        var first_x2y2 = [4, 8];
    
        var second_x1y1 = [2, 2];
        var second_x2y2 = [3, 4];
    
        function getRectCoords(x1y1, x2y2) {
          var coordsArray = [];
    
          coordsArray.push(x1y1); // Push bottom left point, [x1, y1] 
          coordsArray.push( // Push top left point, [x1, y2]
            [x1y1[0], x2y2[1]]
          );
          coordsArray.push(x2y2); // Push top right point, [x2, y2]
          coordsArray.push( // Push bottom right point, [x2, y1] 
            [x2y2[0], x1y1[1]]
          );
    
          return coordsArray; // [ [x1, y1], [x1, y2], [x2, y2], [x2, y1] ]
        }
    
        var myConfig = {
          "graphset": [{
            "type": "scatter",
            "scale-x": {
              "values": "0:5:1"
            },
            "scale-y": {
              "values": "0:10:1",
              "markers": [{
                  "type": "poly",
                  "background-color": "#EA212D",
                  "alpha": 1.0,
                  "range": getRectCoords(first_x1y1, first_x2y2),
                  "value-range": true
                },
                {
                  "type": "poly",
                  "background-color": "#2DB051",
                  "alpha": 1.0,
                  "range": getRectCoords(second_x1y1, second_x2y2),
                  "value-range": true
                }
              ]
            },
            "plot": {
    
            },
            "series": [{
              "values": []
            }]
          }]
        };
    
        zingchart.render({
          id: 'myChart',
          data: myConfig,
          height: 400,
          width: 600
        });
      </script>
    </body>
    
    </html>
    <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingSoft Demo</title>
      <script src='http://cdn.zingchart.com/zingchart.min.js'></script>
      <script>
        zingchart.MODULESDIR = 'http://cdn.zingchart.com/modules/'
      </script>
    
      <script src="https://cdn.zingchart.com/zingchart.min.js"></script>
    </head>
    
    <body>
      <div id='myChart'></div>
    </body>
    
    </html>
    
          
    var first_x1y1 = [1, 6];
    var first_x2y2 = [4, 8];
    
    var second_x1y1 = [2, 2];
    var second_x2y2 = [3, 4];
    
    function getRectCoords(x1y1, x2y2) {
      var coordsArray = [];
    
      coordsArray.push(x1y1); // Push bottom left point, [x1, y1] 
      coordsArray.push( // Push top left point, [x1, y2]
        [x1y1[0], x2y2[1]]
      );
      coordsArray.push(x2y2); // Push top right point, [x2, y2]
      coordsArray.push( // Push bottom right point, [x2, y1] 
        [x2y2[0], x1y1[1]]
      );
    
      return coordsArray; // [ [x1, y1], [x1, y2], [x2, y2], [x2, y1] ]
    }
    
    var myConfig = {
      "graphset": [{
        "type": "scatter",
        "scale-x": {
          "values": "0:5:1"
        },
        "scale-y": {
          "values": "0:10:1",
          "markers": [{
              "type": "poly",
              "background-color": "#EA212D",
              "alpha": 1.0,
              "range": getRectCoords(first_x1y1, first_x2y2),
              "value-range": true
            },
            {
              "type": "poly",
              "background-color": "#2DB051",
              "alpha": 1.0,
              "range": getRectCoords(second_x1y1, second_x2y2),
              "value-range": true
            }
          ]
        },
        "plot": {
    
        },
        "series": [{
          "values": []
        }]
      }]
    };
    
    zingchart.render({
      id: 'myChart',
      data: myConfig,
      height: 400,
      width: 600
    });