treemap-hierarchical.py 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # Copyright 2021-2024 Avaiga Private Limited
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  4. # the License. You may obtain a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  9. # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
  10. # specific language governing permissions and limitations under the License.
  11. # -----------------------------------------------------------------------------------------
  12. # To execute this script, make sure that the taipy-gui package is installed in your
  13. # Python environment and run:
  14. # python <script>
  15. # -----------------------------------------------------------------------------------------
  16. from taipy.gui import Gui
  17. if __name__ == "__main__":
  18. # Partial family tree of the British House of Windsor
  19. # Source: https://en.wikipedia.org/wiki/Family_tree_of_the_British_royal_family
  20. tree = {
  21. "name": [
  22. "Queen Victoria",
  23. "Princess Victoria",
  24. "Edward VII",
  25. "Alice",
  26. "Alfred",
  27. "Wilhelm II",
  28. "Albert Victor",
  29. "George V",
  30. "Louise",
  31. "Ernest Louis",
  32. "Alfred (2)",
  33. "Marie",
  34. "Victoria Melita",
  35. "Edward VIII",
  36. "George VI",
  37. "Mary",
  38. "Elizabeth II",
  39. "Margaret",
  40. "Charles III",
  41. "Anne",
  42. "Andrew",
  43. ],
  44. "parent": [
  45. "",
  46. "Queen Victoria",
  47. "Queen Victoria",
  48. "Queen Victoria",
  49. "Queen Victoria",
  50. "Princess Victoria",
  51. "Edward VII",
  52. "Edward VII",
  53. "Edward VII",
  54. "Alice",
  55. "Alfred",
  56. "Alfred",
  57. "Alfred",
  58. "George V",
  59. "George V",
  60. "George V",
  61. "George VI",
  62. "George VI",
  63. "Elizabeth II",
  64. "Elizabeth II",
  65. "Elizabeth II",
  66. ],
  67. }
  68. page = """
  69. # TreeMap - Hierarchical
  70. <|{tree}|chart|type=treemap|labels=name|parents=parent|>
  71. """
  72. Gui(page).run()