cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member

INTRODUCTION

Use this script to customize the data labels and markers in line charts. You can use this to simply improve the aesthetics of the line chart or even tweak it to conditionally color the markers.
Edit the Widget Choose the Edit Script option from the options menu. Copy Paste the following script
Note: You can modify the variable values in the script to set marker and label properties.
widget.on('processresult', function(e, args) {
 
 var markerRadius = 18;
 var markerColor = '#FF0000';
 var markerHoverColor = '#C0C0C0';
 var labelSize = '9px';
 var labelColor = '#FFFFFF';
 var lineStyle = 'shortdash';
 var lineWidth = 2;
 
 var chartS = args.result.series;
 
 for(var s = 0; s < chartS.length; s++ ) {
 var dd;
 
 chartS[s].dashStyle = lineStyle;
 chartS[s].lineWidth = lineWidth;
 
 chartS[s].marker = {
 symbol: 'circle'
 }
 
 
 for(var d = 0; d < chartS[s].data.length; d++) {
 dd = chartS[s].data[d];
 
 var dataLabelsTemplate = {
 enabled : true,
 y : (markerRadius /2),
 style: {
 color: labelColor,
 textOutline: 'none',
 fontSize : labelSize, 
 fontWeight : "bold"
 }
 };
 
 dd.dataLabels = dataLabelsTemplate;
 
 dd.marker.radius = markerRadius;
 dd.marker.enabled = true;
 dd.marker.fillColor = chartS[s].color;
 dd.marker.states.hover.fillColor = chartS[s].color;
 dd.marker.states.hover.radius = markerRadius;
 dd.marker.states.hover.enabled = true; 
 
 }
 }
 

});
Version history
Last update:
‎03-02-2023 09:15 AM
Updated by:
Contributors
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]

Share this page: