LSM9DS1 compensated heading calculation problem

I have a LSM9DS1 break-out board from SparkFun. I connected it to my Electron board. The example code included in the community header file works. But I find out my final board installation position is vertical, which means 0-degree roll, 90-degree pitch, 0-degree yaw. So in this position, the accelerometer on the LSM9DS1 shows 1g on x-axle, 0g on y-axle, 0g on z-axle.

My question is how can I compensate the heading calculation in this situation? Is this possible or the sensor board should be only installed at horizontal position?

I did read the following application notes:

  1. NXP AN4248
  2. NXP AN3461
  3. ST Microcontroller AN3192