Live updating chart


#1

Is it possible to establish a connection from a web front end to a MapD table such that when the table receives new data the chart automatically updates?

I have established a connection (following some of the example charts) in the following way:

new MapdCon()
            .protocol("http")
            .host("url")
            .port("9092")
            .dbName("name")
            .user("id")
            .password("password")
            .connect(
                function(connectError, session) {
                    if (connectError) {
                        return console.error("Error connecting", connectError);
                    }

                    crossfilter.crossfilter(session, "table_name").then(createHeatMap);
                }
            );

I have a heatmap chart on a webpage I would like to update as new data is added to the database. I am working on setting up my own polling at 1-2 second intervals using the connection above, but if possible I would prefer the database push new data instead of being polled.


#2

Hi,

There is no DB push. Your approach of polling is your best option for now. Normally we would only redraw if something has changed so tracking something like count of rows and only redraw if count has changed is very light weight.

Regards


#3

The table will be receiving data on the order of 1,000-20,000 rows per second, so I feel pretty safe redrawing without checking for a change in count. Is pushing on the map for future implementation?


#4

There is an Immerse PR in review that’ll set this auto-refresh. Though still done with polling, it has also the prudent safeguard of not issuing a new request if there is still a request outstanding. Otherwise you run the risk that if your query time is longer than your refresh request interval than you’ll have a pileup of requests.


#5

Thanks @billmaimone.

Follow up question, when setting up my polling I was unable to get the expected behavior using the session connection shown in my original post. Instead I am attempting to use code from the documentation to execute a query, however I receive the following error:
TypeError: this._client[conId] is undefined

I am using the exact same connection parameters as I am when I successfully connect using the code in my original post. Any insights on what could be causing the issue?