LoginSignup
1
0

More than 5 years have passed since last update.

HighchartsでY軸目盛をゼロを中央、最大値、最小値をデータ値の絶対値から算出して一定間隔にする。

Last updated at Posted at 2017-08-23

HighchartsY軸目盛の設定。

  • yAxis.tickPositionerを設定。
  • this.dataMin, this.dataMaxでデータの最小値、最大値が取得できる。
  • 一定間隔(必ず8等分)
"yAxis":[
{
    "tickPositioner": function () {
         var dataMax = Math.max(Math.abs(this.dataMin), Math.abs(this.dataMax));
         return [-1, -0.75, -0.5, -0.25, 0, 0.25, 0.5, 0.75, 1].map(function (n) {
            return Math.round(dataMax * n);
         });
    },
}

スクリーンショット 2017-08-24 8.39.26.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0