Hi @jhuenges,
Thanks a lot for taking to look!
Iām trying to draw a column chart with this chart data:
Template.claimChart.onRendered( function () {
Tracker.autorun( function () {
var JanClaim = ( Claim.find( {
dateFiled: {
$gt: new Date( '01/01/2015' ),
$lt: new Date( '02/01/2015' )
}
} ).count() );
var FebClaim = ( Claim.find( {
dateFiled: {
$gt: new Date( '02/01/2015' ),
$lt: new Date( '03/01/2015' )
}
} ).count() );
var MarClaim = ( Claim.find( {
dateFiled: {
$gt: new Date( '03/01/2015' ),
$lt: new Date( '04/01/2015' )
}
} ).count() );
var AprClaim = ( Claim.find( {
dateFiled: {
$gt: new Date( '04/01/2015' ),
$lt: new Date( '05/01/2015' )
}
} ).count() );
var MayClaim = ( Claim.find( {
dateFiled: {
$gt: new Date( '05/01/2015' ),
$lt: new Date( '06/01/2015' )
}
} ).count() );
var JuneClaim = ( Claim.find( {
dateFiled: {
$gt: new Date( '06/01/2015' ),
$lt: new Date( '07/01/2015' )
}
} ).count() );
var JulyClaim = ( Claim.find( {
dateFiled: {
$gt: new Date( '07/01/2015' ),
$lt: new Date( '08/01/2015' )
}
} ).count() );
var AugClaim = ( Claim.find( {
dateFiled: {
$gt: new Date( '08/01/2015' ),
$lt: new Date( '09/01/2015' )
}
} ).count() );
var SeptClaim = ( Claim.find( {
dateFiled: {
$gt: new Date( '09/01/2015' ),
$lt: new Date( '10/01/2015' )
}
} ).count() );
var OctClaim = ( Claim.find( {
dateFiled: {
$gt: new Date( '10/01/2015' ),
$lt: new Date( '11/01/2015' )
}
} ).count() );
var NovClaim = ( Claim.find( {
dateFiled: {
$gt: new Date( '11/01/2015' ),
$lt: new Date( '12/01/2015' )
}
} ).count() );
var DecClaim = ( Claim.find( {
dateFiled: {
$gt: new Date( '12/01/2015' ),
$lt: new Date( '01/30/2016' )
}
} ).count() );
function chartColumn() {
$( '#claimChart' ).highcharts( {
chart: {
type: 'column'
},
title: {
text: 'Monthly Total Cause of Death/Medical Claims'
},
// subtitle: {
// text: 'Source: WorldClimate.com'
// },
credits: {
enabled: false
},
xAxis: {
categories: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec'
]
},
yAxis: {
min: 0,
title: {
text: 'Total Numbers'
}
},
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y} </b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
series: [ {
name: 'Cardiovascular',
data: [ JanClaim, FebClaim, MarClaim, AprClaim,
MayClaim, JuneClaim,
JulyClaim, AugClaim, SeptClaim, OctClaim,
NovClaim,
DecClaim
]
}, {
name: 'Respiratory',
data: [ 83.6, 78.8, 98.5, 93.4, 106.0, 84.5, 105.0,
104.3,
91.2,
83.5, 106.6, 92.3
]
}, {
name: 'Renal failure',
data: [ 48.9, 38.8, 39.3, 41.4, 47.0, 48.3, 59.0,
59.6,
52.4,
65.2, 59.3, 51.2
]
}, {
name: 'Cancer',
data: [ 42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4,
60.4,
47.6,
39.1, 46.8, 51.1
]
}, {
name: 'Accident',
data: [ 42.4, 33.2, 50, 39.7, 52.6, 75.5, 54.4, 60.4,
47.6,
39.1,
46.8, 51.1
]
}, {
name: 'Diabetes',
data: [ 42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4,
60.4,
47.6,
39.1, 46.8, 51.1
]
}, {
name: 'Animal/Insect bite',
data: [ 42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 60.4,
60.4,
47.6,
40.1, 46.8, 51.1
]
}, {
name: 'Liver illness',
data: [ 42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4,
60.4,
47.6,
39.1, 46.8, 51.1
]
}, {
name: 'Hypertension',
data: [ 42.4, 33.2, 34.5, 39.7, 52.6, 85.5, 57.4,
60.4,
47.6,
39.1, 46.8, 51.1
]
}, {
name: 'CVA,Chronic Kidney disease',
data: [ 42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4,
60.4,
47.6,
39.1, 46.8, 51.1
]
}, {
name: 'Abration',
data: [ 42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4,
60.4,
47.6,
39.1, 46.8, 51.1
]
}, {
name: 'Others',
data: [ 42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4,
60.4,
47.6,
39.1, 46.8, 51.1
]
} ]
} );
}
chartColumn();
} );
} );
});
Youāve noticed, I have this variable āJanClaim, FebClaim, etcā¦ā, this is a working data that Iāve wrapped in an autorun function to be reactive, the chart is actually populating with this data but itās not the intended output, itās more complicated as I stated above, which is to count the total number of cause of death or medical claims per month.
If you analyze the problem, all the causes will not be populated in a month. Thereās a possibility of one or more fields are zero data in a month.
Iāve seen your meteorpad sample and it still works with the latest meteor version.
Thanks Again!