Open AmoebeLabs opened 4 years ago
Added "segments as colorstops" option
Added first version of colorstop, where the color of all the segments are the current color segment.
Note for colorstop gradient & simple gradient:
Note: It might be possible to use the __getGradientValue(startcolor, endcolor, value0-1). Colors can be fetched from the configuration & segments. And the value might use the min/max and current angles.
The Problem To Be Solved
Add colorstops, colorstopgradients and linear gradients to the segmented-arc, just as the horse-shoe already is capable of. This will be a lot of work, as you can also color the scale with this.
[x] ColorList
[x] Colorstop
[x] Colorstop, segmentcolor = curvalue
[x] Colorstop gradients (single color displayed!)
[ ] SimpleGradient (single color displayed!)
(Optional): Suggested Solution
Take the horseshoe as an example, but also check other sources for examples around this. Maybe there are better and easier solutions as the segmented-arc is completely different implemented compared to the horseshoe.
Difficulties with gradients
The segmented arc is constructed using separate path's for each segment. This probably means you can't use any gradient solutions that exactly follow the path:
Segment color list as an alternative
One alternative to a full gradient are segmented gradients as shown below in the third arc (CPU 31 %):
And with the scale added, and filled using the same color list:
In this case a list of 10 colors is defined in the segmented arc with also 10 segments (must be changed, colorlist defines number of segments) for example. Each segment gets its own 'fixed' color. Depending on the chosen colorlist, this can look like a nice gradient...
2020.10.13: First results with some hacking in the creation and rendering of the segmented arc with a colorstop:
Configuration in this case:
Number of segments is the number of colors in the colorlist. Simple.
Colorstops
The full arc (ie all segments) get the color according to the colorstop. This requires rewriting of the all the segments if a new colorstop is reached or, and that is easier, setting the fill color to the colorstop value.
Segments as colorstops
When using a colorstop list for the creation of the segments, each segment can have its own color. This might already be usable for CPU load, temperature, battery percentage, disk/ram percentage, etc.
In this case the segments can be of different size. Unknown if current implementation can handle this. But using a separate color for each segment is no problem, as the fill color can be specified using javascript.
Example:
Segment value ranges are
Depending on the size of the full segmented arc (degrees), these segments can be calculated. Say the arc is 90 degrees, then the segments are:
When using this option, the scale will have the colors according to the colorstops.
Configuration in this case:
Structure
If we use a separate structure under segments for each style, then there is a 1:1 link between them
Implementation