• Edit
  • Download
    1. <!doctype html>
    2. <html class="zc-html">
    3.  
    4. <head>
    5. <meta charset="utf-8">
    6. <title>ZingSoft Demo</title>
    7. <script nonce="undefined" src="https://cdn.zingchart.com/zingchart.min.js"></script>
    8. <style>
    9. .zc-body {
    10. background: #fff;
    11. }
    12.  
    13. .chart--container {
    14. height: 100%;
    15. width: 100%;
    16. min-height: 530px;
    17. }
    18.  
    19. .zc-ref {
    20. display: none;
    21. }
    22. </style>
    23. </head>
    24.  
    25. <body class="zc-body">
    26. <div id="myChart" class="chart--container">
    27. <a href="https://www.zingchart.com/" rel="noopener" class="zc-ref">Powered by ZingChart</a>
    28. </div>
    29. <script>
    30. ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"]; // HELPER METHODS
    31. // -----------------------------
    32. window.vectorplot_data = function(p) {
    33. let x, y, length, direction, color;
    34. let vdata = [];
    35. let szx = [-100, 100],
    36. szy = [-50, 50];
    37. for (x = szx[0] + 5; x < szx[1]; x += 5) {
    38. for (y = szy[0] + 5; y < szy[1]; y += 5) {
    39. length = 50 + Math.abs(Math.round(Math.sin(((50 - x) * y) / 3000) * Math.cos((x + y) / 200) * 150));
    40. direction = Math.round(Math.sin(((50 - x) * y) / 5000) * Math.cos((x + y) / 400) * 360);
    41. color = '#000000';
    42. if (length >= 50 && length < 70) {
    43. color = '#00FF00';
    44. } else if (length >= 70 && length < 100) {
    45. color = '#FFFF00';
    46. } else if (length >= 100 && length < 120) {
    47. color = '#FF9900';
    48. } else if (length >= 120 && length < 150) {
    49. color = '#FF0000';
    50. } else if (length >= 150 && length < 170) {
    51. color = '#800080';
    52. } else {
    53. color = '#0000FF';
    54. }
    55. vdata.push([
    56. x,
    57. y,
    58. length,
    59. direction,
    60. color
    61. ]);
    62. }
    63. }
    64. return vdata;
    65. };
    66.  
    67. // DEFINE DATA
    68. // -----------------------------
    69. let vData = vectorplot_data(1, 2, 3);
    70.  
    71. // CHART CONFIG
    72. // -----------------------------
    73. let chartConfig = {
    74. globals: {
    75. fontFamily: 'Lucida Sans Unicode'
    76. },
    77. type: 'vectorplot',
    78. plotarea: {
    79. margin: 'dynamic'
    80. },
    81. scaleX: {
    82. values: '-100:100:10',
    83. guide: {
    84. lineStyle: 'solid'
    85. },
    86. offset: 0
    87. },
    88. scaleY: {
    89. values: '-50:50:10',
    90. guide: {
    91. lineStyle: 'solid'
    92. },
    93. offset: 0,
    94. },
    95. options: {
    96. arrow: {
    97. minLength: '6px',
    98. maxLength: '12px',
    99. style: {
    100. size: '3px'
    101. }
    102. },
    103. data: vData
    104. },
    105. tooltip: {
    106. align: 'left',
    107. alpha: 0.85,
    108. backgroundColor: '#fff',
    109. borderColor: '#999',
    110. borderRadius: '7px',
    111. borderWidth: '1px',
    112. callout: true,
    113. calloutWidth: '12px',
    114. color: '#000',
    115. fontSize: '13px',
    116. padding: '15px',
    117. placement: 'vertical'
    118. }
    119. };
    120.  
    121. // RENDER CHARTS
    122. // -----------------------------
    123. zingchart.render({
    124. id: 'myChart',
    125. data: chartConfig,
    126. height: '100%',
    127. width: '100%'
    128. });
    129. </script>
    130. </body>
    131.  
    132. </html>
    1. <!doctype html>
    2. <html class="zc-html">
    3.  
    4. <head>
    5. <meta charset="utf-8">
    6. <title>ZingSoft Demo</title>
    7. <script src="https://cdn.zingchart.com/zingchart.min.js"></script>
    8. </head>
    9.  
    10. <body class="zc-body">
    11. <div id="myChart" class="chart--container">
    12. <a href="https://www.zingchart.com/" rel="noopener" class="zc-ref">Powered by ZingChart</a>
    13. </div>
    14. </body>
    15.  
    16. </html>
    1. .zc-body {
    2. background: #fff;
    3. }
    4.  
    5. .chart--container {
    6. height: 100%;
    7. width: 100%;
    8. min-height: 530px;
    9. }
    10.  
    11. .zc-ref {
    12. display: none;
    13. }
    1. // HELPER METHODS
    2. // -----------------------------
    3. window.vectorplot_data = function(p) {
    4. let x, y, length, direction, color;
    5. let vdata = [];
    6. let szx = [-100, 100],
    7. szy = [-50, 50];
    8. for (x = szx[0] + 5; x < szx[1]; x += 5) {
    9. for (y = szy[0] + 5; y < szy[1]; y += 5) {
    10. length = 50 + Math.abs(Math.round(Math.sin(((50 - x) * y) / 3000) * Math.cos((x + y) / 200) * 150));
    11. direction = Math.round(Math.sin(((50 - x) * y) / 5000) * Math.cos((x + y) / 400) * 360);
    12. color = '#000000';
    13. if (length >= 50 && length < 70) {
    14. color = '#00FF00';
    15. } else if (length >= 70 && length < 100) {
    16. color = '#FFFF00';
    17. } else if (length >= 100 && length < 120) {
    18. color = '#FF9900';
    19. } else if (length >= 120 && length < 150) {
    20. color = '#FF0000';
    21. } else if (length >= 150 && length < 170) {
    22. color = '#800080';
    23. } else {
    24. color = '#0000FF';
    25. }
    26. vdata.push([
    27. x,
    28. y,
    29. length,
    30. direction,
    31. color
    32. ]);
    33. }
    34. }
    35. return vdata;
    36. };
    37.  
    38. // DEFINE DATA
    39. // -----------------------------
    40. let vData = vectorplot_data(1, 2, 3);
    41.  
    42. // CHART CONFIG
    43. // -----------------------------
    44. let chartConfig = {
    45. globals: {
    46. fontFamily: 'Lucida Sans Unicode'
    47. },
    48. type: 'vectorplot',
    49. plotarea: {
    50. margin: 'dynamic'
    51. },
    52. scaleX: {
    53. values: '-100:100:10',
    54. guide: {
    55. lineStyle: 'solid'
    56. },
    57. offset: 0
    58. },
    59. scaleY: {
    60. values: '-50:50:10',
    61. guide: {
    62. lineStyle: 'solid'
    63. },
    64. offset: 0,
    65. },
    66. options: {
    67. arrow: {
    68. minLength: '6px',
    69. maxLength: '12px',
    70. style: {
    71. size: '3px'
    72. }
    73. },
    74. data: vData
    75. },
    76. tooltip: {
    77. align: 'left',
    78. alpha: 0.85,
    79. backgroundColor: '#fff',
    80. borderColor: '#999',
    81. borderRadius: '7px',
    82. borderWidth: '1px',
    83. callout: true,
    84. calloutWidth: '12px',
    85. color: '#000',
    86. fontSize: '13px',
    87. padding: '15px',
    88. placement: 'vertical'
    89. }
    90. };
    91.  
    92. // RENDER CHARTS
    93. // -----------------------------
    94. zingchart.render({
    95. id: 'myChart',
    96. data: chartConfig,
    97. height: '100%',
    98. width: '100%'
    99. });