Frequently Asked Question

How to fix the color of each value of a dimension in the N4V widgets
Last Updated 9 months ago

Symptom

  • You want to assign a specfic color for each value of a dimension in a N4V widget

Environment

  • Windows Server / Linux
  • Need4Viz : all versions (depending on the feeding of the N4V widget). Widgets -> Drillbar, MultiChart, MultiDrill, Pie in Pie, Sunburst,...

Resolution

Generally speaking, in the N4V widgets, when multi measures are provided in input, the color of each measure is affected by the selected palette (1st color of the palette -> 1st measure, 2nd color -> 2nd measure...). When only one measure is provided, either the chart is monocolor (the first color of the palette is selected or depending on the settings, you can select a specific color) either you can draw a multicolor chart. In this case, the color affected to the values of input dimension is provided by the selected palette (1st color of the palette -> 1st value of the dimension, 2nd color -> 2nd value of the dimension...)

Technically, it's not possible to affect a specific color to a specific value of the dimensions through the settings of the widget (Extended Parameters). 

But to enable this possibility, we have progressively added a new way to specify a color for dimension value, through the "Data feeding" of some widgets.

When a widget offers this way, you'll find in the Data Feeding, a specific field (generally named "Color") :

image

The object sent to the field "Color" must return a specific color in RGB format.

You can use a Webi variable to affect a specific RGB color for each different values of your dimension (and provide a default color for the non affected values).

For instance, the following kind of variable can be used (color is specified for each value of the [TYPE] dimension object :

image

RGB colors in hexa are always formatted as : '#' + 2 digits for the Red color + 2 digits for the Green color + 2 digits for the Blue color. In some case, you can add additional 2 digits for the opacity.

You can use the N4V Palette Panel to choose your colors, and get the corresponding RGB hexa code :

image
image

You can also use the N4V Settings Panel and any color picker setting to choose your color (and get the RGB hexa code) :

image
image

Please Wait!

Please wait... it will take a second!