How to use the d3-scale.scalePoint function in d3-scale

To help you get started, we’ve selected a few d3-scale 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 BigFatDog / parcoords-es / dist / parcoords.esm.js View on Github external
};
      }
    });
  }

  var eventTypes = ['render', 'resize', 'highlight', 'mark', 'brush', 'brushend', 'brushstart', 'axesreorder'].concat(keys(config));

  var events = dispatch.apply(_this$4, eventTypes),
      flags = {
    brushable: false,
    reorderable: false,
    axes: false,
    interactive: false,
    debug: false
  },
      xscale = scalePoint(),
      dragging = {},
      axis = axisLeft().ticks(5),
      ctx = {},
      canvas = {};

  var brush = {
    modes: {
      None: {
        install: function install(pc) {}, // Nothing to be done.
        uninstall: function uninstall(pc) {}, // Nothing to be done.
        selected: function selected() {
          return [];
        }, // Nothing to return
        brushState: function brushState() {
          return {};
        }
github swimlane / ngx-charts / src / polar-chart / polar-chart.component.ts View on Github external
getXScale(domain, width): any {
    switch (this.scaleType) {
      case 'time':
        return scaleTime()
          .range([0, width])
          .domain(domain);
      case 'linear':
        const scale = scaleLinear()
          .range([0, width])
          .domain(domain);
        return this.roundDomains ? scale.nice() : scale;
      default:
        return scalePoint()
          .range([0, width - twoPI / domain.length])
          .padding(0)
          .domain(domain);
    }
  }
github alice-si / etheroscope / frontend / src / app / explorer / custom-timeline / custom-timeline.component.ts View on Github external
getXScale() {
    let scale;

    if (this.scaleType === 'time') {
      scale = scaleTime()
        .range([0, this.dims.width])
        .domain(this.xDomain);
    } else if (this.scaleType === 'linear') {
      scale = scaleLinear()
        .range([0, this.dims.width])
        .domain(this.xDomain);
    } else if (this.scaleType === 'ordinal') {
      scale = scalePoint()
        .range([0, this.dims.width])
        .padding(0.1)
        .domain(this.xDomain);
    }

    return scale;
  }
github swimlane / ngx-charts / src / common / timeline / timeline.component.ts View on Github external
getXScale() {
    let scale;

    if (this.scaleType === 'time') {
      scale = scaleTime()
        .range([0, this.dims.width])
        .domain(this.xDomain);
    } else if (this.scaleType === 'linear') {
      scale = scaleLinear()
        .range([0, this.dims.width])
        .domain(this.xDomain);
    } else if (this.scaleType === 'ordinal') {
      scale = scalePoint()
        .range([0, this.dims.width])
        .padding(0.1)
        .domain(this.xDomain);
    }

    return scale;
  }
github LocusEnergy / ember-d3-helpers / addon / helpers / point-scale.js View on Github external
export function pointScale([domain, range], hash) {
  let scale = guidDomainScale(scalePoint());
  addOptionsToOrdinalScale(scale, domain, range, hash, 'point');
  return scale;
}
github swimlane / ngx-charts / src / line-chart / line-chart.component.ts View on Github external
let scale;

    if (this.scaleType === 'time') {
      scale = scaleTime()
        .range([0, width])
        .domain(domain);
    } else if (this.scaleType === 'linear') {
      scale = scaleLinear()
        .range([0, width])
        .domain(domain);

      if (this.roundDomains) {
        scale = scale.nice();
      }
    } else if (this.scaleType === 'ordinal') {
      scale = scalePoint()
        .range([0, width])
        .padding(0.1)
        .domain(domain);
    }

    return scale;
  }
github experience-experiments / react-easy-chart / modules / line-chart / hybrid / LineChart / common.js View on Github external
export function createScaleTextY(domain = [], s = 0) {
  return scalePoint()
    .domain(domain)
    .range([0, s])
    .padding(0);
}
github swimlane / ngx-charts / src / area-chart / area-chart.component.ts View on Github external
getXScale(domain, width): any {
    let scale;

    if (this.scaleType === 'time') {
      scale = scaleTime();
    } else if (this.scaleType === 'linear') {
      scale = scaleLinear();
    } else if (this.scaleType === 'ordinal') {
      scale = scalePoint().padding(0.1);
    }

    scale.range([0, width]).domain(domain);

    return this.roundDomains ? scale.nice() : scale;
  }
github cloudfoundry / stratos / src / frontend / packages / cf-autoscaler / src / shared / list-types / app-autoscaler-metric-chart / app-autoscaler-metric-chart-card / combo-chart / combo-chart.component.ts View on Github external
}

    if (this.scaleType === 'time') {
      scale = scaleTime()
        .range([0, width])
        .domain(domain);
    } else if (this.scaleType === 'linear') {
      scale = scaleLinear()
        .range([0, width])
        .domain(domain);

      if (this.roundDomains) {
        scale = scale.nice();
      }
    } else if (this.scaleType === 'ordinal') {
      scale = scalePoint()
        .range([this.bandwidth / 2, width - this.bandwidth / 2])
        .domain(domain);
    }

    return scale;
  }