用d3实现不规则环形图

HTML代码块<svg viewBox="0 0 400 350" id="svgPie"></svg><div class="toltip" *ngIf="isShow"> <img src="/assets/img/xuanfu.png" (click)="closeTolTip()" alt=""></div>CSS代码块svg { width: 98%; height: auto;}.toltip { p
摘要由CSDN通过智能技术生成

HTML代码块

<svg viewBox="0 0 400 350" id="svgPie"></svg>
<div class="toltip" *ngIf="isShow">
  <img src="/assets/img/xuanfu.png" (click)="closeTolTip()" alt="">
</div>

CSS代码块

svg {
   
  width: 98%;
  height: auto;
}

.toltip {
   
  position: absolute;
  right: 0;
  left: 0;
  top: 8%;
  text-align: center;
  display: none;
}

.toltip img {
   
  width: 42%;
  margin-left: 15%;
}

ts代码块

import {
    Component, OnInit } from '@angular/core';
import {
    ActivatedRoute } from "@angular/router";
import {
    MorningPaperService } from '../../service/morning-paper.service';

declare var d3: any;
declare var $: any;

@Component({
   
  selector: 'app-app-pie',
  templateUrl: './app-pie.component.html',
  styleUrls: ['./app-pie.component.css']
})
export class AppPieComponent implements OnInit {
   
  customerId: any;
  accountId: any;
  publicGrade: any;
  responseDatas: any = [];
  hasdata: any = [];
  sugdata: any = [];
  sugDataList: any = [];
  hasDataList: any = [];
  allDataList: any = [];
  nameList: any = [];
  maxActualCoverage: any = [];
  sum: any = 0;
  ab: any = '';
  code: any;
  isShow: Boolean = true;

  constructor(private activatedRoute: ActivatedRoute, private morningPaperService: MorningPaperService) {
    }


  ngOnInit() {
   
    this.customerId = this.activatedRoute.snapshot.queryParamMap.get("customerId");
    this.accountId = this.activatedRoute.snapshot.queryParamMap.get("accountId");
    if (this.activatedRoute.snapshot.queryParamMap.get("publicGrade")) {
   
      this.publicGrade = this.activatedRoute.snapshot.queryParamMap.get("publicGrade");
    } else {
   
      this.publicGrade = 2;
    }
    this.policyChart();
    this.policyGuideShow();
  }

  policyChart() {
   

    this.morningPaperService.policyChart(this.customerId, this.accountId, this.publicGrade).subscribe(res => {
   
      if (res.responseBody) {
   
        this.responseDatas = res.responseBody;
        console.log(this.responseDatas);
      }
      for (let index = 0; index < this.responseDatas.length; index++) {
   
        this.sum += this.responseDatas[index].suggestCoverage;
      }
      this.responseDatas.forEach(element => {
   
        this.nameList.push(element.name);
        if (element.suggestCoverage == 0 && this.sum == 0) {
   
          this.sugdata.push(element.actualCoverage);
          this.sugDataList.push("");
          this.hasDataList.push(element.name + " " + element.actualCoverage);
          this.allDataList.push(element.actualCoverage);
        } else if (element.suggestCoverage == 0 || element.suggestCoverage == null && this.sum != 0) {
   
          this.sugdata.push(element.actualCoverage);
          this.sugDataList.push("建议" + element.name + " " + element.actualCoverage);
          this.hasDataList.push
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值