score:1
Accepted answer
in your html:
...[colors]="getcolors()"
in your .ts file:
getcolors() {
return [{
backgroundcolor: this.barchartdata.map(d => d > threshold ? red : green)
}];
}
Source: stackoverflow.com
Related Query
- Creating dynamic arrays in Angular2
- chart js with angular2 loading dynamic data only after zoomin
- Creating dynamic object to reorganize API response using Typescript
- creating a dynamic number of charts using chart.js using angular
- Chartjs and dynamic data arrays
- How to run Chart.js samples using source code
- Adapting a JavaScript code to be dynamic
- how to not repeat code while creating multiple charts in chart js
- Chart.js creating a line graph using dates
- How to implement chart.js in Angular2
- Chart.js: Dynamic Changing of Chart Type (Line to Bar as Example)
- Angular2 ng2-chart customizations?
- Creating chart.js chart directly to PNG in Node js?
- Updating chartJS with dynamic data
- Create multiple dynamic charts
- Creating a horizontal bar chart extension on Chart.js
- Angular2 Update ng2-charts with labels
- Creating a grouped and stacked chart in Chart.js
- Dynamically creating graphs with jQuery
- Chart.js - Creating Custom Chart Types
- Creating a Normal Distribution graph with Chart.js
- Add dynamic dataset to chart.js
- Using Chart.js - Creating Legend for Doughnut Chart
- Create multiple dynamic stacked chart using chart.js in Angular 10?
- How to create dynamic charts with Django and Chart.js?
- Creating dropdown options with Chart.js using select tag and multiple canvas
- Angular2 charts (chart.js) Labels not vertical even though option is set
- How to add ChartJS code in Html2Pdf to view image
- ChartJS bar chart fixed width for dynamic data sets
- Chart.js dynamic bar width
More Query from same tag
- Chart.js - how to add a second data line to the line graph
- Highlight external element on ChartJS hover
- Charts.js candlestick (Financial Charts) displays half the bar in the beginning and the end
- Django + Chart.js Am I Doing This Right? Nothing is being rendered
- Get data from dynamic ID for Chart.js
- Converting JSON data into Chart.js array from strings
- $scope variable do not respond to the onClick function of angular chart
- Can you set bar thickness to align with the x-axis scale in ChartJS?
- ChartJS in Datatable cell performance
- Chartjs fiddle not working
- What library should I use to create costume chart in react native?
- Chart in Angular not displayed until windows resize
- How to make interactive a chart with chart.js
- Fetch more data for line chart onZoom/onPan issues
- import Json formatted values to create bar charts with Chart.js
- Chart.js: grid lines only on dataset points
- How I can change the font-family of labels in the bar chart?
- chartjs custom y axis values, different text for each one
- How using charts.js with JSON?
- Display a single tooltip with Chart.JS?
- chart.js time scatter with true scale
- How do I use the return values from csv ajax request for x and y values?
- How do remove the bottom scale on a Chart.js bar chart
- How populate chart.js with sql data?
- How can I get my Chart.JS to center within a div?
- how labels in chartjs can make data invisible
- Group Chart with multiple layers in ChartJS
- Displaying every nth label on the x-axis
- Live update the charts.js graph on a web page using json data received from a remote server
- I´m unable to map elements of an array