You are currently reviewing an older revision of this page.
This script will connect the data points surrounding a gap in the data. The drawback of this script is that it will draw a straight line between the two points, a tapered line over the missing series, making it possible to interpret that span of time as a regular increase over the series that have no values. In reality, repeating the previous non-null value over the series gaps that have no values would be more accurate, followed by a jump up to the next non-null value.
widget.on("beforeviewloaded",function(scope, args){args.options.plotOptions.series.connectNulls = true;});widget.on('render', function(sender,se){for (var i = 0; i < sender.queryResult.series.length; i++ ) { for (var j = 0; j < sender.queryResult.series[i].data.length; j++) { sender.queryResult.series[i].data[j].marker.enabled = false; } }})
This script is an improvement in that the value over the gap between two data points is a repeat of the last non-null value, followed by a jump up to the next non-null value. However, this formula doesn't differentiate between a future time period that can't yet have data, and a past time period that legitimately had no data. This results in the line continuing on to the end of the chart regardless of whether those periods are in the past or future. We can probably figure out how to get the curve to stop at the final/last value, but that final/last value is still susceptible to being a past value that legitimately has no data and will fail to reflect that there has been no data since that past moment in time.
widget.on('processresult', function(se, ev){ $.each(ev.result.series, function(seriesIndex, seriesValue){ var prevValue = seriesValue.data[0].y; $.each(seriesValue.data, function(index, value){ if(value.y == null) value.y = prevValue; else prevValue = value.y; }); });}); widget.on('render', function(sender,se){ for (var i = 0; i < sender.queryResult.series.length; i++ ) { for (var j = 0; j < sender.queryResult.series[i].data.length; j++) { sender.queryResult.series[i].data[j].marker.enabled = false; } }});
How to apply it to the widget...
(+) Analytics Scripts not Saving - Wiki - analytic Coffee! - Tessitura Community