首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何创建chart.js垂直条形聊天与圆角6角?

如何创建chart.js垂直条形聊天与圆角6角?
EN

Stack Overflow用户
提问于 2018-09-08 09:32:00
回答 1查看 725关注 0票数 0

我使用的是角度6,我有一个垂直的条形图。我想让酒吧的角落变得圆圆!我该怎么做呢?

下面是代码的一部分:

.ts

代码语言:javascript
复制
ngAfterViewInit() {

    this.canvas = document.getElementById('barChart');
    this.ctx = this.canvas.getContext('2d');
    let myChart = new Chart(this.ctx, {
      type: 'bar',
      data: {
        labels: this.my_labels,
        datasets: [
          {
            label: '',
            fill: false,
            backgroundColor: [
              '#2699fb',
              '#2699fb',
              '#2699fb',
            ],
            borderWidth: 1,
            data: [12000, 18000, 65000],
          }
        ]
      },
      options: {
        responsive: false,
        legend: {
          display: false
        }
      }
    });
}
EN

回答 1

Stack Overflow用户

发布于 2019-11-13 10:53:35

您可以安装chartjs-top-round-bar.通过以下步骤:-

代码语言:javascript
复制
1. Install the plugin - npm i chartjs-top-round-bar.

2. Import in TS - import 'chartjs-top-round-bar';.

3. Add in the option while creating Chart -


           let myChart = new Chart(this.ctx, { 
                                   type: 'roundedBar', 
                                   data: { 
                                           labels: ['label 1'], 
                                           datasets: [{label: 'Label 1', data}]
                                   }, 
                                   options: { 
                                             barRoundness: 0.3
                                   }
                          }

我希望这能帮到你。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52233915

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档