Angularjs 获取角度谷歌图表生成双轴图表时遇到问题
我很难让谷歌角形图表生成具有两个y轴刻度的图表。我在网上尝试过许多直接使用谷歌图表的例子,但都没有成功。我已经包括了我认为是一个简单的例子。此代码位于控制器内部。这是我的密码:Angularjs 获取角度谷歌图表生成双轴图表时遇到问题,angularjs,charts,google-visualization,Angularjs,Charts,Google Visualization,我很难让谷歌角形图表生成具有两个y轴刻度的图表。我在网上尝试过许多直接使用谷歌图表的例子,但都没有成功。我已经包括了我认为是一个简单的例子。此代码位于控制器内部。这是我的密码: (function () { 'use strict'; angular .module('core') .controller('DashboardErrorRatesController', DashboardErrorRatesController); DashboardErrorR
(function () {
'use strict';
angular
.module('core')
.controller('DashboardErrorRatesController', DashboardErrorRatesController);
DashboardErrorRatesController.$inject = ['$rootScope', '$scope', '$state', '$timeout', '$interval', 'Authentication', 'locale', 'Common', 'Query', 'googleJsapiUrl'];
function DashboardErrorRatesController($rootScope, $scope, $state, $timeout, $interval, Authentication, locale, Common, Query, googleJsapiUrl) {
$scope.myChartObject = {
type: 'LineChart',
displayed: false,
chartArea: { left: 100, top: 100, width: 400, height: 450 },
data: {
cols: [
{
id: 'issues',
label: 'Issues per Week',
type: 'string'
},
{
id: 'pct_people',
label: '% of People',
type: 'number'
},
{
id: 'avg_excallations',
label: 'Average Escallations',
type: 'number'
}
],
rows: [
{ 'c': [{ 'v': '0' }, { 'v': 0.39 }, { 'v': 0 }] },
{ 'c': [{ 'v': '1' }, { 'v': 0.17 }, { 'v': 31.063636363636363 }] },
{ 'c': [{ 'v': '2' }, { 'v': 0.12 }, { 'v': 30.46086956521739 }] },
{ 'c': [{ 'v': '3' }, { 'v': 0.09 }, { 'v': 49.612360674157316 }] },
{ 'c': [{ 'v': '4' }, { 'v': 0.06 }, { 'v': 26.975 }] },
{ 'c': [{ 'v': '5' }, { 'v': 0.04 }, { 'v': 32.82588235294117 }] },
{ 'c': [{ 'v': '6' }, { 'v': 0.03 }, { 'v': 25.413886666666667 }] },
{ 'c': [{ 'v': '7' }, { 'v': 0.03 }, { 'v': 35.716933333333344 }] },
{ 'c': [{ 'v': '8' }, { 'v': 0.02 }, { 'v': 11.689516129032258 }] },
{ 'c': [{ 'v': '9' }, { 'v': 0.01 }, { 'v': 10.20833125 }] },
{ 'c': [{ 'v': '10' }, { 'v': 0.01 }, { 'v': 29.311111111111114 }] },
{ 'c': [{ 'v': '10+' }, { 'v': 0.05 }, { 'v': 24.697815555555554 }] }
],
options: {
title: 'Something',
isStacked: false,
width: 300,
height: 600,
vAxis: {
0: {
title: '% of People',
format: '#%'
},
1: {
title: 'Average Escallations',
format: '#,###.##'
}
},
hAxis: {
title: 'Issues per Week'
},
seriesType: 'bars',
series: {
0: { targetAxisIndex: 0 },
1: { targetAxisIndex: 1 }
}
},
formatters: {}
}
};
}
}());
我认为这应该会产生一个有两个轴的图表,但是没有。这几乎和google图表库(0.1.0)使用的是google图表的旧版本一样,但我无法理解这一点
以下是html:
<div google-chart chart="myChartObject"></div>
我想出来了!我将类型从“折线图”更改为“组合图”。这花了很长时间。我讨厌这种事发生。我想出来了!我将类型从“折线图”更改为“组合图”。这花了很长时间。我讨厌这种情况。你在谷歌图表中使用角度指令吗?这看起来像是角度谷歌图表。你能提供更多的代码(视图/html)或创建一个Plunkr吗?嘿,Tah,谢谢!。我已经添加了控制器的其余部分和html。您是否在使用google图表的Angle指令?这看起来像是角度谷歌图表。你能提供更多的代码(视图/html)或创建一个Plunkr吗?嘿,Tah,谢谢!。我已经添加了控制器的其余部分和html。