我正在使用 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) 对于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) 在 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) 我想在圆环图的中心显示所有数据值的总和,而不使用 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)