Smart UI Components & Libraries – Grid, Scheduler, Gantt, Kanban for Angular, React, Next.js, Vue, Blazor, JavaScript › Forums › Charts & Data Viz › Pass multiiple json data to create graph
Tagged: Chart JSON
- This topic has 3 replies, 2 voices, and was last updated 3 years, 1 month ago by
ivanpeevski.
-
AuthorPosts
-
September 30, 2022 at 12:38 am #103780
salasidis
ParticipantMy embedded CPU has a poor implementation for the async Web server, in that it uses heap space to recreate a valid json file that is to be replied back when a request for a graph is made.
The graph has to have up to 2 years of data, and can be about 2Mb. There is enough SDRAM to hold it, but not enough microcontroller RAM (the CPU allocates regular RAM at 2x-3x the size of the string passed).
Assuming the library creator is unable to optimize this, my only solution is to break up the 2 years of graph into 24 month JSON strings – and send them individually.
I am using JQuery. Is there a best way you can see how this should be implemented, and can the data be passed to the chart elements one month at a time, or should the entire array be concatenated before sending to the chart.
Thanks
September 30, 2022 at 4:26 pm #103791ivanpeevski
ParticipantHi salasidis,
You can have a look at the code for the Live Update demo.
You can just push the next month data one by one in the dataSource, but the chart will draw them only if you call chart.update() after that
Best Regards,
Ivan PeevskiSmart UI Team
https://www.htmlelements.com/September 30, 2022 at 6:02 pm #103795salasidis
ParticipantThanks, that would work.
I commented out the data.splice function in the demo, as I would want to display all the data all at once. The X axis gets very crowded, and does not seem to update the distance between labels, etc.
Is there a way to do this.
Also presumably in my application, I could just push the data x 24 or so times, and do a single update at the end (should be faster).
September 30, 2022 at 9:30 pm #103799ivanpeevski
Participant<div class=”bbp-voting bbp-voting-post-103791 view-only bbp-voting-float”></div>
Hi salasidis,The X axis in the demo looks crowded because xAxis -> unitInterval is set to 1. This forces the chart to show every single x Axis element. If you remove that, it will be automatic and will update the distance between the labels.
Best Regards,
Ivan PeevskiSmart UI Team
https://www.htmlelements.com/ -
AuthorPosts
- You must be logged in to reply to this topic.