Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts axis label before first point

Good morning,

I'm having a really annoying issue with Highcharts, such that the x-axis label(using datetime) won't start at my first datapoint - as in this image:

enter image description here

As you can see, the chart label starts at 15. Aug, whereas it shoudl start at 9. Aug.

Setting the startOnTick: true forces the axis label to start on the left, but the label still doesn't correspond to my first point - as in this image:

enter image description here

Where you can see the label starting at 8.Aug, when it should start at 9. Aug. Better shown in my hourly chart:

enter image description here

My series type is line and the data takes a [dateutc, decimal] pair. The datetime intervals are not at regular intervals and can range from hourly to daily to monthly.

xAxis: {
  type: "datetime",
  lineWidth: 2,
  //startOnTick: true,
  //showFirstLabel: true
}
like image 961
Bob Avatar asked Nov 13 '22 17:11

Bob


1 Answers

I think the option you're looking for is tickInterval. The reason that your ticks aren't showing up the way you want is because you don't have a custom tickInterval defined and when you use datetime as your x-axis type it picks one for you.

Here's an example jsfiddle that forces the tickInterval to every 2 days.

like image 118
LightningSorc Avatar answered Jan 05 '23 17:01

LightningSorc