• 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/modules/zingchart-api-rules.min.js'></script>
    11.  
    12. <script nonce="undefined" src="https://cdn.zingchart.com/zingchart.min.js"></script>
    13. <style></style>
    14. </head>
    15.  
    16. <body>
    17. <div id='demo-chart'></div>
    18. <button class='btn btn-info' id='demo1'>Add Rule</button>
    19. <button class='btn btn-info' id='demo2'>Update Rule</button>
    20. <button class='btn btn-info' id='demo3'>Remove Rule</button>
    21. <pre id='output'></pre>
    22. <script>
    23. ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
    24. var myConfig = {
    25. 'type': 'bar',
    26. 'series': [{
    27. 'values': [75, 52, 55, 47, 60, 48]
    28. },
    29. {
    30. 'values': [51, 53, 47, 60, 48, 52]
    31. }
    32. ]
    33. };
    34.  
    35. zingchart.render({
    36. id: 'demo-chart',
    37. data: myConfig,
    38. height: 400,
    39. width: '100%'
    40. });
    41.  
    42. demo1.addEventListener('click', function() {
    43. let output = zingchart.exec('demo-chart', 'addrule', {
    44. 'id': 'rule1',
    45. 'plotindex': 0,
    46. 'rule': '%node-value < 50',
    47. 'style': {
    48. 'background-color': '#424242'
    49. }
    50. });
    51. zcdocs.demos.dump('addrule', output);
    52. });
    53. demo2.addEventListener('click', function() {
    54. let output = zingchart.exec('demo-chart', 'updaterule', {
    55. 'id': 'rule1',
    56. 'plotindex': 0,
    57. 'style': {
    58. 'background-color': '#aaa #333'
    59. }
    60. });
    61. zcdocs.demos.dump('updaterule', output);
    62. });
    63. demo3.addEventListener('click', function() {
    64. let output = zingchart.exec('demo-chart', 'removerule', {
    65. 'id': 'rule1'
    66. });
    67. zcdocs.demos.dump('removerule', output);
    68. });
    69. </script>
    70. </body>
    71.  
    72. </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/modules/zingchart-api-rules.min.js'></script>
    11.  
    12. <script src="https://cdn.zingchart.com/zingchart.min.js"></script>
    13. </head>
    14.  
    15. <body>
    16. <div id='demo-chart'></div>
    17. <button class='btn btn-info' id='demo1'>Add Rule</button>
    18. <button class='btn btn-info' id='demo2'>Update Rule</button>
    19. <button class='btn btn-info' id='demo3'>Remove Rule</button>
    20. <pre id='output'></pre>
    21. </body>
    22.  
    23. </html>
    1.  
    1. var myConfig = {
    2. 'type': 'bar',
    3. 'series': [{
    4. 'values': [75, 52, 55, 47, 60, 48]
    5. },
    6. {
    7. 'values': [51, 53, 47, 60, 48, 52]
    8. }
    9. ]
    10. };
    11.  
    12. zingchart.render({
    13. id: 'demo-chart',
    14. data: myConfig,
    15. height: 400,
    16. width: '100%'
    17. });
    18.  
    19. demo1.addEventListener('click', function() {
    20. let output = zingchart.exec('demo-chart', 'addrule', {
    21. 'id': 'rule1',
    22. 'plotindex': 0,
    23. 'rule': '%node-value < 50',
    24. 'style': {
    25. 'background-color': '#424242'
    26. }
    27. });
    28. zcdocs.demos.dump('addrule', output);
    29. });
    30. demo2.addEventListener('click', function() {
    31. let output = zingchart.exec('demo-chart', 'updaterule', {
    32. 'id': 'rule1',
    33. 'plotindex': 0,
    34. 'style': {
    35. 'background-color': '#aaa #333'
    36. }
    37. });
    38. zcdocs.demos.dump('updaterule', output);
    39. });
    40. demo3.addEventListener('click', function() {
    41. let output = zingchart.exec('demo-chart', 'removerule', {
    42. 'id': 'rule1'
    43. });
    44. zcdocs.demos.dump('removerule', output);
    45. });