• 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://cdn.zingchart.com/zingchart.min.js"></script>
    8. <style>
    9. html,
    10. body {
    11. margin: 0;
    12. padding: 0;
    13. width: 100%;
    14. height: 100%;
    15. }
    16.  
    17. .chart--container {
    18. min-height: 150px;
    19. width: 100%;
    20. height: 100%;
    21. }
    22.  
    23. .zc-ref {
    24. display: none;
    25. }
    26. </style>
    27. </head>
    28.  
    29. <body>
    30. <!-- CHART CONTAINER -->
    31. <div id="myChart" class="chart--container">
    32. <a class="zc-ref" href="https://www.zingchart.com/">Powered by ZingChart</a>
    33. </div>
    34. <script>
    35. ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"]; // window:load event for Javascript to run after HTML
    36. // because this Javascript is injected into the document head
    37. window.addEventListener('load', () => {
    38. // Javascript code to execute after DOM content
    39.  
    40. // full ZingChart schema can be found here:
    41. // https://www.zingchart.com/docs/api/json-configuration/
    42. let chartConfig = {
    43. type: 'pop-pyramid',
    44. globals: {
    45. fontSize: '14px'
    46. },
    47. title: {
    48. text: 'Population Pyramid by Age Group',
    49. fontSize: '24px'
    50. },
    51. options: {
    52. // values can be: 'bar', 'hbar', 'area', 'varea', 'line', 'vline'
    53. aspect: 'hbar'
    54. },
    55. legend: {
    56. shared: true
    57. },
    58. // plot represents general series, or plots, styling
    59. plot: {
    60. // hoverstate
    61. tooltip: {
    62. padding: '10px 15px',
    63. borderRadius: '3px'
    64. },
    65. valueBox: {
    66. color: '#fff',
    67. placement: 'top-in',
    68. thousandsSeparator: ','
    69. },
    70. // animation docs here:
    71. // https://www.zingchart.com/docs/tutorials/design-and-styling/chart-animation/#animation__effect
    72. animation: {
    73. effect: 'ANIMATION_EXPAND_BOTTOM',
    74. method: 'ANIMATION_STRONG_EASE_OUT',
    75. sequence: 'ANIMATION_BY_NODE',
    76. speed: 222
    77. }
    78. },
    79. scaleX: {
    80. // set scale label
    81. label: {
    82. text: 'Age Groups'
    83. },
    84. labels: ['0-4', '5-9', '10-14', '15-19', '20-24', '25-29', '30-34', '35-39', '40-44', '45-49', '50-54', '55-59', '60-64', '65-69', '70-74', '75-79', '80-84', '85-89', '90-94', '95-99', '100+'],
    85. },
    86. scaleY: {
    87. // scale label with unicode character
    88. label: {
    89. text: 'Population'
    90. }
    91. },
    92. series: [{
    93. text: 'Male',
    94. values: [1656154, 1787564, 1981671, 2108575, 2403438, 2366003, 2301402, 2519874, 3360596, 3493473, 1785638, 1447162, 1005011, 1330870, 1130632, 1121208, 2403438, 3360596, 3493473, 1785638, 1447162],
    95. // two colors with a space makes a gradient
    96. backgroundColor: '#4682b4',
    97. dataSide: 1
    98. },
    99. {
    100. text: 'Female',
    101. values: [1656154, 1787564, 1981671, 2108575, 2403438, 2366003, 2301402, 2304444, 2426504, 2568938, 1785638, 1447162, 1005011, 1330870, 1130632, 1121208, 2108575, 2301402, 2304444, 2426504, 1568938],
    102. // two colors with a space makes a gradient
    103. backgroundColor: '#ee7988',
    104. dataSide: 2
    105. }
    106. ]
    107. };
    108.  
    109. // render chart
    110. zingchart.render({
    111. id: 'myChart',
    112. data: chartConfig,
    113. height: '100%',
    114. width: '100%',
    115. });
    116. });
    117. </script>
    118. </body>
    119.  
    120. </html>
    1. <!DOCTYPE html>
    2. <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>
    11. <!-- CHART CONTAINER -->
    12. <div id="myChart" class="chart--container">
    13. <a class="zc-ref" href="https://www.zingchart.com/">Powered by ZingChart</a>
    14. </div>
    15. </body>
    16.  
    17. </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:load event for Javascript to run after HTML
    2. // because this Javascript is injected into the document head
    3. window.addEventListener('load', () => {
    4. // Javascript code to execute after DOM content
    5.  
    6. // full ZingChart schema can be found here:
    7. // https://www.zingchart.com/docs/api/json-configuration/
    8. let chartConfig = {
    9. type: 'pop-pyramid',
    10. globals: {
    11. fontSize: '14px'
    12. },
    13. title: {
    14. text: 'Population Pyramid by Age Group',
    15. fontSize: '24px'
    16. },
    17. options: {
    18. // values can be: 'bar', 'hbar', 'area', 'varea', 'line', 'vline'
    19. aspect: 'hbar'
    20. },
    21. legend: {
    22. shared: true
    23. },
    24. // plot represents general series, or plots, styling
    25. plot: {
    26. // hoverstate
    27. tooltip: {
    28. padding: '10px 15px',
    29. borderRadius: '3px'
    30. },
    31. valueBox: {
    32. color: '#fff',
    33. placement: 'top-in',
    34. thousandsSeparator: ','
    35. },
    36. // animation docs here:
    37. // https://www.zingchart.com/docs/tutorials/design-and-styling/chart-animation/#animation__effect
    38. animation: {
    39. effect: 'ANIMATION_EXPAND_BOTTOM',
    40. method: 'ANIMATION_STRONG_EASE_OUT',
    41. sequence: 'ANIMATION_BY_NODE',
    42. speed: 222
    43. }
    44. },
    45. scaleX: {
    46. // set scale label
    47. label: {
    48. text: 'Age Groups'
    49. },
    50. labels: ['0-4', '5-9', '10-14', '15-19', '20-24', '25-29', '30-34', '35-39', '40-44', '45-49', '50-54', '55-59', '60-64', '65-69', '70-74', '75-79', '80-84', '85-89', '90-94', '95-99', '100+'],
    51. },
    52. scaleY: {
    53. // scale label with unicode character
    54. label: {
    55. text: 'Population'
    56. }
    57. },
    58. series: [{
    59. text: 'Male',
    60. values: [1656154, 1787564, 1981671, 2108575, 2403438, 2366003, 2301402, 2519874, 3360596, 3493473, 1785638, 1447162, 1005011, 1330870, 1130632, 1121208, 2403438, 3360596, 3493473, 1785638, 1447162],
    61. // two colors with a space makes a gradient
    62. backgroundColor: '#4682b4',
    63. dataSide: 1
    64. },
    65. {
    66. text: 'Female',
    67. values: [1656154, 1787564, 1981671, 2108575, 2403438, 2366003, 2301402, 2304444, 2426504, 2568938, 1785638, 1447162, 1005011, 1330870, 1130632, 1121208, 2108575, 2301402, 2304444, 2426504, 1568938],
    68. // two colors with a space makes a gradient
    69. backgroundColor: '#ee7988',
    70. dataSide: 2
    71. }
    72. ]
    73. };
    74.  
    75. // render chart
    76. zingchart.render({
    77. id: 'myChart',
    78. data: chartConfig,
    79. height: '100%',
    80. width: '100%',
    81. });
    82. });