How do i add new legend color on map feature

I need to add new color range 1 - 25% with purple colour so I edit file customer-view.blade.php then the legend shows purple for 1-25% but at the link traffic below 25% is still shown in green color how do I fix it?

/resources/views/map/customer-view.blade.php
function legendPctColour(pct) {
if (pct < 0) {
return “black”;
} else if (pct < 25) {
// add purple color here***
return ‘#BD75F4’;
} else if (pct < 50) {
// 100% green and slowly increase the red until we get to yellow
return ‘#’ + parseInt(5.1 * pct).toString(16).padStart(2, 0) + ‘ff00’;
} else if (pct < 100) {
// 100% red and slowly remove green to go from yellow to red
return ‘#ff’ + parseInt(5.1 * (100.0 - pct)).toString(16).padStart(2, 0) + ‘00’;
} else if (pct < 150) {
// 100% red and slowly increase blue to go purple
return ‘#ff00’ + parseInt(5.1 * (pct - 100.0)).toString(16).padStart(2, 0);
}

I’m not very familiar with custom map code, but have you had a look at this function?

Also, it might be worth checking out the file changes for original PR for custom maps. I’m sure there have been change/modifications since then, but it might help give you an idea what all files make up the feature.

Dear slashdoom,

Thank you very much. after I edited the function speedColour, the link’s color changed. :slight_smile:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.