How to use the d3-shape.curveBasis function in d3-shape

To help you get started, we’ve selected a few d3-shape examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github davegomez / silky-charts / cjs / chunk-ec892a96.js View on Github external
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,
github openforis / collect / collect-web / collect-webapp / frontend / vendor / recharts / lib / shape / Curve.js View on Github external
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)) {
github wcandillon / can-it-be-done-in-react-native / bonuses / graph-animation / components / Graph.tsx View on Github external
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 (
github burst-apps-team / phoenix / web / angular-wallet / src / app / main / dashboard / balance-diagram / balance-diagram.component.ts View on Github external
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']
})
github esnet / react-timeseries-charts / lib / js / curve.js View on Github external
"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
}; /**
github swimlane / ngx-charts-builder / src / app / app.component.ts View on Github external
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
};
github wcandillon / can-it-be-done-in-react-native / bonuses / tabbar / components / Tabbar.tsx View on Github external
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 },
  ]);