How to use the d3-time-format.timeFormat function in d3-time-format

To help you get started, we’ve selected a few d3-time-format 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 aloysius-pgast / crypto-exchanges-gateway / ui / src / components / ReactStockChartsCandleSticks / Chart.js View on Github external
>

        			
        			

                    

        			

        			 d.close >= d.open ? "#53b987" : "#eb4d5c"}
        				wickStroke={d => d.close >= d.open ? "#53b987" : "#eb4d5c"}
        				fill={d => d.close >= d.open ? "#53b987" : "#eb4d5c"}
                        opacity={1}
                    />

github contiamo / operational-visualizations / src / axis_utils / compute_time_axes.ts View on Github external
export const tickFormatter = (interval: TimeIntervals) => {
  switch (interval) {
    case "hour":
      return timeFormat("%b %d %H:00");
    case "day":
      return timeFormat("%b %d");
    case "week":
      return timeFormat("W%W");
    case "month":
      return timeFormat("%b %y");
    case "quarter":
      return (d: Date): string => timeFormat(`Q${Math.floor((d.getMonth() + 3) / 3)} %Y`)(d);
    case "year":
      return timeFormat("%Y");
    default:
      throw new Error(`Interval of length ${interval} is not supported.`);
  }
};
github globeandmail / chart-tool / src / js / charts / components / axis.js View on Github external
export function determineFormat(context) {
  switch (context) {
    case 'years': return timeFormat('%Y');
    case 'months': return timeFormat('%b');
    case 'weeks': return timeFormat('%W');
    case 'days': return timeFormat('%j');
    case 'hours': return timeFormat('%H');
    case 'minutes': return timeFormat('%M');
  }
}
github AdaptiveConsulting / ReactiveTraderCloud / src / client / src / ui / spotTile / components / notional / utils.ts View on Github external
export function formatDate(date: Date, format: string = '%b %e, %H:%M:%S') {
  return timeFormat(format)(date)
}
github globeandmail / chart-tool / src / js / charts / components / axis.js View on Github external
export function determineFormat(context) {
  switch (context) {
    case 'years': return timeFormat('%Y');
    case 'months': return timeFormat('%b');
    case 'weeks': return timeFormat('%W');
    case 'days': return timeFormat('%j');
    case 'hours': return timeFormat('%H');
    case 'minutes': return timeFormat('%M');
  }
}
github contiamo / operational-ui / packages / visualizations / lib / Chart / axes / time_axis.js View on Github external
var tickFormatter = function (interval) {
    switch (interval) {
        case "hour":
            return d3_time_format_1.timeFormat("%b %d %H:00");
        case "day":
            return d3_time_format_1.timeFormat("%b %d");
        case "week":
            return d3_time_format_1.timeFormat("W%W");
        case "month":
            return d3_time_format_1.timeFormat("%b %y");
        case "quarter":
            return function (d) { return d3_time_format_1.timeFormat("Q" + Math.floor((d.getMonth() + 3) / 3) + " %Y")(d); };
        case "year":
            return d3_time_format_1.timeFormat("%Y");
        default:
            throw new Error("Interval of length " + interval + " is not supported.");
    }
};
var TimeAxis = /** @class */ (function () {
github NUKnightLab / storyline / src / js / slider.js View on Github external
populateSlideDates: function(card) {
    var d3Time = require('d3-time-format');

    if(!this.config.chart.datetime_format) {
      card["displayDate"] = card.date
    } else {
      var formatter = d3Time.timeFormat(this.config.chart.datetime_format);
      card["displayDate"] = formatter(card.date)
    }
  },
  goToCard: function(number) {