• 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-html,
    10. .zc-body {
    11. margin: 0;
    12. padding: 0;
    13. width: 100%;
    14. height: 100%;
    15. background-color: #fff;
    16. }
    17.  
    18. .chart--container {
    19. height: 100%;
    20. width: 100%;
    21. min-height: 530px;
    22. }
    23.  
    24. .zc-ref {
    25. display: none;
    26. }
    27. </style>
    28. </head>
    29.  
    30. <body class="zc-body">
    31. <div id="zc" class="chart--container">
    32. <a href="https://www.zingchart.com/" rel="noopener" class="zc-ref">Powered by ZingChart</a>
    33. </div>
    34. <script>
    35. ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"];
    36. var graph = function(color, label, data, value) {
    37. return {
    38. type: 'ring',
    39. backgroundColor: '#fff',
    40. plotarea: {
    41. // Margin around each ring chart
    42. margin: '0 50'
    43. },
    44. plot: {
    45. slice: '80%', // Ring width,
    46. detach: false, // Prevent ring piece from detaching on click
    47. valueBox: [{
    48. // Percentage text
    49. type: 'first',
    50. text: value || `${parseInt(data[0]/(data[0]+data[1])*100)}%`,
    51. connected: false,
    52. fontColor: color,
    53. fontSize: '35px',
    54. placement: 'center',
    55. visible: true,
    56. offsetY: '-65px',
    57. },
    58. {
    59. // Label text
    60. type: 'first',
    61. text: label,
    62. connected: false,
    63. fontColor: '#718096',
    64. fontSize: '20px',
    65. placement: 'center',
    66. visible: true,
    67. offsetY: '-25px',
    68. }
    69. ],
    70. animation: {
    71. // Animation effect
    72. effect: 3,
    73. method: 0,
    74. speed: 300,
    75. sequence: 1
    76. }
    77. },
    78. labels: [{
    79. // Fraction text
    80. text: `${data[0]}/${data[0]+data[1]}`,
    81. fontColor: color,
    82. fontSize: '15px',
    83. fontWeight: 100,
    84. x: '70%',
    85. y: '10%',
    86. }],
    87. scaleR: {
    88. // Set to half ring
    89. refAngle: 180,
    90. aperture: 180
    91. },
    92. tooltip: {
    93. // Hide tooltip
    94. visible: false
    95. },
    96. series: [{
    97. // First part of the ring (colored)
    98. values: [data[0]],
    99. backgroundColor: color,
    100. },
    101. {
    102. // Remainder of ring
    103. values: [data[1]],
    104. backgroundColor: '#EDF2F7',
    105. }
    106. ]
    107. };
    108. };
    109.  
    110. var g1 = graph('#1EBAED', 'Participation', [5, 2]);
    111. var g2 = graph('#29CB6C', 'Goals met', [3, 4]);
    112. var g3 = graph('#E7183D', 'Blocked', [0, 7]);
    113. var g4 = graph('#5352ED', 'Mood', [1, 7], '7.1/10');
    114.  
    115. var myConfig = {
    116. layout: 'horizontal', // Layout ring charts horizontally
    117. graphset: [g1, g2, g3, g4],
    118. };
    119.  
    120. zingchart.render({
    121. id: "zc",
    122. height: '100%',
    123. width: '100%',
    124. data: myConfig,
    125. });
    126. </script>
    127. </body>
    128.  
    129. </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="zc" 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-html,
    2. .zc-body {
    3. margin: 0;
    4. padding: 0;
    5. width: 100%;
    6. height: 100%;
    7. background-color: #fff;
    8. }
    9.  
    10. .chart--container {
    11. height: 100%;
    12. width: 100%;
    13. min-height: 530px;
    14. }
    15.  
    16. .zc-ref {
    17. display: none;
    18. }
    1. var graph = function(color, label, data, value) {
    2. return {
    3. type: 'ring',
    4. backgroundColor: '#fff',
    5. plotarea: {
    6. // Margin around each ring chart
    7. margin: '0 50'
    8. },
    9. plot: {
    10. slice: '80%', // Ring width,
    11. detach: false, // Prevent ring piece from detaching on click
    12. valueBox: [{
    13. // Percentage text
    14. type: 'first',
    15. text: value || `${parseInt(data[0]/(data[0]+data[1])*100)}%`,
    16. connected: false,
    17. fontColor: color,
    18. fontSize: '35px',
    19. placement: 'center',
    20. visible: true,
    21. offsetY: '-65px',
    22. },
    23. {
    24. // Label text
    25. type: 'first',
    26. text: label,
    27. connected: false,
    28. fontColor: '#718096',
    29. fontSize: '20px',
    30. placement: 'center',
    31. visible: true,
    32. offsetY: '-25px',
    33. }
    34. ],
    35. animation: {
    36. // Animation effect
    37. effect: 3,
    38. method: 0,
    39. speed: 300,
    40. sequence: 1
    41. }
    42. },
    43. labels: [{
    44. // Fraction text
    45. text: `${data[0]}/${data[0]+data[1]}`,
    46. fontColor: color,
    47. fontSize: '15px',
    48. fontWeight: 100,
    49. x: '70%',
    50. y: '10%',
    51. }],
    52. scaleR: {
    53. // Set to half ring
    54. refAngle: 180,
    55. aperture: 180
    56. },
    57. tooltip: {
    58. // Hide tooltip
    59. visible: false
    60. },
    61. series: [{
    62. // First part of the ring (colored)
    63. values: [data[0]],
    64. backgroundColor: color,
    65. },
    66. {
    67. // Remainder of ring
    68. values: [data[1]],
    69. backgroundColor: '#EDF2F7',
    70. }
    71. ]
    72. };
    73. };
    74.  
    75. var g1 = graph('#1EBAED', 'Participation', [5, 2]);
    76. var g2 = graph('#29CB6C', 'Goals met', [3, 4]);
    77. var g3 = graph('#E7183D', 'Blocked', [0, 7]);
    78. var g4 = graph('#5352ED', 'Mood', [1, 7], '7.1/10');
    79.  
    80. var myConfig = {
    81. layout: 'horizontal', // Layout ring charts horizontally
    82. graphset: [g1, g2, g3, g4],
    83. };
    84.  
    85. zingchart.render({
    86. id: "zc",
    87. height: '100%',
    88. width: '100%',
    89. data: myConfig,
    90. });