• 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="http://www.zingchart.com/scripts/zcDocs.js"></script>
    8. <link href='http://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. <script nonce="undefined" src='https://cdn.zingchart.com/modules/zingchart-api-rules.min.js '></script>
    17.  
    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. <button class='btn btn-info' id='demo4'>Reload</button>
    22.  
    23. <pre id='output'></pre>
    24. <script>
    25. ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
    26. var myConfig = {
    27. 'type': 'bar',
    28. plot: {
    29. valueBox: {
    30. text: "hi"
    31. },
    32. },
    33. 'series': [{
    34. 'values': [75, 52, 55, 47, 60, 48]
    35. },
    36. {
    37. 'values': [51, 53, 47, 60, 48, 52]
    38. }
    39. ]
    40. };
    41. zingchart.render({
    42. id: 'demo-chart',
    43. data: myConfig,
    44. height: 400,
    45. width: '100%'
    46. });
    47. $('#demo1').bind('click', function() {
    48. zingchart.exec('demo-chart', 'addrule', {
    49. 'id': 'rule1',
    50. 'plotindex': 0,
    51. 'rule': '%node-value < 50',
    52. 'style': {
    53. backgroundColor: "black"
    54. }
    55. });
    56. });
    57. $('#demo2').bind('click', function() {
    58. zingchart.exec('demo-chart', 'updaterule', {
    59. 'id': 'rule1',
    60. 'plotindex': 0,
    61. 'style': {
    62. 'background-color': '#aaa #333'
    63. }
    64. });
    65. });
    66. $('#demo3').bind('click', function() {
    67. zingchart.exec('demo-chart', 'removerule', {
    68. 'id': 'rule1'
    69. });
    70. });
    71. $('#demo4').bind('click', function() {
    72. zingchart.exec('demo-chart', 'reload');
    73. });
    74. </script>
    75. </body>
    76.  
    77. </html>
    1. <!DOCTYPE html>
    2. <html>
    3.  
    4. <head>
    5. <meta charset="utf-8">
    6. <title>ZingSoft Demo</title>
    7. <script src="http://www.zingchart.com/scripts/zcDocs.js"></script>
    8. <link href='http://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. <script src='https://cdn.zingchart.com/modules/zingchart-api-rules.min.js '></script>
    16.  
    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. <button class='btn btn-info' id='demo4'>Reload</button>
    21.  
    22. <pre id='output'></pre>
    23. </body>
    24.  
    25. </html>
    1.  
    1. var myConfig = {
    2. 'type': 'bar',
    3. plot: {
    4. valueBox: {
    5. text: "hi"
    6. },
    7. },
    8. 'series': [{
    9. 'values': [75, 52, 55, 47, 60, 48]
    10. },
    11. {
    12. 'values': [51, 53, 47, 60, 48, 52]
    13. }
    14. ]
    15. };
    16. zingchart.render({
    17. id: 'demo-chart',
    18. data: myConfig,
    19. height: 400,
    20. width: '100%'
    21. });
    22. $('#demo1').bind('click', function() {
    23. zingchart.exec('demo-chart', 'addrule', {
    24. 'id': 'rule1',
    25. 'plotindex': 0,
    26. 'rule': '%node-value < 50',
    27. 'style': {
    28. backgroundColor: "black"
    29. }
    30. });
    31. });
    32. $('#demo2').bind('click', function() {
    33. zingchart.exec('demo-chart', 'updaterule', {
    34. 'id': 'rule1',
    35. 'plotindex': 0,
    36. 'style': {
    37. 'background-color': '#aaa #333'
    38. }
    39. });
    40. });
    41. $('#demo3').bind('click', function() {
    42. zingchart.exec('demo-chart', 'removerule', {
    43. 'id': 'rule1'
    44. });
    45. });
    46. $('#demo4').bind('click', function() {
    47. zingchart.exec('demo-chart', 'reload');
    48. });