• 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="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
    8. <script nonce="undefined" src="https://cdn.zingchart.com/zingchart.min.js"></script>
    9. <script nonce="undefined" src="https://cdn.zingchart.com/modules/zingchart-violin.min.js"></script>
    10. <style>
    11. html,
    12. body {
    13. margin: 0;
    14. padding: 0;
    15. width: 100%;
    16. height: 100%;
    17. }
    18.  
    19. .chart--container {
    20. min-height: 150px;
    21. width: 100%;
    22. height: 100%;
    23. }
    24.  
    25. .zc-ref {
    26. display: none;
    27. }
    28. </style>
    29. </head>
    30.  
    31. <body>
    32. <!-- CHART CONTAINER -->
    33.  
    34. <table>
    35. <tr>
    36. <td>Trim:</td>
    37. <td><input type="checkbox" id="trim" checked /></td>
    38. </tr>
    39. <tr>
    40. <td>Jitter:</td>
    41. <td><input type="range" min="0.5" max="2.5" step="0.05" value="1.25" id="jitter" /></td>
    42. </tr>
    43. <tr>
    44. <td>Rounding Factor:</td>
    45. <td><input type="range" min="0" max="2" step="0.1" value="1" id="roundingFactor" /></td>
    46. </tr>
    47. <tr>
    48. <td>Mean Factor:</td>
    49. <td><input type="range" min="1" max="3" step="1" value="2" id="meanFactor" /></td>
    50. </tr>
    51. </table>
    52.  
    53. <div id="myChart" class="chart--container">
    54. <a class="zc-ref" href="https://www.zingchart.com/">Powered by ZingChart</a>
    55. </div>
    56. <script>
    57. ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
    58. window.addEventListener('load', () => {
    59.  
    60. let chartConfig = {
    61. type: 'scatter',
    62. options: {
    63. violin: {
    64. trim: 0,
    65. jitter: 1.25,
    66. roundingFactor: 1,
    67. meanFactor: 2,
    68. // general styling
    69. style: {
    70. backgroundColor: '#ff9900',
    71. lineWidth: 1
    72. }
    73. }
    74. },
    75. scaleX: {
    76. values: '-1:3:1',
    77. labels: [' ', '0.5', '1', '2', ' '],
    78. offset: 0
    79. },
    80. scaleY: {
    81. offset: 20,
    82. minValue: 0,
    83. maxValue: 40
    84. },
    85. plotarea: {
    86. margin: 'dynamic'
    87. },
    88. tooltip: {
    89. text: '%data-key / %data-value'
    90. },
    91. legend: {},
    92. plot: {
    93. aspect: 'violin',
    94. marker: {
    95. borderWidth: 1,
    96. borderColor: '#333',
    97. shadow: false,
    98. size: 3
    99. }
    100. },
    101. series: [{
    102. text: 'Sample A',
    103. // specific styling
    104. violin: {
    105. backgroundColor: '#900',
    106. alpha: 1,
    107. alphaArea: 0.2,
    108. lineWidth: 3,
    109. lineColor: '#090'
    110. },
    111. values: [
    112. [0, 4.2],
    113. [0, 11.5],
    114. [0, 7.3],
    115. [0, 5.8],
    116. [0, 6.4],
    117. [0, 10],
    118. [0, 11.2],
    119. [0, 11.2],
    120. [0, 5.2],
    121. [0, 7],
    122. [0, 15.2],
    123. [0, 21.5],
    124. [0, 17.6],
    125. [0, 9.7],
    126. [0, 14.5],
    127. [0, 10],
    128. [0, 8.2],
    129. [0, 9.4],
    130. [0, 16.5],
    131. [0, 9.7]
    132. ]
    133. },
    134. {
    135. text: 'Sample B',
    136. values: [
    137. [1, 16.5],
    138. [1, 16.5],
    139. [1, 15.2],
    140. [1, 17.3],
    141. [1, 22.5],
    142. [1, 17.3],
    143. [1, 13.6],
    144. [1, 14.5],
    145. [1, 18.8],
    146. [1, 15.5],
    147. [1, 19.7],
    148. [1, 23.3],
    149. [1, 23.6],
    150. [1, 26.4],
    151. [1, 20],
    152. [1, 25.2],
    153. [1, 25.8],
    154. [1, 21.2],
    155. [1, 14.5],
    156. [1, 27.3]
    157. ]
    158. },
    159. {
    160. text: 'Sample C',
    161. values: [
    162. [2, 23.6],
    163. [2, 18.5],
    164. [2, 33.9],
    165. [2, 25.5],
    166. [2, 26.4],
    167. [2, 32.5],
    168. [2, 26.7],
    169. [2, 21.5],
    170. [2, 23.3],
    171. [2, 29.5],
    172. [2, 25.5],
    173. [2, 26.4],
    174. [2, 22.4],
    175. [2, 24.5],
    176. [2, 24.8],
    177. [2, 30.9],
    178. [2, 26.4],
    179. [2, 27.3],
    180. [2, 29.4],
    181. [2, 23]
    182. ]
    183. }
    184. ]
    185. };
    186.  
    187. window.renderChart = function() {
    188. chartConfig.options.violin.trim = ($('#trim').prop('checked')) ? 0 : 1;
    189. chartConfig.options.violin.jitter = $('#jitter').val();
    190. chartConfig.options.violin.meanFactor = $('#meanFactor').val();
    191. chartConfig.options.violin.roundingFactor = $('#roundingFactor').val();
    192.  
    193. zingchart.exec('myChart', 'destroy');
    194. zingchart.render({
    195. id: 'myChart',
    196. width: '100%',
    197. height: 450,
    198. output: 'svg',
    199. data: chartConfig,
    200. modules: 'violin'
    201. });
    202.  
    203. };
    204.  
    205. window.renderChart();
    206.  
    207. $('input').on('change', function() {
    208. window.renderChart();
    209. });
    210.  
    211.  
    212.  
    213. });
    214. </script>
    215. </body>
    216.  
    217. </html>
    1. <!DOCTYPE html>
    2. <html>
    3.  
    4. <head>
    5. <meta charset="utf-8">
    6. <title>ZingSoft Demo</title>
    7. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
    8. <script src="https://cdn.zingchart.com/zingchart.min.js"></script>
    9. <script src="https://cdn.zingchart.com/modules/zingchart-violin.min.js"></script>
    10. </head>
    11.  
    12. <body>
    13. <!-- CHART CONTAINER -->
    14.  
    15. <table>
    16. <tr>
    17. <td>Trim:</td>
    18. <td><input type="checkbox" id="trim" checked /></td>
    19. </tr>
    20. <tr>
    21. <td>Jitter:</td>
    22. <td><input type="range" min="0.5" max="2.5" step="0.05" value="1.25" id="jitter" /></td>
    23. </tr>
    24. <tr>
    25. <td>Rounding Factor:</td>
    26. <td><input type="range" min="0" max="2" step="0.1" value="1" id="roundingFactor" /></td>
    27. </tr>
    28. <tr>
    29. <td>Mean Factor:</td>
    30. <td><input type="range" min="1" max="3" step="1" value="2" id="meanFactor" /></td>
    31. </tr>
    32. </table>
    33.  
    34. <div id="myChart" class="chart--container">
    35. <a class="zc-ref" href="https://www.zingchart.com/">Powered by ZingChart</a>
    36. </div>
    37. </body>
    38.  
    39. </html>
    1. html,
    2. body {
    3. margin: 0;
    4. padding: 0;
    5. width: 100%;
    6. height: 100%;
    7. }
    8.  
    9. .chart--container {
    10. min-height: 150px;
    11. width: 100%;
    12. height: 100%;
    13. }
    14.  
    15. .zc-ref {
    16. display: none;
    17. }
    1. window.addEventListener('load', () => {
    2.  
    3. let chartConfig = {
    4. type: 'scatter',
    5. options: {
    6. violin: {
    7. trim: 0,
    8. jitter: 1.25,
    9. roundingFactor: 1,
    10. meanFactor: 2,
    11. // general styling
    12. style: {
    13. backgroundColor: '#ff9900',
    14. lineWidth: 1
    15. }
    16. }
    17. },
    18. scaleX: {
    19. values: '-1:3:1',
    20. labels: [' ', '0.5', '1', '2', ' '],
    21. offset: 0
    22. },
    23. scaleY: {
    24. offset: 20,
    25. minValue: 0,
    26. maxValue: 40
    27. },
    28. plotarea: {
    29. margin: 'dynamic'
    30. },
    31. tooltip: {
    32. text: '%data-key / %data-value'
    33. },
    34. legend: {},
    35. plot: {
    36. aspect: 'violin',
    37. marker: {
    38. borderWidth: 1,
    39. borderColor: '#333',
    40. shadow: false,
    41. size: 3
    42. }
    43. },
    44. series: [{
    45. text: 'Sample A',
    46. // specific styling
    47. violin: {
    48. backgroundColor: '#900',
    49. alpha: 1,
    50. alphaArea: 0.2,
    51. lineWidth: 3,
    52. lineColor: '#090'
    53. },
    54. values: [
    55. [0, 4.2],
    56. [0, 11.5],
    57. [0, 7.3],
    58. [0, 5.8],
    59. [0, 6.4],
    60. [0, 10],
    61. [0, 11.2],
    62. [0, 11.2],
    63. [0, 5.2],
    64. [0, 7],
    65. [0, 15.2],
    66. [0, 21.5],
    67. [0, 17.6],
    68. [0, 9.7],
    69. [0, 14.5],
    70. [0, 10],
    71. [0, 8.2],
    72. [0, 9.4],
    73. [0, 16.5],
    74. [0, 9.7]
    75. ]
    76. },
    77. {
    78. text: 'Sample B',
    79. values: [
    80. [1, 16.5],
    81. [1, 16.5],
    82. [1, 15.2],
    83. [1, 17.3],
    84. [1, 22.5],
    85. [1, 17.3],
    86. [1, 13.6],
    87. [1, 14.5],
    88. [1, 18.8],
    89. [1, 15.5],
    90. [1, 19.7],
    91. [1, 23.3],
    92. [1, 23.6],
    93. [1, 26.4],
    94. [1, 20],
    95. [1, 25.2],
    96. [1, 25.8],
    97. [1, 21.2],
    98. [1, 14.5],
    99. [1, 27.3]
    100. ]
    101. },
    102. {
    103. text: 'Sample C',
    104. values: [
    105. [2, 23.6],
    106. [2, 18.5],
    107. [2, 33.9],
    108. [2, 25.5],
    109. [2, 26.4],
    110. [2, 32.5],
    111. [2, 26.7],
    112. [2, 21.5],
    113. [2, 23.3],
    114. [2, 29.5],
    115. [2, 25.5],
    116. [2, 26.4],
    117. [2, 22.4],
    118. [2, 24.5],
    119. [2, 24.8],
    120. [2, 30.9],
    121. [2, 26.4],
    122. [2, 27.3],
    123. [2, 29.4],
    124. [2, 23]
    125. ]
    126. }
    127. ]
    128. };
    129.  
    130. window.renderChart = function() {
    131. chartConfig.options.violin.trim = ($('#trim').prop('checked')) ? 0 : 1;
    132. chartConfig.options.violin.jitter = $('#jitter').val();
    133. chartConfig.options.violin.meanFactor = $('#meanFactor').val();
    134. chartConfig.options.violin.roundingFactor = $('#roundingFactor').val();
    135.  
    136. zingchart.exec('myChart', 'destroy');
    137. zingchart.render({
    138. id: 'myChart',
    139. width: '100%',
    140. height: 450,
    141. output: 'svg',
    142. data: chartConfig,
    143. modules: 'violin'
    144. });
    145.  
    146. };
    147.  
    148. window.renderChart();
    149.  
    150. $('input').on('change', function() {
    151. window.renderChart();
    152. });
    153.  
    154.  
    155.  
    156. });