'FusionCharts/FusionTime stepline chart leaves off data points and binning aggregation distorts the data

I'm trying to reproduce a Pillow app timeline chart using FusionTime. Pillow tracks sleep quality and the different sleep stages using Apple Watch. The following is an example chart:

example Pillow chart

From the app you can export a json file with the data points. For example:

"sleepStageDataPoints": [
    {
        "stage": 1,
        "timeStamp": 673239278.32947648
    },

`Stage legend: 0=Deep, 1=Light, 2=REM, 3=Awake

I import the data into mysql, converting the Unix time in the process. I also increment the stage number so that Deep=1, etc., because the axis would be 0 in FusionTime.

So there is a start time and the level of the stage at that time, which remains the level until the next timestamp data point where the stage would change, etc.

Besides this metric, there will be other health related metrics I plan to capture that will model the data in a similar way. Only the starting time and the level at that time, which should remain the same until the next data point.

So that's the general plan. Now the problems...

I'm having trouble figuring out the best way. I think stepline would be the best chart type for this source data. I'm not expecting to be able to have the different stages have different colors. Just being able to see the height differences is sufficient.

But FusionTime doesn't show all of the data points and the ones it does show don't seem to be accurate. I'm blaming data binning.

FusionTime chart

As you can see the first point charted is on May 3rd, 12:24-12:26. But there are 5 data points from May 2nd that it just leaves off. I don't know why. And as you can see from comparing the two charts, the patterns don't match. For instance at 1am the Fusion chart says the level would be REM (3), but if you look at the Pillow chart, it would have to be either Deep (1) or Light (2). Looking at the data points in the database confirms that.

So it has to be the data binning aggregation that is changing the chart. I've tried every aggregation other than average and none of them makes a difference.

I'd like for the data to be 100% time accurate. I want to see every datapoint and not have the first ones disappear. If I mouse over 1am I should see the correct stage level for that time. As I zoom in or out, I'd like the columns to get more wide/narrow as appropriate, but the height should never be wrong. If I zoom too far out, I'd rather the data disappear than be wrong. I'd be fine to lock the zoom level if necessary, not that I know how to.

Is this possible with FusionCharts/FusionTime? Would there be a better chart type to accomplish what I'm trying to do? Is there a different charting software that would do this? I want to use FusionTime, because I want to have the multivariate charts to compare multiple metrics along the same timeline. And I do want to be able to zoom in and out because other metrics I'm tracking wouldn't be limited to this time frame. So I need to be able to zoom/scroll through the entire day.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source