Bug - adding data to existing adapter when scrollable on the X axis


#1

My app refreshes its data in the background. I’m adding a couple of data points (literally, two extra data points) to existing adapter but it looks like they get re-rendered ignoring the currently displayed location on the X axis. 

Here’s an image showing the problem: http://imgur.com/zF5tcqR - it looks like the chart gets re-rendered incorrectly. Further more, one of the two sets of drawn charts (I’m assuming the newly drawn one) does no longer scroll/pan.

My X axis is set up like this:

xAxis.enableBouncingAtLimits(false);
        xAxis.enableGesturePanning(true);
        xAxis.enableGestureZooming(false);
        xAxis.enableMomentumPanning(false);
        xAxis.enableMomentumZooming(false);
        xAxis.allowPanningOutOfMaxRange(false);
        xAxis.allowPanningOutOfDefaultRange(false);

Let me know if you need more details to reproduce this. This is a serious issue that renders this library unusable since realtime updates are a core feature of our app, so I’m hoping for a fix soon…

Thanks,

Radu


#2

I validated this is a bug the following way:

 - if I don’t add any points, no “ghost” drawings appear

 - adding even a single point (using adapter.add) makes the problem appear as well


#3

Maybe it’s useful for reproducing this, I have multiple series with the same Y axis and individual X axes. I’m also tinkering with the default ranges on the X axes to make the different series appear under different “lanes”. It appears those default ranges settings are off for the “ghost” series drawn as they don’t line up perfectly with the initially drawn series.


#4

Hello Radu,

Thanks for getting in touch.

I have tried to recreate your issue today. So what I did is I had 4 charts on the screen side by side. All have the same visible range for the Y (DateTimeAxis) axis. They are synced so that panning / zooming on any chart for the Y axis moves all of them in the same way. On all charts the X axis is a NumberAxis. Each of the charts has slightly different data, to simulate the notion of dynamic data from different feeds. Each chart has 1 LineSeries on it.

So I added a button which adds 2 data points to the third chart, via adding to the DataAdapter in a similar fashion to which you use. So what I did was pan/zoom the third chart slightly to make the visible range on the X axis to be different to that when the chart is first rendered. I then pressed the button and observed the visible range on the x axis resetting to a range akin to a full fresh load of the data. I believe this recreated your issue.

I then added code which stores the visible data range on the x axis before the data points are added. After the data has been added to the DataAdapter I provide code to request that this previous range is once again displayed on the x axis. The result is that when I press the add button, the data is added (can be seen in later pan/zoom action) but the visible range does not change.

Does this sound like the scenario which you describe?

The code I used was:

NumberRange xRange = (NumberRange) charts[2].getXAxis().getCurrentDisplayedRange();

addMoreData(); //adds the data to the DataAdapter

((NumberAxis) chart.getXAxis()).requestCurrentDisplayedRange(xRange.getMinimum(),

                xRange.getMaximum(), false, false);

Please note that this code is crude proof of concept code and is by no means polished! :slight_smile:

I hope you find this information useful. Please get back in touch if you have further queries.

Thanks,

Kai.