|
Rose graph with minimum scale value |
| Posted by Alain on Sep-05-2025 22:28 |
|
Hello,
I generate a rose with the following script:
# Add sectors to the chart as sector zones
for i in range(0, len(data)):
j = (i + data_size - 5) % data_size
c.angularAxis().addZone(20*j-90+2, 20*j-80, 0, data[j], colorsPart1[j], 0x9C9C9C)
c.angularAxis().addZone(20*j-80 , 20*j-70-2, 0, data[j], colorsPart2[j], 0x9C9C9C)
The problem is that depending on the maximum value of the table "data", the scale of the axis may vary. Which is good except that I would like to have a minimum value for the scale.
Ou typical range of values is between 0 and 4. I would like to have a minimum of 1 for the scale of the axis. So if all values are less than 1, the length of the axis will be 1 and not the maximum find in the data table.
How can I add that ?
Regards,
Alain |
Re: Rose graph with minimum scale value |
| Posted by Peter Kwan on Sep-06-2025 02:37 |
|
Hi Alian,
In the original sample code that comes with ChartDirector for Python, after the code that "add sectors to the chart as sector zones", there should be another line that configures the axis scale:
# Add an Transparent invisible layer to ensure the axis is auto-scaled using the data
c.addLineLayer(data, Transparent)
The above code causes ChartDirector to examine the data, and uses the minimum and maximum data values to determine the axis scale.
If you want the max value must be at least 1, you can modify the code to:
#minimal scale is 0, maximum scale is the maximum data value or 1, whichever is larger
c.addLineLayer([0, max(1, max(data))], Transparent)
Best Regards
Peter Kwan |
Re: Rose graph with minimum scale value |
| Posted by Alain on Sep-06-2025 17:56 |
|
Thank you Peter,
as always, an accurate answer !
Regards,
Alain |
|