How to use the plottable.Scales.Time 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 / LineChart / LineChart.tsx View on Github external
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);
          }
          if (xConfigs.axisMax && typeof xConfigs.axisMax === 'number') {
            this.xScale.domainMax(xConfigs.axisMax);
          }
        } else if (this.xScale instanceof Scales.Time && typeof xConfigs.tickingStep !== 'number') {
          if (xConfigs.axisMin) {
            this.xScale.domainMin(parseAxisMinMaxToDate(xConfigs.axisMin));
          }
          if (xConfigs.axisMax) {
            this.xScale.domainMax(parseAxisMinMaxToDate(xConfigs.axisMax));
          }
        }
      }
      if (this.xAxis instanceof Axes.Time && xConfigs.timeFormat) {
        const tickingStep = typeof xConfigs.tickingStep !== 'number' ? xConfigs.tickingStep : {};
        this.xAxis.axisConfigurations([ setTimeAxisTickingFormat(xConfigs.timeFormat, tickingStep || {}) ]);
      }
    }

    this.yScale = new Scales.Linear();
    this.yAxis = getAxis(yConfigs, this.yScale) as Axes.Numeric;
github devinit / datahub / src / components / organisms / Charts / components / BarChart / BarChart.tsx View on Github external
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);
          }
          if (xConfigs.axisMax && typeof xConfigs.axisMax === 'number') {
            this.xScale.domainMax(xConfigs.axisMax);
          }
        } else if (this.xScale instanceof Scales.Time && typeof xConfigs.tickingStep !== 'number') {
          if (xConfigs.axisMin) {
            this.xScale.domainMin(parseAxisMinMaxToDate(xConfigs.axisMin));
          }
          if (xConfigs.axisMax) {
            this.xScale.domainMax(parseAxisMinMaxToDate(xConfigs.axisMax));
          }
        }
      }
      if (this.xAxis instanceof Axes.Time && xConfigs.timeFormat) {
        const tickingStep = typeof xConfigs.tickingStep !== 'number' ? xConfigs.tickingStep : {};
        this.xAxis.axisConfigurations([ setTimeAxisTickingFormat(xConfigs.timeFormat, tickingStep || {}) ]);
      }
    }

    this.yScale = new Scales.Linear();
    this.yAxis = getAxis(yConfigs, this.yScale) as Axes.Numeric;