AjaxDataSource max_size causing larger than expected deletions

Hello.

I’m facing an unexpected (at least for me) behaviour.

I have a bokeh plot taking it’s data from an AjaxDataSource like this:

AjaxDataSource(data=pdata,

``

           data_url='/my_json_url',
           polling_interval=refresh_rate,
           method='GET',
           mode='append')

``

And it works like a charm, a first data set (pdata) is loaded and at each refresh new points come to my plot.

The problem comes when I include a max_size parameter (to avoid my plot becoming too big):

AjaxDataSource(data=pdata,

``

           data_url='/my_json_url',
           polling_interval=refresh_rate,
           method='GET',
           mode='append',
           max_size=1000)

``

It starts OK, but the first time it reaches max_size, it deletes the first data set as a whole.

Is this somehow the expected behaviour?

Thanks!

Hi,

The intent is definitely that the data should "roll over", i.e. as new data comes in, earlier data points are dropped as necessary to keep column lengths under max_size. From your I'm not sure if that is what you are seeing or not. Maybe some scenarios will help elucidate the expected behavior:

* First pull gets 600 items, CDS columns have length 600.

* Next pull gets 600 items, this plus the first data is greater than max_size, so the first 200 points are discarded. CDS columns have length 1000

* Next pull gets 1300 items, this is greater than max_size all by itself. All the previous date is discarded as well as 300 points from this pull to keep column lengths at 1000

If that's the kind of thing you are seeing, I'd say that is expected. If you mean that you are at exactly max_size, and get one more item and that causes everything to be blown away somehow, then that is not expected, and a GH issue (with a complete code sample to reproduce and more detailed info about exactly how much data is coming in and in what order) would be appropriate.

Thanks,

Bryan

···

On Aug 9, 2017, at 10:30, [email protected] wrote:

Hello.

I'm facing an unexpected (at least for me) behaviour.

I have a bokeh plot taking it's data from an AjaxDataSource like this:

AjaxDataSource(data=pdata,
               data_url='/my_json_url',
               polling_interval=refresh_rate,
               method='GET',
               mode='append')

And it works like a charm, a first data set (pdata) is loaded and at each refresh new points come to my plot.

The problem comes when I include a max_size parameter (to avoid my plot becoming too big):

AjaxDataSource(data=pdata,
               data_url='/my_json_url',
               polling_interval=refresh_rate,
               method='GET',
               mode='append',
               max_size=1000)

It starts OK, but the first time it reaches max_size, it deletes the first data set as a whole.

Is this somehow the expected behaviour?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/15b99d34-c566-41f9-b444-6693e6be7af6%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

I’ve finally found the problem and it was just my fault :S

I was appending lots of duplicated data points and, as they where overlapping in the graphs, I didn’t notice.

Everything is perfectly working now.

I’m going to extensively use Bokeh in a quite big project, so I promise I’ll do my best to become an active member in the community.

Thank you very much for your quick answer and sorry for wasting your time in this case.

Best regards.

···


Pablo Manuel García Corzo

Solutions Architect

Linkedin profile
Twitter profile
Santa Leonor, nº 65 Edif. C 4th fl.
28037 Madrid · Spain

www.blue-tc.com

+34 654 638 509
+34 91 754 04 44

[email protected]

This email and any attachments are intended solely for the use of the individual(s) to whom it is addressed. Full email disclaimer.

Please do not print this email if not necessary, saving paper protects the environment