I am using a grouped line chart whereas which uses category10 range in color scale. Is there any way to specify exact color for each record?
This is very useful if we plot some scenarios such as election results where we should represent exact political party color in chart as well.
In the definition of your color scale, you can directly use an array of colors for its range:
{
"name": "color",
"type": "ordinal",
"domain": {"data": "table","field": "EngineType"},
"range": ["pink", "green"]
}
Now if you want to specifically bind each value to specific colors you can also hardcode the domain of this scale:
"domain": ["Piston", "Rotary"],
"range": ["pink", "green"]
It works and thank you very much for immediate response. I will close this issue.
how to assign different colour for circles representing different parameters in a matrix plot. I have almost six (6) parameters.
Most helpful comment
In the definition of your
colorscale, you can directly use an array of colors for itsrange:Now if you want to specifically bind each value to specific colors you can also hardcode the
domainof this scale: