reversing selected colorscheme and maximizing contrast in highmaps
We have recently implemented highmaps on our site and added features to let content creators select different color schemes when they create a map.
But what they are missing is two things: a option to reverse the selected colorscheme from dark to light or light to dark.
And a behavior change in highmaps when using the defined colors, so that if the map has fewer data classes than the number of defined colors, only the colors with highest contrast between them should be used.
example: if only two data classes are defined, only the lightest and the darkest color should be used.
and if three data classes are defined, the darkest, lightest and middle value colors should be used.
-
Ok, takk for info! Eg er fortsatt ikkje sikker på om det trengst ein option her - for eksempel kan du reversere colors-arrayen ved å gjere colors.reverse() i options-settet ditt.
-
Erik Chrisander Gustavsen commented
Hmm, we might not understand each other completely, so ill try in Norwegian if that's ok?
Dette har ikke noe med gui'en vår å gjøre egentlig, den bare tillater folk som ikke koder å lage highmaps til artikler hos oss. Men det er ikke viktig for denne feature requesten.
Det vi ønsker er at det legges inn en algoritme/funksjon som sjekker på kontraster mellom fargene i arrayen og velger ut de fargene med størst kontrast mellom seg dersom det er flere farger tilgjengelig i arrayen enn det er data klasser. (e.g hvis det er farger til overs, velg de med størst kontrast)
Og den funksjonen med å reversere fargepallett er egentlig "nice to have" funksjonalitet for oss og ikke så viktig som den nevnt over, men den går på det å kunne bytte på at lav verdi = lys farge og høy verdi = mørk farge.
Slik det er lagt inn i arrayen hos oss er at det starter med lys farge og går til mørk farge, og farger assignes vel til dataklasser etter posisjon?
Så om det var en funksjon for å bare flippe rekkefølge på innholdet i arrayen som inneholder fargene, så hadde det løst ønsket vårt :) -
I can only advice you on how Highmaps works, not your UI, but I can see two possible ways of dealing with this for you:
1. Apply the color set dynamically based on how many data classes there are. See http://jsfiddle.net/highcharts/vs9twuLb/ for a proof of concept.
2. Set the colors directly on the data classes: http://jsfiddle.net/highcharts/vs9twuLb/1/
-
Erik Chrisander Gustavsen commented
Yes, we use Enonic cms and have set up a way for the content creator without any knowledge of code to create highmaps and highcharts, a demo would be difficult, but i can take a few screenshots and try to explain.
I have uploaded a screenshot of a highmaps content creation page in our cms here:
https://photos.app.goo.gl/XFjyP33BRumYo2sn2So, what they do is select a color, (either green or yellow) and a if statement in the code does a check and selects the corresponding array. So what reversing the colors means in code terms is basically reversing the order of the array, so the last color goes first and the first goes last.
(I tried to solve this one myself, but it got really complicated and messy, so it would be a lot cleaner with a color config that just said reverse true or false, and it would reverse the order of the array)The reason behind this is that sometimes the content creators would like high values to have light colors instead of dark colors. because the maps will be used in different articles with different subjects etc.
And a picture of the color code here:
https://photos.app.goo.gl/qdv8ylIyBTYkdE0e2How it works now is that we have defined five colors and it uses the colors in the order that the colors are placed in the code, and that is fine if we use five dataclasses, but if we use less than five it looks a bit weird.
example: if two data classes is used, and green is selected, colors would be: #e3f1e6 and #90cc93 what we would want the colors to be, is: #e3f1e6 and #005245 (the first and the last, or the ones with greatest contrast between them)Hope this clears things up a bit :)
-
I'm not sure what you mean by reversing the selected colorscheme - are you using some kind of GUI on top of Highmaps? Can we see a demo?
Also, for dataclasses, this is how they currently work. If you have two data classes, the chart uses either one or the other color, with no interpolation in between. A demo of what you're trying to achieve would be nice her too.