public getTimeAxisLabel(kind: string): AxisLabel | null {
if (kind !== 'main' || !this.isActive || !this.point || typeof this.point.time !== 'number') {
return null;
}
const coordinate = getXCoordinateFromTime(this.chart, this.point.time);
if (coordinate === null) {
return null;
}
const { colors } = getThemeStore();
return {
coordinate,
text: formatDate(
this.point.time as UTCTimestamp,
this.displayFormat.dateFormat,
this.displayFormat.timeFormat,
this.displayFormat.showTime,
),
textColor: colors.chartPriceLineText,
backgroundColor: colors.axisMarkerLabelFill,
};
}
public getPriceAxisLabel(kind: string): AxisLabel | null {
if (kind !== 'main' || !this.isActive || !this.point) {
return null;
}
const coordinate = getYCoordinateFromPrice(this.series, this.point.price);
if (coordinate === null) {
return null;
}
const { colors } = getThemeStore();
return {
coordinate,
text: formatPrice(this.point.price) ?? '',
textColor: colors.chartPriceLineText,
backgroundColor: colors.axisMarkerLabelFill,
};
}