SHARE
TWEET
Untitled
a guest
May 26th, 2016
50
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- (function () {
- var app = angular.module('dynamoReports');
- function dynamoGrapherController($scope, $http) {
- /* $scope.dataFromPromise =
- $http
- .get('http://localhost:3000/sessions/')
- .then(function (response) {
- console.log('response', response);
- var data = response.data.items;
- var dataPoints = [];
- data.forEach(function (item) {
- item = JSON.parse(item.ADDITIONAL_INFO);
- var assignmentType = item.assignmentType;
- if (dataPoints[assignmentType]) {
- dataPoints[assignmentType] += 1
- } else {
- dataPoints[assignmentType] = 1;
- }
- });
- var chartData = [];
- for (key in dataPoints) {
- chartData.push({Assignment: key, Count: dataPoints[key]});
- }
- console.log('chart data', chartData);
- return chartData;
- });
- */
- $scope.submitGraphRequest = function () {
- var parameters = [];
- $scope.dataFromPromise =
- $http
- .get('http://localhost:3000/sessions/')
- .then(function (response) {
- console.log('response', response);
- var data = response.data.items;
- var dataPoints = [];
- data.forEach(function (item) {
- item = JSON.parse(item.ADDITIONAL_INFO);
- var assignmentType = item.assignmentType;
- if (dataPoints[assignmentType]) {
- dataPoints[assignmentType] += 1
- } else {
- dataPoints[assignmentType] = 1;
- }
- });
- var chartData = [];
- for (key in dataPoints) {
- chartData.push({Assignment: key, Count: dataPoints[key]});
- }
- console.log('chart data', chartData);
- return chartData;
- });
- };
- $scope.amChartOptions = {
- data: $scope.dataFromPromise,
- type: "serial",
- theme: 'blue',
- categoryField: "Assignment",
- rotate: true,
- pathToImages: 'https://cdnjs.cloudflare.com/ajax/libs/amcharts/3.13.0/images/',
- legend: {
- enabled: true
- },
- chartScrollbar: {
- enabled: true
- },
- categoryAxis: {
- gridPosition: "start",
- parseDates: false
- },
- valueAxes: [{
- position: "top"
- }],
- graphs: [{
- type: "column",
- title: "Count",
- valueField: "Count",
- fillAlphas: 1
- }]
- };
- }
- app.directive('dynamoGrapher', function () {
- return {
- templateUrl: 'templates/dynamoGrapher.tpl',
- controller: dynamoGrapherController
- }
- });
- }());
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
