This is a migrated thread and some comments may be shown as answers.

use websocket as chart datasource and refresh as data changes

3 Answers 162 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Vedad
Top achievements
Rank 3
Bronze
Bronze
Iron
Vedad asked on 29 Aug 2019, 02:51 PM

Hi, 

I managed to combine something and have chart bound to same websocket ds as grid in your demo. 

Read method gets data and draws pie chart, but when I update data via grid, nothing happens.

After some investigation it seems, pushUpdate in transport causes error causing chart not to update.

on this part: 

  //Check what the push type is and invoke the corresponding callback.
                                if (result.type == "push-update") {
                                    options.pushUpdate(result);        
                              } 

This is error I get in demo:

kendo.all.js:7092 Uncaught TypeError: Cannot read property 'call' of undefined
    at Object.<anonymous> (VM30647 kendo.all.min.js:28)
    at Function.Deferred (VM30646 jquery.min.js:2)
    at init._promise (VM30647 kendo.all.min.js:28)
    at init._send (VM30647 kendo.all.min.js:28)
    at init.sync (VM30647 kendo.all.min.js:28)
    at init._change (VM30647 kendo.all.min.js:28)
    at init.d (VM30646 jquery.min.js:2)
    at init.trigger (VM30647 kendo.all.min.js:25)
    at o.<anonymous> (VM30647 kendo.all.min.js:27)
    at o.trigger (VM30647 kendo.all.min.js:25)

 

Is there any different approach I can/should take so I can have real time updates on the chart?

Thank you and regards,

Vedad

3 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 02 Sep 2019, 10:07 AM

Hi Vedad,

 

Based on the available information it would be hard to pinpoint what is causing the behavior. Would you send us a dojo sample or a runnable project where the issue is replicated? This will enable us to examine the behavior locally and look for its cause.

 

Regards,
Viktor Tachev
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Vedad
Top achievements
Rank 3
Bronze
Bronze
Iron
answered on 03 Sep 2019, 12:40 PM

Hi Viktor,

sorry for lack of information.

Unfortunately, I don't have code anymore as I was playing with websocket grid dojo and added chart above. I used same datasource for both, and I was getting this error.

Eventually I went with slightly different approach and closed this Dojo. 

I will try to reproduce it again and save the Dojo.

Is there any recommended approach for Charts when using websocket as datasource?

Thank you and regards,

Vedad

0
Viktor Tachev
Telerik team
answered on 05 Sep 2019, 08:30 AM

Hello Vedad,

 

I am glad to hear that you have found an approach that works for your scenario.

With that said, the Chart widget expects the data to be formatted as expected by the specific series that would be shown. As long as the data is returned in the correct format the Chart would display the results as expected.

 

Regards,
Viktor Tachev
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Charts
Asked by
Vedad
Top achievements
Rank 3
Bronze
Bronze
Iron
Answers by
Viktor Tachev
Telerik team
Vedad
Top achievements
Rank 3
Bronze
Bronze
Iron
Share this question
or