diff --git a/LICENSE b/LICENSE index 45d73ad1d..c4670fc9f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,11 +1,11 @@ -MIT License +MIT License with Commons Clause License Condition v1.0 -Copyright (c) 2019 Simon Lindh +Copyright (c) 2019-2020 The Mempool Open Source Project Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +to use, copy, modify, merge, publish, distribute, and/or sublicense copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: @@ -19,3 +19,17 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Commons Clause License Condition v1.0 + +Without limiting other conditions in the License, the grant of rights under +the License will not include, and the License does not grant to you, the +right to Sell the Software. + +For purposes of the foregoing, “Sell” means practicing any or all of the +rights granted to you under the License to provide to third parties, for a +fee or other consideration (including without limitation fees for hosting or +consulting/ support services related to the Software), a product or service +whose value derives, entirely or substantially, from the functionality of +the Software. Any license notice or attribution required by the License must +also include this Commons Cause License Condition notice. diff --git a/frontend/package.json b/frontend/package.json index 953455309..317a6c74e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -50,11 +50,11 @@ "@fortawesome/fontawesome-common-types": "^0.2.30", "@fortawesome/fontawesome-svg-core": "^1.2.30", "@fortawesome/free-solid-svg-icons": "^5.14.0", + "@mempool/chartist": "^0.11.4", "@ng-bootstrap/ng-bootstrap": "^7.0.0", "@nguniversal/express-engine": "10.1.0", "@types/qrcode": "^1.3.4", "bootstrap": "4.5.0", - "chartist": "^0.11.4", "clipboard": "^2.0.4", "domino": "^2.1.6", "express": "^4.15.2", diff --git a/frontend/src/app/components/fee-distribution-graph/fee-distribution-graph.component.ts b/frontend/src/app/components/fee-distribution-graph/fee-distribution-graph.component.ts index 277baf675..0d6ed9c74 100644 --- a/frontend/src/app/components/fee-distribution-graph/fee-distribution-graph.component.ts +++ b/frontend/src/app/components/fee-distribution-graph/fee-distribution-graph.component.ts @@ -1,5 +1,5 @@ import { Component, Input, OnChanges, ChangeDetectionStrategy } from '@angular/core'; -import * as Chartist from 'chartist'; +import * as Chartist from '@mempool/chartist'; @Component({ selector: 'app-fee-distribution-graph', diff --git a/frontend/src/app/components/mempool-graph/mempool-graph.component.ts b/frontend/src/app/components/mempool-graph/mempool-graph.component.ts index 734ae2030..496f532ef 100644 --- a/frontend/src/app/components/mempool-graph/mempool-graph.component.ts +++ b/frontend/src/app/components/mempool-graph/mempool-graph.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit, Input, Inject, LOCALE_ID, ChangeDetectionStrategy, OnChanges } from '@angular/core'; import { formatDate } from '@angular/common'; import { VbytesPipe } from 'src/app/shared/pipes/bytes-pipe/vbytes.pipe'; -import * as Chartist from 'chartist'; +import * as Chartist from '@mempool/chartist'; import { OptimizedMempoolStats } from 'src/app/interfaces/node-api.interface'; import { StateService } from 'src/app/services/state.service'; @@ -62,6 +62,7 @@ export class MempoolGraphComponent implements OnInit, OnChanges { showLine: false, fullWidth: true, showPoint: false, + stackedLine: true, low: 0, axisX: { labelInterpolationFnc: labelInterpolationFnc, @@ -71,11 +72,7 @@ export class MempoolGraphComponent implements OnInit, OnChanges { labelInterpolationFnc: (value: number): any => this.vbytesPipe.transform(value, 2), offset: showLegend ? 160 : 60, }, - plugins: [ - Chartist.plugins.ctTargetLine({ - value: 1000000 - }), - ] + plugins: [] }; if (showLegend) { @@ -134,9 +131,6 @@ export class MempoolGraphComponent implements OnInit, OnChanges { feesArray.push(0); } }); - if (finalArray.length) { - feesArray = feesArray.map((value, i) => value + finalArray[finalArray.length - 1][i]); - } finalArray.push(feesArray); } finalArray.reverse(); diff --git a/frontend/src/app/components/statistics/chartist.component.ts b/frontend/src/app/components/statistics/chartist.component.ts index f2b6f9199..0a414be20 100644 --- a/frontend/src/app/components/statistics/chartist.component.ts +++ b/frontend/src/app/components/statistics/chartist.component.ts @@ -9,7 +9,7 @@ import { ViewEncapsulation } from '@angular/core'; -import * as Chartist from 'chartist'; +import * as Chartist from '@mempool/chartist'; /** * Possible chart types @@ -319,7 +319,11 @@ Chartist.plugins.legend = function (options: any) { chart.on('created', function (data: any) { - if (isSelfUpdate) + const useLabels = chart instanceof Chartist.Pie && chart.data.labels && chart.data.labels.length; + const legendNames = getLegendNames(useLabels); + var dirtyChartData = (chart.data.series.length < legendNames.length); + + if (isSelfUpdate || dirtyChartData) return; function removeLegendElement() { @@ -476,8 +480,6 @@ Chartist.plugins.legend = function (options: any) { removeLegendElement(); const legendElement = createLegendElement(); - const useLabels = chart instanceof Chartist.Pie && chart.data.labels && chart.data.labels.length; - const legendNames = getLegendNames(useLabels); const seriesMetadata = initSeriesMetadata(useLabels); const legends: any = []; diff --git a/frontend/src/app/components/statistics/statistics.component.ts b/frontend/src/app/components/statistics/statistics.component.ts index cb9e0840f..969b84e63 100644 --- a/frontend/src/app/components/statistics/statistics.component.ts +++ b/frontend/src/app/components/statistics/statistics.component.ts @@ -9,7 +9,7 @@ import { OptimizedMempoolStats } from '../../interfaces/node-api.interface'; import { WebsocketService } from '../../services/websocket.service'; import { ApiService } from '../../services/api.service'; -import * as Chartist from 'chartist'; +import * as Chartist from '@mempool/chartist'; import { StateService } from 'src/app/services/state.service'; import { SeoService } from 'src/app/services/seo.service'; @@ -30,7 +30,6 @@ export class StatisticsComponent implements OnInit { mempoolUnconfirmedTransactionsData: any; mempoolTransactionsWeightPerSecondData: any; - mempoolVsizeFeesOptions: any; transactionsWeightPerSecondOptions: any; radioGroupForm: FormGroup; diff --git a/frontend/src/app/dashboard/dashboard.component.ts b/frontend/src/app/dashboard/dashboard.component.ts index ae010be2e..879fc4262 100644 --- a/frontend/src/app/dashboard/dashboard.component.ts +++ b/frontend/src/app/dashboard/dashboard.component.ts @@ -6,7 +6,7 @@ import { OptimizedMempoolStats } from '../interfaces/node-api.interface'; import { MempoolInfo, TransactionStripped } from '../interfaces/websocket.interface'; import { ApiService } from '../services/api.service'; import { StateService } from '../services/state.service'; -import * as Chartist from 'chartist'; +import * as Chartist from '@mempool/chartist'; import { formatDate } from '@angular/common'; import { WebsocketService } from '../services/websocket.service'; import { SeoService } from '../services/seo.service'; diff --git a/frontend/src/styles.scss b/frontend/src/styles.scss index c88ed18f2..45769be32 100644 --- a/frontend/src/styles.scss +++ b/frontend/src/styles.scss @@ -237,7 +237,7 @@ $ct-series-colors: ( #6188e2, ); -@import "../node_modules/chartist/dist/scss/chartist.scss"; +@import "../node_modules/@mempool/chartist/dist/scss/chartist.scss"; .ct-bar-label { font-size: 20px;