Function subtract

  • Arbitrary subtract one value from another.

    If the value l is of type Date, subtracts r units from it. t becomes the unit. For example subtract(dt, 3, 'week') will subtract 3 (r = 3) weeks (t= 'week') from dt.

    If l is of type numeric, t is ignored. In this case if r is of type string, it is assumed to be percentage (whether or not it includes %). For example subtract(30, 10) will give 20 and subtract(30, '10') will give 27.

    They also generate strange results if l is a string.

    Method

    subtract

    Parameters

    • l: any

      the value to modify

    • r: any

      the amount by which to modify the value

    • Optional t: any

      if l is a Date, then this should be a d3 time interval. For backward compatibility with dc.js 2.0, it can also be the name of an interval, i.e. 'millis', 'second', 'minute', 'hour', 'day', 'week', 'month', or 'year'

    Returns any

Generated using TypeDoc