Waheed Mohammad Waheed Mohammad - 1 month ago 17
Javascript Question

Angular Google colomn Chart

Here i'm new for this Google column chart i Pasted some code from AGC but why its not Generating Chart

Bar.cshtml

<div google-chart chart="myChartObject" width:100%;"></div>
@section scripts{
<script src="~/Scripts/Charts/BarCharts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-google-chart/0.1.0/ng-google-chart.js" type="text/javascript"></script>}


MyApp.cshtml

var app = angular.module('MyApp', [])
app.filter('ctime', function(){

return function(jsonDate){

var date = new Date(parseInt(jsonDate.substr(6)));
return date;
}
})


Javfile.Js

var app = angular.module("MyApp", ['googlechart']);
app.controller("GenericChartCtrl", function ($scope) {
$scope.myChartObject = {};

$scope.myChartObject.type = "ColumnChart";

$scope.onions = [
{ v: "Onions" },
{ v: 3 },
];

$scope.myChartObject.data = {
"cols": [
{ id: "t", label: "Topping", type: "string" },
{ id: "s", label: "Slices", type: "number" }
], "rows": [ {
c: [ { v: "Mushrooms" }, { v: 3 },]},{ c: $scope.onions },{c: [{ v: "Olives" }, { v: 31 }]}

Answer
<div google-chart chart="myChartObject" style="width:100%;" ng-controller="GenericChartCtrl">

</div>

Try this i hope it will work