1
0

radar_multiple.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Copyright 2021-2025 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 typing import Dict, List
  17. from taipy.gui import Gui
  18. # Skill categories
  19. skills = ["HTML", "CSS", "Java", "Python", "PHP", "JavaScript", "Photoshop"]
  20. data: List[Dict[str, List]] = [
  21. # Proportion of skills used for Backend development
  22. {"Backend": [10, 10, 80, 70, 90, 30, 0], "Skills": skills},
  23. # Proportion of skills used for Frontend development
  24. {"Frontend": [90, 90, 0, 10, 20, 80, 60], "Skills": skills},
  25. ]
  26. # Append first elements to all arrays for a nice stroke
  27. skills.append(skills[0])
  28. data[0]["Backend"].append(data[0]["Backend"][0])
  29. data[1]["Frontend"].append(data[1]["Frontend"][0])
  30. layout = {
  31. # Force the radial axis displayed range
  32. "polar": {"radialaxis": {"range": [0, 100]}}
  33. }
  34. # Fill the trace
  35. options = {"fill": "toself"}
  36. # Reflected in the legend
  37. names = ["Backend", "Frontend"]
  38. # To shorten the chart control definition
  39. r = ["0/Backend", "1/Frontend"]
  40. theta = ["0/Skills", "1/Skills"]
  41. page = """
  42. <|{data}|chart|type=scatterpolar|name={names}|r={r}|theta={theta}|options={options}|layout={layout}|>
  43. """
  44. if __name__ == "__main__":
  45. Gui(page).run(title="Chart - Radar - Multiple")