How to use the plottable.Axes.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
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;

    if (yConfigs.show) {
      chartTable.add(this.yAxis, 1, 1);

      this.yAxis.margin(yConfigs.margin);
      if (typeof yConfigs.tickingStep === 'number') {
        const yScaleTickGenerator = Scales.TickGenerators.intervalTickGenerator(yConfigs.tickingStep);
        this.yScale.tickGenerator(yScaleTickGenerator);
      }
github devinit / datahub / src / components / organisms / Charts / components / BarChart / BarChart.tsx View on Github external
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;

    if (yConfigs.show) {
      chartTable.add(this.yAxis, 1, 1);

      this.yAxis.margin(yConfigs.margin);
      if (typeof yConfigs.tickingStep === 'number') {
        const yScaleTickGenerator = Scales.TickGenerators.intervalTickGenerator(yConfigs.tickingStep);
        this.yScale.tickGenerator(yScaleTickGenerator);
      }