• Edit
  • Download
    1. <!DOCTYPE html>
    2. <html>
    3.  
    4. <head>
    5. <meta charset="utf-8">
    6. <title>ZingSoft Demo</title>
    7.  
    8. <script nonce="undefined" src="https://cdn.zingchart.com/zingchart.min.js"></script>
    9. <style>
    10. html,
    11. body,
    12. #myChart {
    13. height: 100%;
    14. width: 100%;
    15. }
    16. </style>
    17. </head>
    18.  
    19. <body>
    20. <div id='myChart'></div>
    21. <button id="export">Export as PNG</button>
    22. <div id="output">Exported chart image will appear here</div>
    23. <script>
    24. ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
    25. var myConfig = {
    26. type: 'bar',
    27. title: {
    28. text: 'Canvas render'
    29. },
    30. series: [{
    31. values: [3, 5, 8, 4, 2, 6]
    32.  
    33. }]
    34. };
    35.  
    36. zingchart.EXPORTURL = 'http://export.zingchart.com/';
    37. zingchart.AJAXEXPORT = false;
    38.  
    39. zingchart.render({
    40. id: 'myChart',
    41. data: myConfig,
    42. height: "100%",
    43. width: "100%",
    44. output: 'canvas'
    45. });
    46.  
    47. $('#export').click(function() {
    48. var sImageData = zingchart.exec('myChart', 'getimagedata', {
    49. format: 'png'
    50. });
    51. $('#output').html('<img src="' + sImageData + '">');
    52. });
    53. </script>
    54. </body>
    55.  
    56. </html>
    1. <!DOCTYPE html>
    2. <html>
    3.  
    4. <head>
    5. <meta charset="utf-8">
    6. <title>ZingSoft Demo</title>
    7.  
    8. <script src="https://cdn.zingchart.com/zingchart.min.js"></script>
    9. </head>
    10.  
    11. <body>
    12. <div id='myChart'></div>
    13. <button id="export">Export as PNG</button>
    14. <div id="output">Exported chart image will appear here</div>
    15. </body>
    16.  
    17. </html>
    1. html,
    2. body,
    3. #myChart {
    4. height: 100%;
    5. width: 100%;
    6. }
    1. var myConfig = {
    2. type: 'bar',
    3. title: {
    4. text: 'Canvas render'
    5. },
    6. series: [{
    7. values: [3, 5, 8, 4, 2, 6]
    8.  
    9. }]
    10. };
    11.  
    12. zingchart.EXPORTURL = 'http://export.zingchart.com/';
    13. zingchart.AJAXEXPORT = false;
    14.  
    15. zingchart.render({
    16. id: 'myChart',
    17. data: myConfig,
    18. height: "100%",
    19. width: "100%",
    20. output: 'canvas'
    21. });
    22.  
    23. $('#export').click(function() {
    24. var sImageData = zingchart.exec('myChart', 'getimagedata', {
    25. format: 'png'
    26. });
    27. $('#output').html('<img src="' + sImageData + '">');
    28. });