Skip to content

JSON Format #171

Description

@Borreguin

I would like to know if this format is compatible with the crossfilter:
{"timestamp": ["2013-11-01 00:00:00", "2013-11-01 01:00:00", "2013-11-01 02:00:00", *...], "V1": [24, 24.7, 24.2, *... ], "V2": [511.32, 509.7, 507.3, ...], "V3": [26.1, 26.1, 26.2, *... ]}
*... -> it continues (larger data)

If I send my data in this way I'm able to send more values in compact way instead to use:
{{"timestamp": "2013-06-01,'V1': 25.5, 'V2': 52.6 }, {"timestamp": "2013-06-02,'V1': 25.5, 'V2': 52.6 }} , etc

Could you suggest me something about? (by he way in the first format, the data is order by time)

Thanks,
Roberto

Activity

  1. gordonwoodhull commented on Nov 3, 2016

    @gordonwoodhull

    Stack Overflow is a better place for asking support questions.

    But yes, you can use data like this. Just supply an array of indices as your data to crossfilter. Then write your dimension and group accessors to use the index to fetch data from the original arrays.

    Something like:

    var N = data.timestamp.length;
    var r = _.range(N); // [0,1,2,...,N-1]
    var ndx = crossfilter(r);
    var V1dim = ndx.dimension(function(d) { return data.V1[d]; });
    var sumV2perV1 = V1dim.group().reduceSum(function(d) { return data.V2[d];});

    Downside is that you won't find a lot of examples of people using crossfilter this way, so you'll have to translate everything. It might be easier to send your data over the wire as object of arrays, and then rotate it into an array of objects in JavaScript, and probably not too expensive unless your data is huge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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