Encoding Custom channels

A developer can provide custom channels that can be attached to their specified audio filters.

Make sure that always specify the range of your scale, otherwise it might fail to render.

Custom channel API usage

JSON

{
  ...
  "encoding" : {
    "gain2": {
      "field": "Body Mass (g)",
      "type": "quantitative",
      "scale": {
        "doamin": [0, 7000], // optional
        "range": [0, 1] // required
      }
    }
  }
  ...
}

JavaScript

// this is a bit extended usage case for extra safety.
class Gain2Channel extends Erie.Channel {
  constructor(f, t) {
    super(f, t);
    this._channel = 'gain2';
  }

  validator(v) {
    return ... ; // validates a range value
  }
}

let stream = new Erie.Stream();
...
stream.encoding.gain2 = new Gain2Channel();
// alternatively, (it does not check the range values)
// stream.encoding.gain2 = new Erie.Channel("gain2");
stream.encoding.gain2.domain([0, 7000]);
stream.encoding.gain2.range([0, 1]);
...
© Hyeok Kim