• Edit
  • Download
  • <!DOCTYPE html>
    <html>
    
    <head>
      <meta charset="utf-8">
      <title>ZingSoft Demo</title>
    
      <script src="https://cdn.zingchart.com/zingchart.min.js"></script>
      <style>
        html,
        body {
          height: 100%;
          width: 100%;
          margin: 0;
          padding: 0;
        }
    
        #myChart {
          width: 100%;
          min-height: 150px;
        }
    
        .zc-ref {
          display: none;
        }
      </style>
    </head>
    
    <body>
      <button id="test_export">Export Chart</button>
      <div id="demo-chart"><a class="zc-ref" href="https://www.zingchart.com">Powered by ZingChart</a></div>
      <hr>
      <img src="" id="output_image">
      <script>
        ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
        var myConfig = {
          type: 'bar',
          stacked: true,
          scaleY: {
            markers: [{
              type: 'line',
              range: [50, 150], //you need to determine these values
              lineColor: 'blue',
              placement: 'top',
              lineWidth: 2
            }]
          },
          legend: {},
          scaleX: {
            zooming: true,
            zoomTo: [2, 5]
          },
          scrollX: {},
          series: [{
              values: [35, 42, 67, 99, 35, 54, 34],
              text: 'This is for blue'
            },
            {
              values: [34, 67, 85, 22, 12, 44, 62],
              text: 'This is for red'
            }
          ]
        };
    
        zingchart.render({
          id: 'demo-chart',
          data: myConfig,
          height: 400,
          width: '100%',
          //output: 'svg' // default output is SVG
        });
    
        test_export.addEventListener('click', function() {
          zingchart.exec('demo-chart', 'getimagedata', {
            filetype: 'png',
            callback: function(imagedata) {
              console.log(imagedata);
              document.getElementById('output_image').src = imagedata;
            }
          });
        });
      </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>
      <button id="test_export">Export Chart</button>
      <div id="demo-chart"><a class="zc-ref" href="https://www.zingchart.com">Powered by ZingChart</a></div>
      <hr>
      <img src="" id="output_image">
    </body>
    
    </html>
    html,
    body {
      height: 100%;
      width: 100%;
      margin: 0;
      padding: 0;
    }
    
    #myChart {
      width: 100%;
      min-height: 150px;
    }
    
    .zc-ref {
      display: none;
    }
    var myConfig = {
      type: 'bar',
      stacked: true,
      scaleY: {
        markers: [{
          type: 'line',
          range: [50, 150], //you need to determine these values
          lineColor: 'blue',
          placement: 'top',
          lineWidth: 2
        }]
      },
      legend: {},
      scaleX: {
        zooming: true,
        zoomTo: [2, 5]
      },
      scrollX: {},
      series: [{
          values: [35, 42, 67, 99, 35, 54, 34],
          text: 'This is for blue'
        },
        {
          values: [34, 67, 85, 22, 12, 44, 62],
          text: 'This is for red'
        }
      ]
    };
    
    zingchart.render({
      id: 'demo-chart',
      data: myConfig,
      height: 400,
      width: '100%',
      //output: 'svg' // default output is SVG
    });
    
    test_export.addEventListener('click', function() {
      zingchart.exec('demo-chart', 'getimagedata', {
        filetype: 'png',
        callback: function(imagedata) {
          console.log(imagedata);
          document.getElementById('output_image').src = imagedata;
        }
      });
    });