• 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. margin-left: 10%;
    20. height: 100%;
    21. min-height: 150px;
    22. }
    23.  
    24. .zc-ref {
    25. display: none;
    26. }
    27.  
    28. .controls {
    29. z-index: 1000;
    30. position: fixed;
    31. top: 0;
    32. left: 0;
    33. bottom: 0;
    34. width: 10%;
    35. background-color: #9e9e9e;
    36. padding: 15px;
    37. }
    38.  
    39. .controls label {
    40. width: 75px;
    41. display: inline-block;
    42. }
    43.  
    44. .controls input {
    45. margin-bottom: 5px;
    46. width: 90%;
    47. }
    48. </style>
    49. </head>
    50.  
    51. <body>
    52. <div class="controls">
    53.  
    54. <label for="a-value">|A|</label>
    55. <input id="a-value" name="a-value" type="number" value="16" min=1>
    56.  
    57. <label for="b-value">|B|</label>
    58. <input id="b-value" name="b-value" type="number" value="16" min=1>
    59.  
    60. <label for="c-value">|C|</label>
    61. <input id="c-value" name="c-value" type="number" value="12" min=1>
    62.  
    63. <label for="ab-value">|A∩B|</label>
    64. <input id="ab-value" name="ab-value" type="number" value="4" min=1>
    65.  
    66. <label for="bc-value">|B∩C|</label>
    67. <input id="bc-value" name="bc-value" type="number" value="4" min=1>
    68.  
    69. <label for="ca-value">|C∩A|</label>
    70. <input id="ca-value" name="ca-value" type="number" value="3" min=1>
    71.  
    72. <p><strong>Note: </strong> |A∩B∩C| is calculated by ZingChart</p>
    73. <hr>
    74. <button onclick="window.parent.location.reload()">Reload Data</button>
    75. <!--<label for="abc-value"></label>
    76. <input id="abc-value" name="abc-value" type="number" value="2" disabled>
    77. -->
    78.  
    79. </div>
    80. <div id="myChart"><a class="zc-ref" href="https://www.zingchart.com">Powered by ZingChart</a></div>
    81. <script>
    82. ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
    83. var myConfig = {
    84. "type": "venn",
    85. "plot": {
    86. "value-box": {
    87. "text": "%t:<br>%v",
    88. "joined": {
    89. "text": "Joined:<br>%joined-value"
    90. },
    91. "shared": {
    92. "text": "Shared:<br>%shared-value"
    93. }
    94. }
    95. },
    96. "series": [{
    97. "values": [16],
    98. "join": [4],
    99. "text": "Set One"
    100. },
    101. {
    102. "values": [16],
    103. "join": [3],
    104. "text": "Set Two"
    105. },
    106. {
    107. "values": [12],
    108. "join": [4],
    109. "text": "Set Three"
    110. }
    111. ]
    112. };
    113.  
    114. zingchart.render({
    115. id: 'myChart',
    116. data: myConfig,
    117. height: "100%",
    118. width: "100%"
    119. });
    120.  
    121. function updateChart() {
    122. zingchart.exec('myChart', 'setdata', {
    123. data: myConfig
    124. });
    125. }
    126.  
    127. function updateChartValue(updateValue, seriesIndex, valuesIndex) {
    128. if (updateValue <= 0)
    129. return false;
    130. myConfig.series[seriesIndex].values[valuesIndex] = updateValue;
    131. }
    132.  
    133. function updateChartJoin(updateValue, seriesIndex, valuesIndex) {
    134. if (updateValue <= 0)
    135. return false;
    136. myConfig.series[seriesIndex].join[valuesIndex] = updateValue;
    137. }
    138.  
    139. document.getElementById('a-value').addEventListener('input', function(e) {
    140. updateChartValue(Number(e.target.value), 0, 0);
    141. updateChart();
    142. });
    143. document.getElementById('b-value').addEventListener('input', function(e) {
    144. updateChartValue(Number(e.target.value), 1, 0);
    145. updateChart();
    146. });
    147. document.getElementById('c-value').addEventListener('input', function(e) {
    148. updateChartValue(Number(e.target.value), 2, 0);
    149. updateChart();
    150. });
    151. document.getElementById('ab-value').addEventListener('input', function(e) {
    152. updateChartJoin(Number(e.target.value), 0, 0);
    153. updateChart();
    154. });
    155. document.getElementById('bc-value').addEventListener('input', function(e) {
    156. updateChartJoin(Number(e.target.value), 1, 0);
    157. updateChart();
    158. });
    159. document.getElementById('ca-value').addEventListener('input', function(e) {
    160. updateChartJoin(Number(e.target.value), 2, 0);
    161. updateChart();
    162. });
    163. </script>
    164. </body>
    165.  
    166. </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. <div class="controls">
    13.  
    14. <label for="a-value">|A|</label>
    15. <input id="a-value" name="a-value" type="number" value="16" min=1>
    16.  
    17. <label for="b-value">|B|</label>
    18. <input id="b-value" name="b-value" type="number" value="16" min=1>
    19.  
    20. <label for="c-value">|C|</label>
    21. <input id="c-value" name="c-value" type="number" value="12" min=1>
    22.  
    23. <label for="ab-value">|A∩B|</label>
    24. <input id="ab-value" name="ab-value" type="number" value="4" min=1>
    25.  
    26. <label for="bc-value">|B∩C|</label>
    27. <input id="bc-value" name="bc-value" type="number" value="4" min=1>
    28.  
    29. <label for="ca-value">|C∩A|</label>
    30. <input id="ca-value" name="ca-value" type="number" value="3" min=1>
    31.  
    32. <p><strong>Note: </strong> |A∩B∩C| is calculated by ZingChart</p>
    33. <hr>
    34. <button onclick="window.parent.location.reload()">Reload Data</button>
    35. <!--<label for="abc-value"></label>
    36. <input id="abc-value" name="abc-value" type="number" value="2" disabled>
    37. -->
    38.  
    39. </div>
    40. <div id="myChart"><a class="zc-ref" href="https://www.zingchart.com">Powered by ZingChart</a></div>
    41. </body>
    42.  
    43. </html>
    1. html,
    2. body {
    3. height: 100%;
    4. width: 100%;
    5. margin: 0;
    6. padding: 0;
    7. }
    8.  
    9. #myChart {
    10. margin-left: 10%;
    11. height: 100%;
    12. min-height: 150px;
    13. }
    14.  
    15. .zc-ref {
    16. display: none;
    17. }
    18.  
    19. .controls {
    20. z-index: 1000;
    21. position: fixed;
    22. top: 0;
    23. left: 0;
    24. bottom: 0;
    25. width: 10%;
    26. background-color: #9e9e9e;
    27. padding: 15px;
    28. }
    29.  
    30. .controls label {
    31. width: 75px;
    32. display: inline-block;
    33. }
    34.  
    35. .controls input {
    36. margin-bottom: 5px;
    37. width: 90%;
    38. }
    1. var myConfig = {
    2. "type": "venn",
    3. "plot": {
    4. "value-box": {
    5. "text": "%t:<br>%v",
    6. "joined": {
    7. "text": "Joined:<br>%joined-value"
    8. },
    9. "shared": {
    10. "text": "Shared:<br>%shared-value"
    11. }
    12. }
    13. },
    14. "series": [{
    15. "values": [16],
    16. "join": [4],
    17. "text": "Set One"
    18. },
    19. {
    20. "values": [16],
    21. "join": [3],
    22. "text": "Set Two"
    23. },
    24. {
    25. "values": [12],
    26. "join": [4],
    27. "text": "Set Three"
    28. }
    29. ]
    30. };
    31.  
    32. zingchart.render({
    33. id: 'myChart',
    34. data: myConfig,
    35. height: "100%",
    36. width: "100%"
    37. });
    38.  
    39. function updateChart() {
    40. zingchart.exec('myChart', 'setdata', {
    41. data: myConfig
    42. });
    43. }
    44.  
    45. function updateChartValue(updateValue, seriesIndex, valuesIndex) {
    46. if (updateValue <= 0)
    47. return false;
    48. myConfig.series[seriesIndex].values[valuesIndex] = updateValue;
    49. }
    50.  
    51. function updateChartJoin(updateValue, seriesIndex, valuesIndex) {
    52. if (updateValue <= 0)
    53. return false;
    54. myConfig.series[seriesIndex].join[valuesIndex] = updateValue;
    55. }
    56.  
    57. document.getElementById('a-value').addEventListener('input', function(e) {
    58. updateChartValue(Number(e.target.value), 0, 0);
    59. updateChart();
    60. });
    61. document.getElementById('b-value').addEventListener('input', function(e) {
    62. updateChartValue(Number(e.target.value), 1, 0);
    63. updateChart();
    64. });
    65. document.getElementById('c-value').addEventListener('input', function(e) {
    66. updateChartValue(Number(e.target.value), 2, 0);
    67. updateChart();
    68. });
    69. document.getElementById('ab-value').addEventListener('input', function(e) {
    70. updateChartJoin(Number(e.target.value), 0, 0);
    71. updateChart();
    72. });
    73. document.getElementById('bc-value').addEventListener('input', function(e) {
    74. updateChartJoin(Number(e.target.value), 1, 0);
    75. updateChart();
    76. });
    77. document.getElementById('ca-value').addEventListener('input', function(e) {
    78. updateChartJoin(Number(e.target.value), 2, 0);
    79. updateChart();
    80. });