cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
This code will index against the first value of a series of a line chart. For example, the first value will always be 100%, then the subsequent values are displayed as a percentage of the initial value.
 
An example from the federal reserve bank of dallas below.
widget.on('processresult', function(w,e) {

  // indexed against first value first series
  var s = e.result.series[0].data;
  var ty = 0;
  var t0 = s[0].y;
 
  for (var i = 0 ; i < s.length ; i++) {
    ty = s[i].y /= t0;
  }

  /*
  If you have more than 1 series copy the code above starting at the comment "// indexed against first value first series" and relable each variable by for example adding a 1 after each variable. Also change the 0 in "e.result.series[0].data" to the relevant series.
  */
});
Rate this article:
Version history
Last update:
‎03-02-2023 09:19 AM
Updated by:
Contributors