mirror of
https://github.com/mempool/mempool.git
synced 2024-11-20 10:21:52 +01:00
Remove unecessary code to controle legends.
Fix order of active and inactive fee ranges.
This commit is contained in:
parent
44339daedf
commit
a43cd48795
@ -17,6 +17,7 @@ import { feeLevels, chartColors } from 'src/app/app.constants';
|
|||||||
export class MempoolGraphComponent implements OnInit, OnChanges {
|
export class MempoolGraphComponent implements OnInit, OnChanges {
|
||||||
@Input() data: any[];
|
@Input() data: any[];
|
||||||
@Input() limitFee = 350;
|
@Input() limitFee = 350;
|
||||||
|
@Input() limitFilterFee = 1;
|
||||||
@Input() height: number | string = 200;
|
@Input() height: number | string = 200;
|
||||||
@Input() top: number | string = 20;
|
@Input() top: number | string = 20;
|
||||||
@Input() right: number | string = 10;
|
@Input() right: number | string = 10;
|
||||||
@ -63,33 +64,6 @@ export class MempoolGraphComponent implements OnInit, OnChanges {
|
|||||||
this.hoverIndexSerie = e.target.parent.parent.__ecComponentInfo.index;
|
this.hoverIndexSerie = e.target.parent.parent.__ecComponentInfo.index;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
myChart.on('legendselectchanged', (params) => {
|
|
||||||
let control = false;
|
|
||||||
Object.entries(params.selected).forEach(([key]) => {
|
|
||||||
if (control) {
|
|
||||||
myChart.dispatchAction({
|
|
||||||
type: 'legendUnSelect',
|
|
||||||
name: key
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
myChart.dispatchAction({
|
|
||||||
type: 'legendSelect',
|
|
||||||
name: key
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (params.name === key) {
|
|
||||||
control = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
for (let i = 0; i < params.length; i++) {
|
|
||||||
if (i === 0) {
|
|
||||||
this.feeLevelsOrdered.push('0 - 1');
|
|
||||||
} else {
|
|
||||||
this.feeLevelsOrdered.push(`${params[i - 1]} - ${params[i]}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleNewMempoolData(mempoolStats: OptimizedMempoolStats[]) {
|
handleNewMempoolData(mempoolStats: OptimizedMempoolStats[]) {
|
||||||
@ -127,7 +101,7 @@ export class MempoolGraphComponent implements OnInit, OnChanges {
|
|||||||
const { labels, series } = this.mempoolVsizeFeesData;
|
const { labels, series } = this.mempoolVsizeFeesData;
|
||||||
|
|
||||||
const seriesGraph = series.map((value: Array<number>, index: number) => {
|
const seriesGraph = series.map((value: Array<number>, index: number) => {
|
||||||
if (index <= this.feeLimitIndex){
|
if (index >= this.feeLimitIndex){
|
||||||
return {
|
return {
|
||||||
name: this.feeLevelsOrdered[index],
|
name: this.feeLevelsOrdered[index],
|
||||||
type: 'line',
|
type: 'line',
|
||||||
@ -176,26 +150,6 @@ export class MempoolGraphComponent implements OnInit, OnChanges {
|
|||||||
series: this.inverted ? [...seriesGraph].reverse() : seriesGraph,
|
series: this.inverted ? [...seriesGraph].reverse() : seriesGraph,
|
||||||
hover: true,
|
hover: true,
|
||||||
color: this.inverted ? [...this.chartColorsOrdered].reverse() : this.chartColorsOrdered,
|
color: this.inverted ? [...this.chartColorsOrdered].reverse() : this.chartColorsOrdered,
|
||||||
legend: {
|
|
||||||
bottom: 20,
|
|
||||||
data: this.inverted ? this.feeLevelsOrdered : [...this.feeLevelsOrdered].reverse(),
|
|
||||||
left: 0,
|
|
||||||
icon: 'square',
|
|
||||||
inactiveColor: '#444',
|
|
||||||
orient: 'vertical',
|
|
||||||
pageIconSize: 12,
|
|
||||||
pageIconColor: '#fff',
|
|
||||||
pageIconInactiveColor: '#444',
|
|
||||||
pageTextStyle: {
|
|
||||||
color: '#666',
|
|
||||||
},
|
|
||||||
show: false,
|
|
||||||
textStyle: {
|
|
||||||
color: '#888',
|
|
||||||
},
|
|
||||||
top: 20,
|
|
||||||
type: 'scroll',
|
|
||||||
},
|
|
||||||
tooltip: {
|
tooltip: {
|
||||||
show: (window.innerWidth >= 768) ? true : false,
|
show: (window.innerWidth >= 768) ? true : false,
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
@ -383,7 +337,7 @@ export class MempoolGraphComponent implements OnInit, OnChanges {
|
|||||||
|
|
||||||
orderLevels() {
|
orderLevels() {
|
||||||
for (let i = 0; i < feeLevels.length; i++) {
|
for (let i = 0; i < feeLevels.length; i++) {
|
||||||
if (feeLevels[i] === this.limitFee) {
|
if (feeLevels[i] === this.limitFilterFee) {
|
||||||
this.feeLimitIndex = i;
|
this.feeLimitIndex = i;
|
||||||
}
|
}
|
||||||
if (feeLevels[i] <= this.limitFee) {
|
if (feeLevels[i] <= this.limitFee) {
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<ng-template ngFor let-fee let-i="index" [ngForOf]="feeLevels">
|
<ng-template ngFor let-fee let-i="index" [ngForOf]="feeLevels">
|
||||||
<ng-template [ngIf]="fee === 1">
|
<ng-template [ngIf]="fee === 1">
|
||||||
<li (click)="filterFees(fee)" [class]="filterFeeIndex < fee ? 'inactive' : ''">
|
<li (click)="filterFees(fee)" [class]="filterFeeIndex > fee ? 'inactive' : ''">
|
||||||
<ng-template [ngIf]="inverted">
|
<ng-template [ngIf]="inverted">
|
||||||
<span class="square" [ngStyle]="{'backgroundColor': chartColors[i]}"></span>
|
<span class="square" [ngStyle]="{'backgroundColor': chartColors[i]}"></span>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
@ -56,7 +56,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<ng-template [ngIf]="fee <= 500 && fee !== 1">
|
<ng-template [ngIf]="fee <= 500 && fee !== 1">
|
||||||
<li (click)="filterFees(fee)" [class]="filterFeeIndex < fee ? 'inactive' : ''">
|
<li (click)="filterFees(fee)" [class]="filterFeeIndex > fee ? 'inactive' : ''">
|
||||||
<ng-template [ngIf]="inverted">
|
<ng-template [ngIf]="inverted">
|
||||||
<span class="square" [ngStyle]="{'backgroundColor': chartColors[i]}"></span>
|
<span class="square" [ngStyle]="{'backgroundColor': chartColors[i]}"></span>
|
||||||
<span class="fee-text" >{{feeLevels[i - 1]}} - {{ fee }}</span>
|
<span class="fee-text" >{{feeLevels[i - 1]}} - {{ fee }}</span>
|
||||||
@ -80,7 +80,8 @@
|
|||||||
<app-mempool-graph
|
<app-mempool-graph
|
||||||
dir="ltr"
|
dir="ltr"
|
||||||
[template]="'advanced'"
|
[template]="'advanced'"
|
||||||
[limitFee]="filterFeeIndex"
|
[limitFee]="500"
|
||||||
|
[limitFilterFee]="filterFeeIndex"
|
||||||
[height]="500"
|
[height]="500"
|
||||||
[left]="65"
|
[left]="65"
|
||||||
[right]="10"
|
[right]="10"
|
||||||
|
@ -25,7 +25,7 @@ export class StatisticsComponent implements OnInit {
|
|||||||
spinnerLoading = false;
|
spinnerLoading = false;
|
||||||
feeLevels = feeLevels;
|
feeLevels = feeLevels;
|
||||||
chartColors = chartColors;
|
chartColors = chartColors;
|
||||||
filterFeeIndex = 500;
|
filterFeeIndex = 1;
|
||||||
dropDownOpen = false;
|
dropDownOpen = false;
|
||||||
|
|
||||||
mempoolStats: OptimizedMempoolStats[] = [];
|
mempoolStats: OptimizedMempoolStats[] = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user