Frequently Asked Question
How to add custom palette in the list available in Need4Viz components using a second palette of color
Dernière mise à jour il y a 3 ans
Symptom
- Add one (or more) custom palette(s) available in Need4Viz components using a second custom palette list
Environment
- Windows Server / Linux
- Need4Viz : versions >= 2021.7.2
- Need4Viz components -> Maplines / Drillmap (subdivision colors), Pie in pie (second disc colors)
Resolution
To add custom palette of color :
- Define the list of all the colors that will compose your palette. The colors need to be defined in hexa format. Respect the exact syntax formatting of the list. For instance, the following list of colors will be use in our example :
The corresponding list of colors for this palette is : ['#542e71','#fb3640','#fdca40','#a799b7']. You can add as many colors you want in the palette. If not enough colors are available in the palette when using it in a component, Need4Viz will generate random colors to complete the palette for this component.
- On each Need4Viz server, open the file ~Need4Viz_folder_installation\nodejs\node_modules\custom_element\ce_lib\resources\list_palettes.js
- Add your list of color and give a codename to the list, for instance in our example pal05 is defined (respect the exact syntax) :
- Save the file
- Open the file ~Need4Viz_folder_installation\nodejs\node_modules\custom_element\ce_settings\lang_EN\_list_palettes_divmaps.json.
- 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) :
- Report exactly the same entry in the FR version file ~Need4Viz_folder_installation\nodejs\node_modules\custom_element\ce_settings\lang_FR\_list_palettes_divmaps.json.
- Stop and restart the Need4Viz server by launching the Need4Viz_stop.ps1 and Need4Viz_start.ps1 scripts in a PowerShell window.
- Open a Need4Viz component that uses second color palettes (ex. Pie in pie) and in the Extended parameters/Options, check your entry is added :
- Choose the new palette and check it is correctly used for the second pie :
Caution
The use of custom files needs to respect exactly the instruction and structure mentionned above.
The json file must be encoded in UTF8.