Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var TIME_FORMAT = '%a %d';
var TOOLTIP_DATE_FORMAT = '%b %d, %Y';
var TOOLTIP_OFFSET = 20;
var WIDTH = 640; // Scales
var SCALE_PADDING = 0.15;
var THEME = 'monteCarlo';
var SECONDARY_THEME = 'vividCerise';
var OUTLINE_FILL = 50;
var OUTLINE_HOVER = 30;
var OUTLINE_STROKE = -20; // Line options
var LINE_STROKE_WIDTH = 2;
var LINE_TYPE = 'curveLinear';
var LINE_TYPES = {
curveBasis: d3Shape.curveBasis,
curveBasisClosed: d3Shape.curveBasisClosed,
curveBasisOpen: d3Shape.curveBasisOpen,
curveBundle: d3Shape.curveBundle,
curveCardinal: d3Shape.curveCardinal,
curveCardinalClosed: d3Shape.curveCardinalClosed,
curveCardinalOpen: d3Shape.curveCardinalOpen,
curveCatmullRom: d3Shape.curveCatmullRom,
curveCatmullRomClosed: d3Shape.curveCatmullRomClosed,
curveCatmullRomOpen: d3Shape.curveCatmullRomOpen,
curveLinear: d3Shape.curveLinear,
curveLinearClosed: d3Shape.curveLinearClosed,
curveMonotoneX: d3Shape.curveMonotoneX,
curveMonotoneY: d3Shape.curveMonotoneY,
curveNatural: d3Shape.curveNatural,
curveStep: d3Shape.curveStep,
curveStepAfter: d3Shape.curveStepAfter,
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _ReactUtils = require('../util/ReactUtils');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var CURVE_FACTORIES = {
curveBasisClosed: _d3Shape.curveBasisClosed, curveBasisOpen: _d3Shape.curveBasisOpen, curveBasis: _d3Shape.curveBasis, curveLinearClosed: _d3Shape.curveLinearClosed, curveLinear: _d3Shape.curveLinear,
curveMonotoneX: _d3Shape.curveMonotoneX, curveMonotoneY: _d3Shape.curveMonotoneY, curveNatural: _d3Shape.curveNatural, curveStep: _d3Shape.curveStep, curveStepAfter: _d3Shape.curveStepAfter,
curveStepBefore: _d3Shape.curveStepBefore
};
var defined = function defined(p) {
return p.x === +p.x && p.y === +p.y;
};
var getX = function getX(p) {
return p.x;
};
var getY = function getY(p) {
return p.y;
};
var getCurveFactory = function getCurveFactory(type, layout) {
if ((0, _isFunction3.default)(type)) {
export default ({ data }: GraphProps) => {
const scaleX = scaleTime()
.domain(getDomain(data.map(d => d.date)))
.range([0, width]);
const scaleY = scaleLinear()
.domain(getDomain(data.map(d => d.value)))
.range([height - padding, padding]);
const d = shape
.line()
.x(p => scaleX(p.date))
.y(p => scaleY(p.value))
.curve(shape.curveBasis)(data) as string;
return (
import {Router} from '@angular/router';
import {Component, Input, OnChanges} from '@angular/core';
import {Account} from '@burstjs/core';
import {convertBurstTimeToDate, convertNQTStringToNumber} from '@burstjs/util';
import * as shape from 'd3-shape';
import {getBalanceHistoryFromTransactions} from '../../../util/balance/getBalanceHistoryFromTransactions';
import {BalanceHistoryItem} from '../../../util/balance/typings';
class ChartOptions {
public curve = shape.curveBasis;
public gradient = true;
public showYAxis = true;
public yAxisLabel = 'BURST';
public showYAxisLabel = false;
public colorScheme = {
domain: ['#448aff', '#A6C6FF']
};
}
const TransactionCountOptions = [25, 50, 100, 250, 500];
@Component({
selector: 'app-balance-diagram',
templateUrl: './balance-diagram.component.html',
styleUrls: ['./balance-diagram.component.scss']
})
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _d3Shape = require("d3-shape");
exports.default = {
curveBasisClosed: _d3Shape.curveBasisClosed,
curveBasisOpen: _d3Shape.curveBasisOpen,
curveBasis: _d3Shape.curveBasis,
curveBundle: _d3Shape.curveBundle,
curveCardinalClosed: _d3Shape.curveCardinalClosed,
curveCardinalOpen: _d3Shape.curveCardinalOpen,
curveCardinal: _d3Shape.curveCardinal,
curveCatmullRomClosed: _d3Shape.curveCatmullRomClosed,
curveCatmullRomOpen: _d3Shape.curveCatmullRomOpen,
curveCatmullRom: _d3Shape.curveCatmullRom,
curveLinearClosed: _d3Shape.curveLinearClosed,
curveLinear: _d3Shape.curveLinear,
curveMonotoneX: _d3Shape.curveMonotoneX,
curveMonotoneY: _d3Shape.curveMonotoneY,
curveNatural: _d3Shape.curveNatural,
curveStep: _d3Shape.curveStep,
curveStepAfter: _d3Shape.curveStepAfter,
curveStepBefore: _d3Shape.curveStepBefore
}; /**
showXAxisLabel: true,
showYAxisLabel: true,
yAxisLabel: '',
xAxisLabel: '',
autoScale: true,
showGridLines: true,
rangeFillOpacity: 0.5,
roundDomains: false,
tooltipDisabled: false,
showSeriesOnHover: true,
curve: shape.curveLinear,
curveClosed: shape.curveCardinalClosed
};
const curves = {
'Basis': shape.curveBasis,
'Basis Closed': shape.curveBasisClosed,
'Bundle': shape.curveBundle.beta(1),
'Cardinal': shape.curveCardinal,
'Cardinal Closed': shape.curveCardinalClosed,
'Catmull Rom': shape.curveCatmullRom,
'Catmull Rom Closed': shape.curveCatmullRomClosed,
'Linear': shape.curveLinear,
'Linear Closed': shape.curveLinearClosed,
'Monotone X': shape.curveMonotoneX,
'Monotone Y': shape.curveMonotoneY,
'Natural': shape.curveNatural,
'Step': shape.curveStep,
'Step After': shape.curveStepAfter,
'Step Before': shape.curveStepBefore,
'default': shape.curveLinear
};
const getPath = (): string => {
const left = shape.line().x(d => d.x).y(d => d.y)([
{ x: 0, y: 0 },
{ x: width, y: 0 },
]);
const tab = shape.line().x(d => d.x).y(d => d.y).curve(shape.curveBasis)([
{ x: width, y: 0 },
{ x: width + 5, y: 0 },
{ x: width + 10, y: 10 },
{ x: width + 15, y: height },
{ x: width + tabWidth - 15, y: height },
{ x: width + tabWidth - 10, y: 10 },
{ x: width + tabWidth - 5, y: 0 },
{ x: width + tabWidth, y: 0 },
]);
const right = shape.line().x(d => d.x).y(d => d.y)([
{ x: width + tabWidth, y: 0 },
{ x: width * 2, y: 0 },
{ x: width * 2, y: height },
{ x: 0, y: height },
{ x: 0, y: 0 },
]);