var options = {
type: 'line',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
label: 'Scriptable radius',
data: [12, 19, 0, 5, 2, 3],
borderColor: 'pink',
backgroundColor: 'pink',
radius: (ctx, a, b) => (ctx.parsed.y === 0 ? 0 : 8)
},
{
label: 'Null value',
data: [7, 11, null, 8, 3, 7],
borderColor: 'orange',
backgroundColor: 'orange'
},
{
label: 'Object notation',
data: [{
x: 'Red',
y: 6
}, {
x: 'Blue',
y: 4
}, {
x: 'Green',
y: 8
}, {
x: 'Purple',
y: 12
}, {
x: 'Orange',
y: 3
}, ],
borderColor: 'lime',
backgroundColor: 'lime'
}
]
},
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/3.5.1/chart.js"></script>
</body>