cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
In some cases, we might want to compare a metric against the average but if the average does not have a result for the entire x-axis (numerator does not have a value for each point in the x-axis but the denominator does), then the average line (Mean and Mean Upper Threshold) will be chopped up as seen below.
Without the script:
The script below will fill out the average line across the entire x-axis as seen below.
With the script:
var series1 = 3;
var series2 = 4;

// Set markers enabled to false for a series
function setMarker(array, enabledFlag) {
for ( var i = 0; i < array.length; i++) {
array[i].marker.enabled = false;
}

}

widget.on('render', function(sender,se){

// edit index of series to select the series you want to turn off markers for
setMarker(sender.queryResult.series[series1].data, false);
setMarker(sender.queryResult.series[series2].data, false);
})

 

widget.on('processresult',function(se,ev){

var s = ev.result.series[series1].data;
fillLine(s);

var s = ev.result.series[series2].data;
fillLine(s);

})


//Functions find the first value and fills the array with this value


function fillLine(s) {


function findValue(v) {
if (v.y) {
return v.y;
}
}

var found = s.find(findValue);

function setAll(a, v) {

var i, n = a.length;
for (i = 0; i < n; ++i) {
a[i].y = v.y;
}
}

setAll(s,found);

}
Version history
Last update:
‎03-02-2023 09:16 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: