如何在PointStyle Chartjs中造型图像

发布于 2025-02-08 20:58:34 字数 611 浏览 2 评论 0原文

如何将图像放在点状并在其周围添加圆形的彩色边框(或带有彩色边框的IMG周围的任何形状)?我设法将图像添加到PointStyle中,但无法设置图像。非常感谢任何帮助! 我的代码:

    const img = new Image(30, 30);
    img.src = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcStkCgp2U1hHVVtWcf_SD4tVyLqA49lhgygEed0PPPKOZxcevudk3NZ1trGyhpAAMIJysc&usqp=CAU';
    
    const data = {
      datasets: [{
        label: 'First Dataset',
        data: [{
          x: 20,
          y: 30,
          
        }],
        pointStyle: img,
        backgroundColor: 'rgb(255, 99, 132)'
      }]
    };

const config = {
  type: 'bubble',
  data: data,
  options: {}
};

How is to put image to pointstyle and add rounded coloured border around it (or any shape around img with coloured border)? I manage to add image to pointstyle, but can't style it. Really appreciate any help!
My code:

    const img = new Image(30, 30);
    img.src = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcStkCgp2U1hHVVtWcf_SD4tVyLqA49lhgygEed0PPPKOZxcevudk3NZ1trGyhpAAMIJysc&usqp=CAU';
    
    const data = {
      datasets: [{
        label: 'First Dataset',
        data: [{
          x: 20,
          y: 30,
          
        }],
        pointStyle: img,
        backgroundColor: 'rgb(255, 99, 132)'
      }]
    };

const config = {
  type: 'bubble',
  data: data,
  options: {}
};

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文