ITD104 – Building IT Systems CS, 2023
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
ITD104 – Building IT Systems
CS, 2023
AT 1 - Assignment 1: RADAR CHARTS
Client’s Briefing - Transcript
Overview
Hello, I’m representing your client who has commissioned you to build a program to solve a data visualisation problem.
We need you to develop a small Python program to produce a simple visualisation tool for statistical data.
Radar charts, a.k.a. star charts or spider plots, are a common way of visualising multi-variate data, i.e., a collection of related but fundamentally different data values.
In this task you will use Python’s Turtle graphics module to implement a function which, given lists of percentages (‘data points’), visualises that data on a radar chart.
You will need to submit your solution as a single Python file uploaded via the Canvas submission link before the agreed deadline (see Canvas).
To get you started, we’ve provided you with a Python template file and two separate modules that you must not change at all. One is a configuration module (AT1_config.py), which helps setup the turtle environment. The other is a data source module (AT1_data_source.py) that is responsible for generating random data for your program to work with. These two files must be stored in the same directory as the template. Let’s have a look at the template and see how it works.
[Shows that you need to enter your student number and name in the file AT1_template.py before it will run]
For cyber security purposes we need to know who wrote the software, so you must sign your name and student number at the top of the template file before the program will work.
[Adds name as astring, and student number as an integer.]
Now it works by displaying a very simple drawing canvas, with your name proudly displayed as the author at the bottom.
[Show the initial layout of the drawing canvas]
If you don’t have the data source module in the same directory, you will also notice a message in the shell:
No data source module available ...
If you don’t have the configuration module in the same directory, your program will abort, with a message in the shell:
Cannot find file 'AT1_config.py', aborting!
Specific Requirements
To complete this task, you must complete the supplied Python function called draw_radar_chart that accepts a multi-dimensional list (the ‘dataset’) and uses Turtle graphics to draw a corresponding radar chart. The first element of the dataset will contain a list of colour strings, and the remaining elements will be lists of numeric values which represent the data points to be plotted on the radar chart.
Each data point value represents a percentage between 0 and 100, inclusive. For instance, consider the following list of data points which contains 10 percentages:
[50, 100, 75, 25, 90, 0, 12, 45, 90, 23]
[Runs a demo to produce a chart for plotting those 10 data points]
Your solution must work for any number of data points between 3 and 10. Let’s see what our radar chart would look like with the above list of percentages.
[Demo plotting a single list of data points]
Your program must work for any size dataset. That is,a dataset with between 2 and 7 lists of data points, all of the same length. Each of the list of data points will be represented on the chart with a connected line. The lists of data points can be of any length between 3 and 10. It doesn’t make sense to have a radar chart with fewer than 3 data points. The length of the list of datapoints will determine how many spokes on the chart.
Your draw_radar_chart function must be able to plot multiple of these lines on a radar chart. The supplied data source module is designed to generate a dataset of between 2 to 7 lists of data points, with each list of data points being of the same length (between 3 to 10).
So that the sets of data points on the chart can be distinguished from each other, each line drawn from a list of data points must be done in a unique colour. So as well as the list of data points,a list of colours is also generated by the data source module.
[Demo generation of a dataset]
If you supply an integer (seed) to the call to this function, it will produce the same dataset each time so you can check/debug your work during development.
[Demo generating same list of values - with seed 52297]
Let’s look at producing a radar chart from multiple lists data points.
[Run demos to plot multiple sets of data points]
One of the problems with radar charts is that they tend to be less readable when there is a large amount of data displayed. For this reason, we want you to limit the visualisation to a maximum of only four (4) lines on the radar chart. Your program must still work with larger datasets, but it should simply stop plotting data after processing the fourth list of data points.
So that the user can determine if all the data has been visualisedor not, there must be a final message written on the turtle canvas to advise if all, or only the first four, lists of data points have been plotted.
[Run demo where more than 4 sets of data points are supplied]
Summary of Requirements
1. From a supplied dataset, you are to:
• draw a ‘web’ for plotting the data points. The web must:
o have the same number of ‘spokes’ as the length of each of the list of data points
o be numbered sequentially (from 1)
• From each list of data points, up to a maximum of four:
o use each supplied colour string (in order) for each of the list of data points
o plot each value (in order) on a spoke of the web
o when a value is 0, 25, 50, 75 or 100,a dot should be drawn at that point
o connect, with a line, all of the values in a list of data points
2. Each line drawn on the web must be easily distinguishable from the web itself.
3. Write a message at the top of the canvas to advise the user if all data was plotted, or if it was limited to only four sets of data points.
Development notes
You will need to be very familiar and well practiced with the first 5 topics in this unit. In particular:
o Function definitions
o List processing (using iteration)
o Conditional branching
o Function calls (including from the Turtle module)
There are many pre-defined Python packages available online to plot charts. Obviously, you may not use such a package in your solution! The point of the task is for you to demonstrate your understanding of those topics, and develop your own solution using nothing other than basic Turtle operations. Therefore, no other modules, other than Turtle, are to be imported by your solution.
This task is not particularly difficult and should not be time consuming. Remember that the sooner you start coding, the longer it will take! So do a decent amount of thinking, problem- solving and designing before you let loose with Python! That is, analysing the client instructions, and developing a strategy in the form of a set of steps (algorithm) which you will retain as comments to document your solution.
The hardest part of this task is representing the data values on the spokes and connecting them up with a line. How can you work out where a data value would be in relation to the radar chart? Can you directly use the data value itself? Will you need to store coordinates? If so, how?
If you don’t finish the whole task, submit what you have been able to achieve – for potentially part marks. Keep backups of your work! Each time you work on your solution, submit the new version to Canvas. You can ‘submit’ as many times as you like. I will only mark the last version submitted prior to the deadline.
Deliverables
The deliverables for this task areas follows.
• A Python program that contains a function draw_radar_chart capable of drawing diagrams like those shown above, given a list of lists (of colours and percentages). This program must be developed from the provided AT1_template.py file. The template contains a function for randomly generating a data set for your function. Your function must work for any valid data set.
• A sworn “Statement of Authorship” at the beginning of the Python file to confirm that this is your own work. (Marks cannot be awarded if you are not identified!)
The solution must have the following characteristics.
• The visual output must be clear,i.e.:
o the ‘web’ must be easily distinguishable from the data lines
o the individual data lines plotted must be easy to identify;
o only data values that intersect exactly with a concentric line (i.e., any value of 0, 25, 50, 75 or 100) are to be marked with a dot; and
o all labels (i.e., the spoke numbers) must be easy to read and appropriately positioned.
• Your code must be well laid-out and made easy to understand through helpful commenting and meaningful choices of variable names. The ITD104 Code Presentation Guide must also be adhered to in all other respects.
• The program must be easily customisable. In particular, it must be easy for the user to change the overall dimensions and appearance of the chart. This can be achieved by using named constants rather thane.g., “magic numbers” .
That’s all of the client’s requirements, for now. Be sure to check the usual communication channels for updates and amendments. Be sure to ask your client if anything is unclear!
2023-12-20