score:1
Accepted answer
yes this is possible by using the scriptable option for borderwidth like this:
var options = {
type: 'pie',
data: {
labels: ["red", "blue", "yellow", "green", "purple", "orange", "f", "d"],
datasets: [{
label: '# of votes',
data: [12, 19, 3, 5, 2, 3, 0, 0],
borderwidth: (a, b, c) => (a.dataset.data[a.dataindex] === 0 ? 0 : 1),
backgroundcolor: ["red", "blue", "green", "yellow", "pink", "purple", "white", "black"],
bordercolor: ["red", "blue", "green", "yellow", "pink", "purple", "white", "black"]
}]
},
options: {}
}
var ctx = document.getelementbyid('chartjscontainer').getcontext('2d');
new chart(ctx, options);
<body>
<canvas id="chartjscontainer" width="600" height="400"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.9.4/chart.js" integrity="sha512-hzf9qhp3rldjbvakvmig+goaakrza6lkuo35ok6esm0/kjpk32yw7urqrq3q+nvbbt8usss+iekl7crn83dymw==" crossorigin="anonymous"></script>
</body>
if you change borderwidth: (a,b,c) => (a.dataset.data[a.dataindex] === 0 ? 0 : 1),
to borderwidth: (a,b,c) => (a.dataset.data[a.dataindex] === 0 ? 10 : 1),
you can see the old behaviour you have now.
Source: stackoverflow.com
Related Query
- Chart.js remove zero value sector in pie chart
- Remove the label and show only value in tooltips of a bar chart
- How to create single value Doughnut or Pie chart using Chart.js?
- ChartJs - Pie Chart - how to remove labels that are on the pie chart
- How to remove bars for those bars with zero value in Chartjs bar chart?
- react chart js skip zero value month
- Chart.js - Remove empty space in pie chart
- how to add percentage value to legend field in pie chart using chart.js
- How to show slice value inside of slice in pie chart using chart.js
- Remove 0% from pie chart
- Get Value for point clicked on Pie Chart in Chart.js 3
- Want to show small part of js Bar Chart when value is zero
- Pie Donut chart with different sector sizes
- Chart.js - tooltiptemplate with one decimal value in pie chart
- How can I remove the white border from Chart.js pie chart when all legends are hidden?
- Is it possible to remove the border between the segments but leave the border around the pie chart in react-chartjs-2?
- getting additional value fields from data source for dx.chartjs doughnut chart
- Remove chartjs pie chart highlight on hover
- Chart js pie chart, darker shade for higher value and lighter shade for lower value. I'm displaying values monthly
- Can we remove bar chart line on click on pie chart legend label?
- Chartjs bar chart ranges y-axis -1 to +1 if bars value zero
- ChartNew.js - Remove/Hide zero label from Pie Chart
- chartnew.js - remove lines from pie chart on 100%
- Chart js, pie chart remove borderradius
- Chart.js Show labels on Pie chart
- ChartJS: datalabels: show percentage value in Pie piece
- Remove the vertical line in the chart js line chart
- Chartjs random colors for each part of pie chart with data dynamically from database
- Pie Chart Legend - Chart.js
- ChartJS – is there any way to remove blank space around pie charts?
More Query from same tag
- How does one represent multiple threads in a structure/flowchart
- Chart.js stacked bar chart - sorting values in bar by value
- How to set the pointDot option on combo stacked bar-line chart
- How I can use a list of a string array in JavaScript into blade view?
- Using associative PHP array in JS to later on use in chart generated via chart.js
- How to increase gaps between vertical gridlines in chartjs
- Can't draw pie chart using chartjs - TypeError: Cannot create property '_meta' on number '16'
- How to change the cursor to a pointer when I hover over a bar in a ChartJS bar chart?
- Line ChartJs would not display - Date format issue
- Using Javascript with MPDF
- Importing and using Echarts results in [object error] in Internet Explorer
- Chart js, Canvas is null polymer project
- Creating a real time line chart using chartjs and firebase realtime db
- How to change cursor on hover of data labels in chart.js version 3?
- Chart.js offine mode
- Chart.js Using A JavaScript Object
- HTML/Chart JS deserialize JSON from Python Flask
- Force ChartJS to show Doughnut chart with null values
- ChartJS yAxis showing not coherent data
- Add zoom event handler to charts for chartjs with chartjs-plugin-zoom
- How to detect click on chart js 3.7.1 axis label?
- How to make gap in chart.js graph?
- How to display grouped data in ChartJs
- Chart js footer
- Chartjs Stacked bar have a stack id per x value
- ChartJS: Position labels at end of doughnut segment
- Placing canvas (chart.js line chart) inside an SVG using d3.js
- Chart.js Custom Image for Each Point
- Vue.js access variable from method
- Dynamically populating data into chart in Chart.js