Skip to content

Created addData method #218

@Marco-Sulla

Description

@Marco-Sulla

I created an addData method, useful if you want append new data instead of replace it entirely.
This is useful to me because server does not send 1 datum to my clients every 1 second, but it sends an array of data every 50 seconds. So I can't use time.line.

Code is written in Javascript. I do not know CoffeScript, so I can't create a pull request.

  Base.prototype.addData = function(data, options) {
    var prepared;
    if (options == null) {
      options = {};
    }
    prepared = this._prepareData((this.rawData = this._formatData(data)));

    var values;
    var toadd_values;
    var add_data = this._annotateLayers(prepared);

    for (var i=0; i<this.data.length; i+=1) {
        values = this.data[i].values;
        toadd_values = add_data[i].values;

        values.push.apply(values, toadd_values);
    }

    return this.data;
  };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions