Knowledge Base Article

Modifying Legend Style

Introduction
This article will show how to modify the style of the legend in you widget.
Steps
  1.  Open you widget in Edit mode.
  2. From the Options Menu  choose "Edit Script" to open the script editor.
3. Copy and paste the following code into the script editor.
widget.on('processresult', function(se, ev){

/************* Configure here *********/
 var color = "#00ff00";
 var fontWeight = "bold";
 var fontSize = "24px";
 /************************************/
 
 var legend = ev.result.legend;
 
 legend.itemStyle.color = color;
 legend.itemStyle.fontWeight = fontWeight;
 legend.itemStyle.fontSize = fontSize;
})
4. Modify the color, fontWeight and fontSize values to meet your style requirements, or comment out unneeded lines.

5. Refresh the page and click "Apply".
The example code above will change the legend style from the default style
to this style:
Updated 03-02-2023
No CommentsBe the first to comment