我已经将ng2-charts添加到我的项目中并显示2个图表 - 甜甜圈和条形图.因为我添加了,所以都显示为灰色
<base-chart class="chart"
[colors]="chartColors"
...
</base-chart>
Run Code Online (Sandbox Code Playgroud)
去component.template.html
和
public chartColors:Array<any> =[
{
fillColor:'rgba(225,10,24,0.2)',
strokeColor:'rgba(11,255,20,1)',
pointColor:'rgba(111,200,200,1)',
pointStrokeColor:'#fff',
pointHighlightFill:'#fff',
pointHighlightStroke:'rgba(200,100,10,0.8)'
}, ... (3x)
Run Code Online (Sandbox Code Playgroud)
到了 component.ts
是否需要更改颜色的任何其他包导入或设置错误?Chromes html检查器显示以下html输出呈现
ng-reflect-colors="[object Object],[object Object],[object Object]"
Run Code Online (Sandbox Code Playgroud) ng serve删除node_modules目录并使用新建目录后,我在使用cmd的angular2应用程序中收到以下错误npm install.
Error: Cannot find module 'common-tags'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/usr/local/lib/node_modules/angular-cli/models/config.js:8:21)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
Run Code Online (Sandbox Code Playgroud)
也npm install common-tags手动添加它不起作用