• 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. height: 100%;
    13. width: 100%;
    14. margin: 0;
    15. padding: 0;
    16. }
    17.  
    18. #myChart {
    19. width: 100%;
    20. min-height: 150px;
    21. }
    22.  
    23. .zc-ref {
    24. display: none;
    25. }
    26. </style>
    27. </head>
    28.  
    29. <body>
    30. <button id="test_export">Export Chart</button>
    31. <div id="demo-chart"><a class="zc-ref" href="https://www.zingchart.com">Powered by ZingChart</a></div>
    32. <hr>
    33. <img src="" id="output_image">
    34. <script>
    35. ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
    36. var myConfig = {
    37. type: 'bar',
    38. stacked: true,
    39. scaleY: {
    40. markers: [{
    41. type: 'line',
    42. range: [50, 150], //you need to determine these values
    43. lineColor: 'blue',
    44. placement: 'top',
    45. lineWidth: 2
    46. }]
    47. },
    48. legend: {},
    49. scaleX: {
    50. zooming: true,
    51. zoomTo: [2, 5]
    52. },
    53. scrollX: {},
    54. series: [{
    55. values: [35, 42, 67, 99, 35, 54, 34],
    56. text: 'This is for blue'
    57. },
    58. {
    59. values: [34, 67, 85, 22, 12, 44, 62],
    60. text: 'This is for red'
    61. }
    62. ]
    63. };
    64.  
    65. zingchart.render({
    66. id: 'demo-chart',
    67. data: myConfig,
    68. height: 400,
    69. width: '100%',
    70. //output: 'svg' // default output is SVG
    71. });
    72.  
    73. test_export.addEventListener('click', function() {
    74. zingchart.exec('demo-chart', 'getimagedata', {
    75. filetype: 'png',
    76. callback: function(imagedata) {
    77. console.log(imagedata);
    78. document.getElementById('output_image').src = imagedata;
    79. }
    80. });
    81. });
    82. </script>
    83. </body>
    84.  
    85. </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. <button id="test_export">Export Chart</button>
    13. <div id="demo-chart"><a class="zc-ref" href="https://www.zingchart.com">Powered by ZingChart</a></div>
    14. <hr>
    15. <img src="" id="output_image">
    16. </body>
    17.  
    18. </html>
    1. html,
    2. body {
    3. height: 100%;
    4. width: 100%;
    5. margin: 0;
    6. padding: 0;
    7. }
    8.  
    9. #myChart {
    10. width: 100%;
    11. min-height: 150px;
    12. }
    13.  
    14. .zc-ref {
    15. display: none;
    16. }
    1. var myConfig = {
    2. type: 'bar',
    3. stacked: true,
    4. scaleY: {
    5. markers: [{
    6. type: 'line',
    7. range: [50, 150], //you need to determine these values
    8. lineColor: 'blue',
    9. placement: 'top',
    10. lineWidth: 2
    11. }]
    12. },
    13. legend: {},
    14. scaleX: {
    15. zooming: true,
    16. zoomTo: [2, 5]
    17. },
    18. scrollX: {},
    19. series: [{
    20. values: [35, 42, 67, 99, 35, 54, 34],
    21. text: 'This is for blue'
    22. },
    23. {
    24. values: [34, 67, 85, 22, 12, 44, 62],
    25. text: 'This is for red'
    26. }
    27. ]
    28. };
    29.  
    30. zingchart.render({
    31. id: 'demo-chart',
    32. data: myConfig,
    33. height: 400,
    34. width: '100%',
    35. //output: 'svg' // default output is SVG
    36. });
    37.  
    38. test_export.addEventListener('click', function() {
    39. zingchart.exec('demo-chart', 'getimagedata', {
    40. filetype: 'png',
    41. callback: function(imagedata) {
    42. console.log(imagedata);
    43. document.getElementById('output_image').src = imagedata;
    44. }
    45. });
    46. });