• Edit
  • Download
    1. <!DOCTYPE html>
    2. <html>
    3.  
    4. <head>
    5. <meta charset="utf-8">
    6. <title>ZingSoft Demo</title>
    7. <script nonce="undefined" src="//www.zingchart.com/scripts/zcDocs.js"></script>
    8. <link href='//www.zingchart.com/css/zcDocs.css' rel='stylesheet' type='text/css'>
    9.  
    10. <script nonce="undefined" src="https://cdn.zingchart.com/zingchart.min.js"></script>
    11. <style></style>
    12. </head>
    13.  
    14. <body>
    15. <div id='demo-chart'></div>
    16. <button class='btn btn-danger' id='reload'>Reset</button>
    17. <button class='btn btn-info' id='demo1'>Run Demo 1</button>
    18. <pre id='output'></pre>
    19. <script>
    20. ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
    21. var myConfig = {
    22. 'type': 'line',
    23. 'series': [{
    24. 'values': [11, 26, 7, 44, 11]
    25. }]
    26. };
    27.  
    28. zingchart.render({
    29. id: 'demo-chart',
    30. data: myConfig,
    31. height: 400,
    32. width: '100%'
    33. });
    34.  
    35. demo1.addEventListener('click', function() {
    36. zingchart.exec('demo-chart', 'addobject', {
    37. 'type': 'label',
    38. 'update': false,
    39. 'data': {
    40. 'x': zcdocs.utils.rvalue(100, 400),
    41. 'y': zcdocs.utils.rvalue(50, 300),
    42. 'text': 'Label',
    43. 'background-color': '#f90',
    44. 'padding': 5
    45. }
    46. });
    47. zingchart.exec('demo-chart', 'addobject', {
    48. 'type': 'shape',
    49. 'update': false,
    50. 'data': [{
    51. 'x': zcdocs.utils.rvalue(100, 400),
    52. 'y': zcdocs.utils.rvalue(50, 300),
    53. 'type': 'circle',
    54. 'size': zcdocs.utils.rvalue(10, 20),
    55. 'label': {
    56. 'text': 'Shape 1'
    57. },
    58. 'background-color': '#f09'
    59. },
    60. {
    61. 'x': zcdocs.utils.rvalue(100, 400),
    62. 'y': zcdocs.utils.rvalue(50, 300),
    63. 'type': 'star5',
    64. 'size': zcdocs.utils.rvalue(10, 20),
    65. 'label': {
    66. 'text': 'Shape 2'
    67. },
    68. 'background-color': '#0f9'
    69. }
    70. ]
    71. });
    72. // MUST repaint objects
    73. let output = zingchart.exec('demo-chart', 'repaintobjects', {});
    74. zcdocs.demos.dump('repaintobjects', output);
    75. });
    76. reload.addEventListener('click', function() {
    77. zingchart.exec('demo-chart', 'reload');
    78. });
    79. </script>
    80. </body>
    81.  
    82. </html>
    1. <!DOCTYPE html>
    2. <html>
    3.  
    4. <head>
    5. <meta charset="utf-8">
    6. <title>ZingSoft Demo</title>
    7. <script src="//www.zingchart.com/scripts/zcDocs.js"></script>
    8. <link href='//www.zingchart.com/css/zcDocs.css' rel='stylesheet' type='text/css'>
    9.  
    10. <script src="https://cdn.zingchart.com/zingchart.min.js"></script>
    11. </head>
    12.  
    13. <body>
    14. <div id='demo-chart'></div>
    15. <button class='btn btn-danger' id='reload'>Reset</button>
    16. <button class='btn btn-info' id='demo1'>Run Demo 1</button>
    17. <pre id='output'></pre>
    18. </body>
    19.  
    20. </html>
    1.  
    1. var myConfig = {
    2. 'type': 'line',
    3. 'series': [{
    4. 'values': [11, 26, 7, 44, 11]
    5. }]
    6. };
    7.  
    8. zingchart.render({
    9. id: 'demo-chart',
    10. data: myConfig,
    11. height: 400,
    12. width: '100%'
    13. });
    14.  
    15. demo1.addEventListener('click', function() {
    16. zingchart.exec('demo-chart', 'addobject', {
    17. 'type': 'label',
    18. 'update': false,
    19. 'data': {
    20. 'x': zcdocs.utils.rvalue(100, 400),
    21. 'y': zcdocs.utils.rvalue(50, 300),
    22. 'text': 'Label',
    23. 'background-color': '#f90',
    24. 'padding': 5
    25. }
    26. });
    27. zingchart.exec('demo-chart', 'addobject', {
    28. 'type': 'shape',
    29. 'update': false,
    30. 'data': [{
    31. 'x': zcdocs.utils.rvalue(100, 400),
    32. 'y': zcdocs.utils.rvalue(50, 300),
    33. 'type': 'circle',
    34. 'size': zcdocs.utils.rvalue(10, 20),
    35. 'label': {
    36. 'text': 'Shape 1'
    37. },
    38. 'background-color': '#f09'
    39. },
    40. {
    41. 'x': zcdocs.utils.rvalue(100, 400),
    42. 'y': zcdocs.utils.rvalue(50, 300),
    43. 'type': 'star5',
    44. 'size': zcdocs.utils.rvalue(10, 20),
    45. 'label': {
    46. 'text': 'Shape 2'
    47. },
    48. 'background-color': '#0f9'
    49. }
    50. ]
    51. });
    52. // MUST repaint objects
    53. let output = zingchart.exec('demo-chart', 'repaintobjects', {});
    54. zcdocs.demos.dump('repaintobjects', output);
    55. });
    56. reload.addEventListener('click', function() {
    57. zingchart.exec('demo-chart', 'reload');
    58. });