我的一些用户提到很难点击图表点来查看其工具提示数据。有没有办法增加可点击点的面积?
envsm3lx1#
您可以将pointHitRadius设置为更大的数字:
const options = { type: 'line', data: { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [12, 19, 3, 5, 2, 3], pointHitRadius: 25 }, { label: '# of Points', data: [7, 11, 5, 8, 3, 7], pointHitRadius: 25 } ] }, options: {} } const ctx = document.getElementById('chartJSContainer').getContext('2d'); new Chart(ctx, options);
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.2.0/chart.umd.js"></script> <body> <canvas id="chartJSContainer" width="600" height="400"></canvas> </body>
1条答案
按热度按时间envsm3lx1#
您可以将pointHitRadius设置为更大的数字: