radar-multiple.py 1.9 KB

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