score:1
Accepted answer
you could define a second dataset that does nothing but drawing the gray space up to the limit of 100.
{
backgroundcolor: '#ddd',
hoverbackgroundcolor: '#ddd',
data: [100, 0, 0, 0, 100, 100],
datalabels: {
display: false
}
},
also make sure that only the x-axis has the option stacked: true
.
together with this, you'll also need to adjust some other options. a tooltip.filter
for example will prevent chart.js from showing a tooltip for the second dataset.
tooltip: {
filter: tooltipitem => !tooltipitem.datasetindex
},
please take a look at the stackblitz with your amended code and see how it works.
Source: stackoverflow.com
Related Query
- How to draw multiple color bars in a bar chart along a Horizontal Line using chart.js
- How to draw multiple color bar in a bar chart using chart.js
- How do I draw a vertical line on a horizontal bar chart with ChartJS?
- How to draw Horizontal line on Bar Chart Chartjs
- Draw stacked horizontal bar chart with Average line using ChartJS
- In Stacked horizontal bar chart how to remove the vertical line in Chart.js?
- How to use set the color for each bar in a bar chart using chartjs?
- Chart.js - draw horizontal line in Bar Chart (type bar)
- Can't Draw Horizontal Line on Graph Using ChartJS Annotation Plugin and Primevue Chart
- How to Draw a line on chart without a plot point using chart.js
- how to draw Line chart using chart.js and datalabels should be shown
- How to achieve a mixed chart of 'horizontal' bars and line chart using Chart.js?
- How to change bar color on a angular-chart and chart js bar graph with multiple datasets?
- how to modify horizontal bar chart using chart js
- How to draw a horizontal line over bar columns in Chart.js that's started from X axis?
- How do I draw horizontal bars with a label using either ChartJS or D3?
- How to add vertical line in bar chart using chartJs and ng2-charts?
- How to set percentage value by default on each bars in horizontal bar chart js
- how to create bar chart with group and sam color for each group using chart.js?
- Draw horizontal line on chart in chart.js on v2
- How can I create a horizontal scrolling Chart.js line chart with a locked y axis?
- Chart.js Bar Chart - how to chart bars from 0
- How to add an on click event to my Line chart using Chart.js
- How to Draw Gantt chart using chart js or other libraries
- How to set labels align left in Horizontal Bar using chart.js?
- How can I draw dotted line using chartjs?
- How to add second Y-axis for Bar and Line chart in Chart.js?
- How to create stacked bar chart using react-chartjs-2?
- Chart.js - Draw bar chart with multiple labels
- Draw a horizontal and vertical line on mouse hover in chart js
More Query from same tag
- Chart.js is not showing data
- How can I add multiple datasets into my dropdown menu and keep it as dynamic as it is right now?
- Highlighting point in all datasets on hover over
- Is there anyway add 2 or more chart with foreach loop
- Render pie chart datasets out of 100% -- Chart.JS
- Chart.JS Error: this.scale is undefined
- Full size download Chartjs canvas on mobile device
- Chart.js V2.7.2 How to make Horizontal scroll bar without loosing Y-Axis
- How do I filter & update dates using react-chartjs-2
- How to convert chart.js library chart to image in pure node.js without using HTML and CSS?
- How do I create multiple charts at the same page with angular?
- How to align ChartJS bars to the left?
- In ChartJS how do you format the hover over label in a time series?
- Tooltips showing wrong data in ChartJS
- Chart.js - How to set a line chart dataset as disabled on load
- Make labels of ChartJS radar in a few rows
- React chartjs 2 - Type 'string' is not assignable to type '"timeseries"'
- Chartjs - how to change the notation of doughnut chart
- daily activity chart using PHP MySQL
- Display Chart.js chart in Node.js
- Parsing JSON data into specific format for chart.js
- Chart content not getting displayed in ionic
- Why won't my chart.js chart render in React?
- using data structures in chartjs
- How can i do so that my chartjs updates everytime data is inserted or by time interval?
- Use Chartjs-Annotation-Plugin without using "import"
- How to use dates as X axis with Chart.js even when there is no Y axis value related
- Chart.js – Line Chart Tooltip Labels
- Remove Decimal values in Yaxis Linechart -Primefaces
- Attach data to label (Chart.js & Django 3)