score:19
I've tested one possible solution with Chart.js version 2.8.0. It's based on it's Scriptable Option and on the excellent sample you can find here.
The example below is a simplified and executable html/js code you can test by running its snippet (the button below the code).
The key is the line radius : customRadius,
, where customRadius refers to the function customRadius( context )
which is also in the code. That's because radius is a Scriptable Option.
The function tells the application to make the radius equals to 10 when the index is 3 (label 'd') or the value is equals or greater than 8.
let ctx = document.getElementById( 'actual_chart' );
new Chart(
ctx,
{
type : 'line',
data : {
labels : [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h' ],
datasets: [
{
data: [ 0, 1, 1, 2, 3, 5, 8, 13 ]
}
]
},
options: {
legend : {
display: false
},
elements: {
point: {
radius : customRadius,
display: true
}
}
}
} );
function customRadius( context )
{
let index = context.dataIndex;
let value = context.dataset.data[ index ];
return index === 3 || value >= 8 ?
10 :
2;
}
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<title>55468483</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.min.js"></script>
</head>
<body>
<canvas id="actual_chart"></canvas>
</body>
</html>
The resulting chart is something like this:
You can find more details on the references in the first paragraph of this answer.
Please, let us know if it helped.
Source: stackoverflow.com
Related Query
- Highlight a particular point in chart JS
- Chartjs Radar chart - How to dynamically highlight one of the gridlines at a specific point
- line chart with {x, y} point data displays only 2 values
- chart.js scatter chart - displaying label specific to point in tooltip
- How to display Line Chart dataset point labels with Chart.js?
- chartjs show dot point on hover over line chart
- Center point labels between ticks (Polar Area Chart JS)
- ChartJS: Draw vertical line at data point on chart on mouseover
- ChartJS - Line chart issue with only 1 point
- Angular 2 chart - change point radius
- how to programmatically make a line chart point active/highlighted
- Chart JS: Ignoring x values and putting point data on first available labels
- Change size of a specific point on a line chart in Chart.js
- Show point values in Radar Chart using chart.js
- Add a text as tooltip for each point on a line chart
- Chart.js tooltip at any point on the chart
- Chart.js V2 line chart missing point
- ChartJS v2 - Keep tooltip open when user click on a point of a multiple lines chart
- How to disable Chart.js Radar Chart point labels
- Empty circle - only point strok in line chart for ChartJS
- how to highlight a specific area on chartjs line chart
- How to highlight single bar in bar chart using Chartjs
- Get Value for point clicked on Pie Chart in Chart.js 3
- Highlight chart element when hovering over its corresponding legend Item
- angular-chartJs change chart background and highlight colors
- Group bar chart in ReactChartJS2 click particular element
- ChartJS: Highlight dataset in a stacked bar chart when hovering over the legend?
- plot a point on top on line chart in chartjs
- Chart.js How can I embed additional values to each data point in radar chart
- what is wrong with my code ? java script chart position
More Query from same tag
- chart.js tooltip keeps remembering old data after update
- Template variable injection in JS script
- Using Chart.js version 3, How to left justify the y-axis labels on a stacked bar chart?
- How to change font size of labeled scales in Chart.js?
- Why using logarithmic gives 8e+2 value?
- chartjs - json data for scatter graph, issue with date
- Adding options to vue-chartjs seems not working
- Uncaught TypeError: [Array].filter is not a function
- how to display datetime list in graph using chart.js
- Adapting a JavaScript code to be dynamic
- How to append more data in tooltip of graph in chart.js
- How to keep rounded bar corners when data is filtered chartJs?
- Angular using PrimeNG charjs problem with font colors
- How to change position of label of y-axes in chartjs?
- How to create two x-axes label using chart.js
- Using lodash to prepare data for "last day user registration" chart
- ChartJs multiaxis chart show different label bottom and top
- How can I use npm-plugins with react-chartjs-2?
- How to add datalabels to chartJS on Primefaces
- Is there any way to get y of specific x which not belongs to the dataset in Chart.js graph?
- Is it possible to scale Chart.js background Image
- Is it possible to set the background color of a sector in a radar chart in Chart.js?
- Rails 4.2 jQuery loads only after refresh
- Doughnut chart adjusting problem in chart.js
- How to change x-Axes label position in Chart.js
- Canvas doens't display in SAPUI5
- Charts.js - Colors for stacked bar on multi-series line/bar chart are not working
- Chart.js noob - Can't get anything to display
- Plot time on Y axis
- Is it possible to display the yAxis as a percentage without modifying my datasets for a Line chart?