14 Replies Latest reply on Apr 19, 2017 8:12 AM by qngo RSS
    lorenmc Explorer

    Add limit lines to a Time Series Chart

    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



      • Add limit lines to a Time Series Chart
        adam Creator

        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



        • Re: Add limit lines to a Time Series Chart
          wahmed Newbie

          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?

            • Re: Add limit lines to a Time Series Chart
              qngo Creator

              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);