简体   繁体   English

如何修改离子2中的图表,如下图所示?

[英]How can I modify a chart in ionic 2 to look like the picture below?

I am using import {Chart} from 'chart.js'; 我正在使用'chart.js'中的import {Chart}; to create my chat but I have some challenges. 创建我的聊天,但我有一些挑战。 I want to create a chart like the one shown below. 我想创建一个如下所示的图表。

Best Regards 最好的祝福

//Creating the doughth
    this.doughnutChart = new Chart(this.doughnutCanvas.nativeElement, {


      type: 'doughnut',
      data: {
        labels: ["Cash in Hand", "Cash in Bank", "Cash in Mpesa"],
        datasets: [{
          label: '# of Votes',
          data: [this.naaam, this.naaam1, this.naaam2 ],
          backgroundColor: [
            'rgba(255, 99, 132, 0.2)',
            'rgba(54, 162, 235, 0.2)',
            'rgba(255, 159, 64, 0.2)'
          ],
          hoverBackgroundColor: [
            "#FF6384",
            "#36A2EB",
            "#FFCE56"
          ]
        }]
      }

    });

在此输入图像描述

We're also using Chart.js in our Ionic 2 app. 我们也在我们的Io​​nic 2应用程序中使用Chart.js。 For rendering the charts we use the ng2-charts library. 为了渲染图表,我们使用ng2-charts库。

With regards to your question about putting the total in the bottom center, you can just wrap your chart in a div and add an absolutely positioned span element containing the total. 关于将总数放在底部中心的问题,您可以将图表包装在div中,并添加一个包含总数的绝对定位的span元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 LightWeightChart:如何添加看起来像这样的图表? - LightWeightChart: How can i add chart which look like this way? 如何使用 HttpInterceptor 修改 Angular 导航,如 http 请求? - How can I modify Angular navigation like http request with HttpInterceptor? 如何使用 ng2-chart 修改折线图的设计? - How can i modify the design of Line Chart using ng2-chart? 如何在 chart.js 图表的线条下方添加阴影颜色? - How can I add shadow color below the line in chart.js charts? 如何使用 ngFor 使我的单选按钮看起来像切换按钮? - How can I make my radio buttons look like toggle buttons with ngFor? 我怎样才能像这张图片那样用 ngFor 制作这张卡,在 angular 中自动调整列 - How can I make this card with ngFor like in this picture, with automatic adjust column in angular 如何在角度打字稿中访问画中画相关功能? - How can I access picture in picture related function in angular typescript? 如何修改 Ionic 图标内的属性? - How do I modify attributes within an Ionic icon? 如何使用Angular 2在Ionic 2中使用新的字体样式(如AR Destiny)? - How can I use a new font style (like AR Destiny) in Ionic 2 using Angular 2? 我可以在某个区域打开 Ionic 3 条码扫描仪吗? 就像在一个 div - Can I open Ionic 3 Barcode Scanner in an area? Like in a div
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM