Removing Value Labels And Markers From A Specific Series
When toggling the "value labels" switch of a widget's design pane, the labels are enabled or disabled for the entire chart.

In case you have multiple series and you want to disable just one of them (typical when it gets too crowded on the plot), it is possible to do by adding the following code to the widget's script:
/******* user configuration **********/
var seriesName = "MySeries";
/*************************************/
widget.on('processresult', function(sender, ev){
var data = _.find(ev.result.series, function (ser) {return ser.name == seriesName}).data
_.each(data, function(value){
value.dataLabels = {enabled:false}
})
})Just replace the series name with the desired measure you want to remove the labels from.
For hiding the value labels of multiple series, use the following script:
/******* user configuration **********/
var seriesNames = ["MySeries1", "MySeries2"];
/*************************************/
widget.on('processresult', function(sender, ev){
seriesNames.forEach(function(e, i, a){
var data = _.find(ev.result.series, function (ser) {return ser.name == e}).data
_.each(data, function(value){
value.dataLabels = {enabled:false}
})
})
})BREAK-BY
In case your measure is "Broken By" some field, each series name will be as the specific value of that field. See this example, where only the "orange" labels are shown:
We enabled 'value labels' and configured in the script:
var seriesName = "apple";
The result:

If you are using Markers signs which you would like to remove you can use the following script:
widget.on("beforeviewloaded",function(w,args){
var seriesToRemoveMarkerFrom = ["seriesName"];
var seriesWithoutMarkers = _.filter(args.options.series,function(ser){
return (seriesToRemoveMarkerFrom.indexOf(ser.name) > -1);
})
if(seriesWithoutMarkers.length > 0){
seriesWithoutMarkers.forEach(function(s){
s.marker = {enabled : false};
})
}
Enjoy!
4 comments
Jeremy Friedel
·2 years agoNo problem DRay
The below updated code works in newer versions of Sisense can be used as a template to hide the labels of specific series in a line chart widget:
A screenshot of hiding one series labels in a line chart while other series are enabled:
This can be modified as needed to work with specific scenarios such as hiding multiple series.
Julia_WK
DRay
·2 years agoJeremyFriedel, Can you provide updated code for this, or know who can?
Julia_WK
·2 years agoUnfortunately this code doesn't work for L2023.11
After any iteration with the widget (resize, print or whatever), widget's layout gets broken.
intapiuser do you have updated code by any chance?
karengonzalez
·3 years agoWorked amazing! Thanks for sharing