I have to use the Google Line Chart for Angularjs. I use the below mentioned code. Even though I have data for X axis and Y axis, I am not able to see the X axis label for dates all the time( it shows up sometime, but If my data is for an year or so the X axis doesn't show up).
Please se the attached file screenshot.
$scope.chartObject = {
"type": "LineChart",
"displayed": true,
"data": {
"cols": [
{
"label": "Month",
"type": "number", // <-- this comma
},
{
"label": "Weight",
"type": "number", // <-- this comma
}
],
"rows": chartdata
},
"options": {
"title": "Weight per month",
"isStacked": "true",
"fill": 20,
"displayExactValues": true,
"vAxis": {
"title": "Sales unit",
"gridlines": {
"count": 10
}
},
"hAxis": {
"title": "Date", // <-- this comma
}
},
"formatters": {}
}
My JSON Data that I prepare is as follows:
function processArrayForWeight(json) {
var chartData = [];
for (var i = 0; i < json.length; i++) {
if (json[i].Weight != null) {
chartData.push
({
c: [
{ v: formatDate(new Date(json[i].EventTime)) },
{ v: json[i].Weight }
]
});
}
}
return chartData;
}
function formatDate(date)
{
return (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();
}
I have few other queries as well which are as follows:
I have to show a Google cart with two Y axis where I have to show the Y axis as shown in the screenshot ( chart Required with two Y axis where both Y axis will plot two separate numerical value sets) . How can I achieve it for Google Angular Line Chart Directive.
I have to show points on the Line Chart as shown in the screenshot "Chart with Points plotted on Line Graph" . Please let me know how I can achieve it on Line Chart Directive.
Please let me know your suggestions.
Let me know if you need any more information.
Many Thanks in advance.
Regards
Bipul Kumar
Accenture Pvt Services