I am trying to create a dynamic colour range so I can display some data. For example, if I have the values [1.0, 1.6, 2.3, 2.9, 3.5, 4.2, 4.7, 5.0]
then I would like to be able to set e.g. 1.0
as the colour green, 2.5
as the colour yellow and 5.0
as the colour red, resulting in something like the screenshot shown below
And example in Angular is shown here: https://stackblitz.com/edit/angular-z32yhk?embed=1&file=app/app.component.ts
I do not just want to have a range from green to red for example, but it could be from yellow to purple. How would I go about doing this?