Skip to main content
1-Visitor
January 30, 2014
Question

Add limit lines to a Time Series Chart

  • January 30, 2014
  • 2 replies
  • 4565 views

What is the best way to add limit lines to a Time Series Chart?  I have a property of my Thing that is an upper limit and I would like to display that on a Time Series chart along with the time varying data.

Thanks

Loren

2 replies

5-Regular Member
January 31, 2014

Hi Loren,

The easiest (and only) way to add limit lines to a Time Series Chart is to add an additional column to your data containing the limit value for each record. Depending on your current implementation, you may need to create a wrapper Service that adds the additional column or modify your existing Service. In both cases, you'll want to use

DeriveFields()

to add the additional column. The code snippet for

DeriveFields()

is available from the Snippets tab.


DeriveFields()

 takes an expression parameter, which you can use to perform a calculation or simply pass in a numeric constant.


Thanks,

Adam



1-Visitor
November 11, 2015

Hi Adam,

DeriveFields()​​'s expression parameter accept only a constant value, or a calculation based on existing fields of data. How can I use a variable in expression parameter, for example, a limit given by user ? I tried to give the name of the variable, and I get the error "Script evaluation error : ReferenceError: "myLimit" is not defined."

Thanks,

Quang-Dung

1-Visitor
November 11, 2015

Derive fields can take 'any expression' like .5*[FieldName] to create a value based on a column of the table.

or even Things[MyCalculator].LimitCalc({Parameter:[FieldName]}) to invoke a service.

1-Visitor
April 19, 2017

Can someone actually help me to use a property to put an upper limit on time series? Please guide me on how to use DeriveFields to use a parameter and how to further use it?

1-Visitor
April 19, 2017

If your Thing is "MyThing" and the property "UpperLimit" is the limit for the Time Series Chart, you can use the code below to add the column limit to your data before return to the chart:

var data = ...;

var params = {

  types: "NUMBER" /* STRING */,

  t: data /* INFOTABLE */,

  columns: "limit" /* STRING */,

  expressions: 'Things["MyThing"].UpperLimit' /* STRING */

};

var result = Resources["InfoTableFunctions"].DeriveFields(params);