Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
>
d.close >= d.open ? "#53b987" : "#eb4d5c"}
wickStroke={d => d.close >= d.open ? "#53b987" : "#eb4d5c"}
fill={d => d.close >= d.open ? "#53b987" : "#eb4d5c"}
opacity={1}
/>
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.`);
}
};
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');
}
}
export function formatDate(date: Date, format: string = '%b %e, %H:%M:%S') {
return timeFormat(format)(date)
}
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');
}
}
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 () {
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) {