Setting color for bar chart in ng2-chart
问题 I am trying to set colors for bars in bar graph according to the range of values. TS public barChartData: any[]; public chartColors: any[]; value = [] // This array have my values from DB like [3.5, 2.5, 1.5, 6.5, 6, 1, 6.5, 3.5, 5.5] this.barChartData = [{ data: this.value, label: 'Insulin' }] var l = this.value.length; for (var i = 0; i < l; i++) { if (this.value[i] <= 3) { this.chartColors = [{ backgroundColor: 'rgba(255, 205, 86, 9)', borderColor: 'rgba(255, 205, 86, 9)' }] } else if