Render chart after collection completed

I have a collection that is going to hold 50 objects, each from a separate API call. I want to graph the findings in a pie chart after the collection has all of the data OR in real time, either one works for me. I have gotten real-time line chart to work but I can’t seem to make it work for bar charts.

Can you show us some code so we have a better idea of what you’re trying to accomplish, and what the problem is?

I’m using the Highcharts Meteor package and here is the code for the pie charts they are using:

So, I have a for loop in my server main.js file that inputs the objects into the collection and then, on the client side, I was the pie chart to update automatically.

Maybe this can help you. Take a look at the Tracker.autorun part.

Have you tried to draw this chart feeding it with some static (manually entered within the code) data? Asking this just to be sure that the problem is in getting the data and not chart settings.

Here (blaze) I had similar tasks. I used SubsManager there. To easily check if data is finally loaded is to wait for the onReady event:

App.subs = new SubsManager( {
    cacheLimit: 10,
    expireIn: 1440
} )


App.startsSub = App.subs.subscribe( 'starts', {
    onReady: () => console.log( `[${ loadTimer.duration() }sec] Starts data loaded.` ) 
App.starts = new Mongo.Collection( "starts" )

App here is the global application namespace, it was Meteor 1.2 app. Currently it is better to operate with modules. Pass your drawing function to Tracker and check the value of ready() for your subscription:

Template.templateName.rendered = () => {
    Tracker.autorun( collectFilteredDataAndRedraw )

const collectFilteredDataAndRedraw = () => {
    if ( !App.startsSub.ready() ) return
    < collect data and make drawing here >

Thanks for the answer jhuenges. I looked into it and made it work with Tracker.autorun.