0

I have an application which is generating random datasets each second like:

Dataset 1:
[{time:"00:00:01",class:"Class_A",stats:"45"}]

Dataset 2:
[{time:"00:00:02",class:"Class_A",stats:"50"},{time:"00:00:02",class:"Class_B",stats:"45"}]

Dataset 3:
[{time:"00:00:03",class:"Class_A",stats:"30"}]

Dataset 4:
[{time:"00:00:04",class:"Class_A",stats:"60"}]

Dataset 5:
[{time:"00:00:05",class:"Class_A",stats:"50"}]

Dataset 6:
[{time:"00:00:06",class:"Class_A",stats:"10"},{time:"00:00:06",class:"Class_B",stats:"60"}]
.
.
.

So, at particular sec a new dataset is generated by the system and we don't know in advance the class whose data will appear e.g. at second 2, dataset contained data of class A and class B both but in next three seconds class B's data did not appear which by the way does not mean that class B's stats is equal to zero. When data for a particular dataset does not appear it should not be plotted at all.

What is the best way to visualize this kind of disjoint data? I was thinking about visualizing it with the help of realtime multi-line chart using d3.js but d3 will expect to have data for each class at a particular instance otherwise it will show it as zero whereas when data is not present its line should not be drawn at all.

1 Answer 1

1

I would show this as points. Before passing the data to d3, reorganise it such that data points for a particular class are together in an array. That is, pass to the .data() function an array of arrays, where the first element of the top level array is an array with the data for Class_A, the second for Class_B and so on.

That way you can simply plot points where they appear without having to worry about gaps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.