analytic Coffee!
  • Topical Tessitura Community Groups
  • More
analytic Coffee!
Wiki RSUM continuous chart, remove gaps
  • Discussions
  • Files
  • Wiki
  • Members
  • Mentions
  • Tags
  • Events
  • More
  • Cancel
  • New
analytic Coffee! requires membership for participation - click to join
  • analytic Coffee! Wiki
  • +Tessitura Analytics Shared Dashboards
  • +Data Analysis Training Opportunities
  • -Analytics Tips & Trouble shooting
    • Analytics Scripts not Saving
    • Auto-Zoom Scatter Map
    • Changing Labels on a Graph
    • Conditionally format the color of text
    • First Time Buyers and Subsequent Buying
    • Fixing Tessitura Analytic Emails after an upgrade
    • Joining Isolated Data-points, Removing Data Markers, Interpolating Last Point
    • Milestones: Labelled Data Points on Analytics Charts
    • RSUM continuous chart, remove gaps
    • Scatter Map Widget tips - Heat Map of postal codes
    • Sorting First Performance Name by Date Instead of Alphabetically
    • Troubleshoot Data Warehouse Load
    • Troubleshooting Application Availability
  • Jupyter Notebooks
  • Learning about AI
  • +Learning about Python
  • +Power BI & Tessitura

RSUM continuous chart, remove gaps

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

  • Tessitura Analytics
  • script
  • Javascript
  • Share
  • History
  • More
  • Cancel
Related
Recommended