1
0

radar_simple.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. # Source: www.statista.com (Most used programming languages in 2022)
  19. data: Dict[str, List] = {
  20. # List of programming languages
  21. "Language": ["JavaScript", "HTML/CSS", "SQL", "Python", "Typescript", "Java", "Bash/Shell"],
  22. # Percentage of usage, per language
  23. "%": [65.36, 55.08, 49.43, 48.07, 34.83, 33.27, 29.07],
  24. }
  25. # Close the shape for a nice-looking stroke
  26. # If the first point is *not* appended to the end of the list,
  27. # then the shape does not look as it is closed.
  28. data["%"].append(data["%"][0])
  29. data["Language"].append(data["Language"][0])
  30. layout = {
  31. "polar": {
  32. "radialaxis": {
  33. # Force the radial range to 0-100
  34. "range": [0, 100],
  35. }
  36. },
  37. # Hide legend
  38. "showlegend": False,
  39. }
  40. options = {
  41. # Fill the trace
  42. "fill": "toself"
  43. }
  44. md = """
  45. <|{data}|chart|type=scatterpolar|r=%|theta=Language|options={options}|layout={layout}|>
  46. """
  47. if __name__ == "__main__":
  48. Gui(md).run(title="Chart - Radar - Simple")