Hello, I can not create a chart line using the Highcharts plugin, where the X axis is separated by months (Jan, Feb, etc ...) and the Y axis is the number of new clients based on these months.
Below is how my json is formed.
[{
"newCustomers": "1",
"creationDate": "2017-08-07 09:33:18"
}, {
"newCustomers": "1",
"creationDate": "2017-08-07 17:35:28"
}, {
"newCustomers": "1",
"creationDate": "2017-08-07 17:52:45"
}, {
"newCustomers": "1",
"creationDate": "2017-08-08 18:08:16"
}, {
"newCustomers": "1",
"creationDate": "2017-08-09 15:41:03"
}, {
"newCustomers": "1",
"creationDate": "2017-08-09 16:13:48"
}, {
"newCustomers": "1",
"creationDate": "2017-08-09 16:17:18"
}, {
"newCustomers": "1",
"creationDate": "2017-08-10 09:47:40"
}]
I would like to get the above data and put it in the format below. Where the "date" parameter of "series" would be the number of new clients and the X-axis would be the "creationDate" formatted and separated by month "Jan, Feb, etc."
Highcharts.chart('container', {
chart: {
type: 'line'
},
title: {
text: 'New Customers Per Month'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis: {
title: {
text: 'New customers'
}
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: false
}
},
series: [{
name: 'BEARLabs',
data: [7, 6, 9, 14, 18, 21, 25, 26, 23, 18, 13, 9]
}]
});