1
Hello, I can’t create a Chart line using the plugin Highcharts, where the X-axis is separated by months (Jan, Feb, etc...) and the Y-axis is the number of new customers based on those 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 take this data above and put it in the format below. Where in the "date" parameter of "series" would be the amount of new customers and in the X axis, it 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]
}]
});
Could you input the source code you tried? The problem is grouping?
– rray
I put @rray there.
– Cesar Augusto
This chart will display the one-year values only?
– rray
Yes, only one year. Let’s say from Jan/2017 to Dec/2017
– Cesar Augusto