Frequently Asked Question

How to add custom palette in the list available in Need4Viz components using a palette of color
Last Updated a year ago

Symptom

  • Add one (or more) custom palette(s) available in all Need4Viz components using a palette

Environment

  • Windows Server / Linux
  • Need4Viz : versions >= 2021.4.1

Resolution

To add custom palette of color:

  1. Define the list of all the colors that will compose your palette. The colors need to be defined in HEX (#RRGGBB) format. Respect the exact syntax formatting of the list. For instance, the following list of colors will be use in our example:image The corresponding list of colors for this palette is: ['#542e71','#fb3640','#fdca40','#a799b7']. You can add as many colors as possible you want in the palette. If enough colors are not available in the palette when using it in a component, Need4Viz will generate random colors to complete the palette for this component.
  2. On each Need4Viz server, open the file ~Need4Viz_folder_installation\nodejs\node_modules\custom_element\ce_lib\resources\list_palettes.js
  3. Add your list of color and give a codename to the list, for instance in our example pal05 is defined (respect the exact syntax, the codename mustn't start with a number) :image
  4. Save the file
  5. Open the file ~Need4Viz_folder_installation\nodejs\node_modules\custom_element\ce_settings\lang_EN\_list_palettes.json.
  6. Add the new entry for your palette. Report in the "id" field the codename defined previously. You can choose the name you want (this name will be displayed in the list of values of each Need4Viz component) : image
  7. Report exactly the same entry in the FR version file ~Need4Viz_folder_installation\nodejs\node_modules\custom_element\ce_settings\lang_FR\_list_palettes.json.
  8. Stop and restart the Need4Viz server by launching the Need4Viz_stop.ps1 and Need4Viz_start.ps1 scripts in a PowerShell window.
  9. Open a Need4Viz component that use color palettes and in the Extended parameters/Global, check your entry is added : image
  10. Choose the new palette and confirm it is correctly used:image


Caution

The use of custom files needs to respect exactly the instruction and structure mentioned above.

The JSON file must be encoded in UTF-8.

Please Wait!

Please wait... it will take a second!