radar-multiple.py 2.1 KB

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