小编gau*_*uri的帖子

如何在echart中添加格式化工具提示以获取饼图的多个值

我正在使用 echart 饼图,但我想在工具提示中显示多个记录。

option = {
    tooltip: {
        trigger: 'item',
        formatter: '{a} <br/>{b} : {c} ({d}%), <br/>{name1} : {value1} '
    },
    legend: {
        orient: 'vertical',
        left: 'left',
        data: ['aa', 'bb', 'cc', 'dd', 'ee']
    },
    series: [
        {
            name: 'text name',
            type: 'pie',
            radius: '55%',
            center: ['50%', '60%'],
            data: [
                {value: 335, name: 'aa',value1: 335, name1: 'xx'},
                {value: 310, name: 'bb',value1: 335, name1: 'yy'},
                {value: 234, name: 'cc',value1: 335, name1: 'zz'},
                {value: 135, name: 'dd',value1: 335, name1: 'ww'},
                {value: 1548, name: …
Run Code Online (Sandbox Code Playgroud)

echarts

12
推荐指数
1
解决办法
4万
查看次数

如何修复垫分页器大小

对于mat-table分页,没有灵活性sticky-table。在移动后的分页中,没有css应用(如图所示)。我试图提供背景颜色,但它不起作用。参考此代码: https://stackblitz.com/angular/bbmgqanjelq ?file=app%2Ftable-sticky-columns-example.css

在此输入图像描述

![在此输入图像描述

.mat-paginator{
    background-color: brown;
    color: gold;
    font-size: 1rem;
}

.mat-header-cell{
    font-size: 1rem;
    background-color: brown;
    color: gold;
  }
.example-container {
  height: 460px;
  width: 550px;
  overflow: auto;
}
table {
  width: 800px;
}
Run Code Online (Sandbox Code Playgroud)
<div class="example-container mat-elevation-z8">
  <table mat-table [dataSource]="dataSource">

    <!-- Name Column -->
    <ng-container matColumnDef="name" sticky>
      <th mat-header-cell *matHeaderCellDef> Name </th>
      <td mat-cell *matCellDef="let element"> {{element.name}} </td>
    </ng-container>

    <!-- Position Column -->
    <ng-container matColumnDef="position">
      <th mat-header-cell *matHeaderCellDef> No. </th>
      <td mat-cell *matCellDef="let element"> {{element.position}} …
Run Code Online (Sandbox Code Playgroud)

css angular

4
推荐指数
2
解决办法
1万
查看次数

如何计算mongodb中字符串的总和?

在 mongodb 中,我想计算partialAmount类型字段的总和string,并且在此字段中值存储为"20,00""15,00"

如何计算所有值的总和。我尝试过的两个查询都返回 0。

collection.aggregate([
  {
    $group: {
      _id: null,
      sum: { $sum: "$$partialAmount" }
    }
  }
]);
Run Code Online (Sandbox Code Playgroud)

和:

collection.aggregate([
  {
    $group: {
      _id: null,
      totalAmount: {
        $sum: {
          $toDouble: "$partialAmount"
        }
      }
    }
  }
]);
Run Code Online (Sandbox Code Playgroud)

mongodb

3
推荐指数
1
解决办法
1885
查看次数

如何在ECharts中的圆环图中心显示文本?

我想在圆环图的中心显示所有数据值的总和,而不使用 x 轴和 y 轴。对于甜甜圈图,我将此用作参考https://echarts.apache.org/examples/zh/editor.html?c=pie-doughnut

如下代码所示,chartvalueData两者nameoflabels都是动态生成的。

this.chartData = {
          tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b}: {c} ({d}%)"
          },
          legend: {
            orient: 'vertical',
            x: 'left',
            data: nameoflabels,
            bottom: 20
          }
          series: [
            {
              name: 'Title',
              type: 'pie',
              radius: ['50%', '70%'],
              avoidLabelOverlap: false,
              label: {
                normal: {
                  textStyle: {
                    fontWeight: 'bold'
                  }
                },
                emphasis: {
                  textStyle: {
                    fontWeight: 'bold'
                  }
                }
              },
              labelLine: {
                normal: {
                  show: true
                }
              },
              data: chartvalueData,
              color: ['lightblue', 'orange','lightcoral','plum']
            } …
Run Code Online (Sandbox Code Playgroud)

echarts angular

2
推荐指数
1
解决办法
9964
查看次数

标签 统计

angular ×2

echarts ×2

css ×1

mongodb ×1