-
-
Couldn't load subscription status.
- Fork 1.4k
Closed
Closed
Copy link
Labels
Description
(codepen @ the bottom)
Im making this in angular.
I set x value as a timestamp.
I have a formatter
public xAxis: ApexXAxis = {
type: 'datetime',
labels: {
formatter: (value, timestamp): string => {
return moment.unix(Number.parseInt(value)).local().format('HH:mm');
}
}
};Tried setting min, max to force the correct format. That didnt work.
this.apexChart.updateOptions({
xaxis: {
tickAmount: 12,
min: this.series[0].data[0].value.date.unix(),
max: this.series[0].data[this.series[0].data.length - 1].value.date.unix()
}
}, false, false, false);This is what happens, time seems all whack. But the tooltip is showing the correct time.

The next problem is with annotations.
I add annotation with
this.apexChart.addPointAnnotation({
x: audio.startTsByAggregation(this.aggregation).unix(),
y: series.data.find((value) => value.x == audio.startTsByAggregation(this.aggregation).unix()).y,
seriesIndex: seriesIndex,
label: {
borderColor: "#775DD0",
style: {
color: "#fff",
background: "#775DD0"
},
text: `Audio - ${audio.start_ts.format('YYYY-MM-DD HH:mm')}`
}
});What happens is it gets added but in completely wrong place.

It should be shown in the 30th where the tooltip is shown.
I checked the x, y and the seriesIndex and they are 100% correct.
Any suggestions how I could fix these problems?
Thanks for this amazing library!