Angular ngx图表颜色不能正确显示角度6?

Angular ngx图表颜色不能正确显示角度6?,angular,angular6,ngx-charts,Angular,Angular6,Ngx Charts,我正在尝试使用angular 6中的ngx图表为堆叠条形图添加颜色。我使用数组添加颜色,但每次颜色都会自动更改。每当我请求数据时,颜色会自动更改。在angular 6中,是否有任何功能或技术将ngx图表的颜色手动分配给每个数据? 这是我的HTML代码 <ngx-charts-bar-vertical-stacked [scheme]="colorScheme" [results]="multi" [gradient]="gradient" [

我正在尝试使用angular 6中的ngx图表为堆叠条形图添加颜色。我使用数组添加颜色,但每次颜色都会自动更改。每当我请求数据时,颜色会自动更改。在angular 6中,是否有任何功能或技术将ngx图表的颜色手动分配给每个数据? 这是我的HTML代码

<ngx-charts-bar-vertical-stacked [scheme]="colorScheme"
                        [results]="multi" [gradient]="gradient" [xAxis]="showXAxis"
                        [yAxis]="showYAxis" [legend]="showLegend"
                        [showXAxisLabel]="showXAxisLabel"
                        [showYAxisLabel]="showYAxisLabel" [xAxisLabel]="xAxisLabel"
                        [yAxisLabel]="yAxisLabel" [view]="  " (select)="onSelect($event)">

我也有同样的问题,然后我使用ngx图表的这个属性:

在HTML中:

<ngx-charts-bar-vertical-stacked
  [customColors]="ageGroupColors"
  .....
</ngx-charts-bar-vertical-stacked>
希望能有帮助


参考资料:

我也有同样的问题,然后我使用了ngx图表的这个属性:

在HTML中:

<ngx-charts-bar-vertical-stacked
  [customColors]="ageGroupColors"
  .....
</ngx-charts-bar-vertical-stacked>
希望能有帮助

参考资料:

我想你需要这个

import { ColorHelper } from '@swimlane/ngx-charts';


colors: ColorHelper
colorScheme = { 
  domain: ['red', 'green','blue','pink','black']  
};
schemeType: any;
yDomain = [0, 150]

getColors() {
  this.colors = new ColorHelper(this.colorScheme, this.schemeType, this.yDomain);
}
我想你需要这个

import { ColorHelper } from '@swimlane/ngx-charts';


colors: ColorHelper
colorScheme = { 
  domain: ['red', 'green','blue','pink','black']  
};
schemeType: any;
yDomain = [0, 150]

getColors() {
  this.colors = new ColorHelper(this.colorScheme, this.schemeType, this.yDomain);
}

你能为这个填充物创建stackblitz吗?你能为这个填充物创建stackblitz吗?????