How to use the plottable.Scales.Category function in plottable

To help you get started, we’ve selected a few plottable 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 devinit / datahub / src / components / organisms / Charts / components / BarChart / BarChart.tsx View on Github external
private createAxes(xConfigs: AxisConfig, yConfigs: AxisConfig, chartTable: Table) {
    this.xScale = getScale(xConfigs.type);
    if (this.xScale instanceof Scales.Category) {
      this.xScale.innerPadding(xConfigs.innerPadding as number);
      this.xScale.outerPadding(xConfigs.outerPadding as number);
    }
    this.xAxis = getAxis(xConfigs, this.xScale);
    if (xConfigs.show) {
      chartTable.add(this.xAxis, 2, 2);

      this.xAxis.showEndTickLabels(true);
      this.xAxis.margin(xConfigs.margin);

      if (xConfigs.tickingStep) {
        if (this.xScale instanceof Scales.Linear && typeof xConfigs.tickingStep === 'number') {
          const xScaleTickGenerator = Scales.TickGenerators.intervalTickGenerator(xConfigs.tickingStep);
          this.xScale.tickGenerator(xScaleTickGenerator);
          if (xConfigs.axisMin && typeof xConfigs.axisMin === 'number') {
            this.xScale.domainMin(xConfigs.axisMin);
github devinit / datahub / src / components / organisms / Charts / components / LineChart / LineChart.tsx View on Github external
private createAxes(xConfigs: AxisConfig, yConfigs: AxisConfig, chartTable: Table) {
    this.xScale = getScale(xConfigs.type);
    if (this.xScale instanceof Scales.Category) {
      this.xScale.innerPadding(xConfigs.innerPadding as number);
      this.xScale.outerPadding(xConfigs.outerPadding as number);
    }
    this.xAxis = getAxis(xConfigs, this.xScale);
    if (xConfigs.show) {
      chartTable.add(this.xAxis, 2, 2);

      this.xAxis.showEndTickLabels(true);
      this.xAxis.margin(xConfigs.margin);

      if (xConfigs.tickingStep) {
        if (this.xScale instanceof Scales.Linear && typeof xConfigs.tickingStep === 'number') {
          const xScaleTickGenerator = Scales.TickGenerators.intervalTickGenerator(xConfigs.tickingStep);
          this.xScale.tickGenerator(xScaleTickGenerator);
          if (xConfigs.axisMin && typeof xConfigs.axisMin === 'number') {
            this.xScale.domainMin(xConfigs.axisMin);