箱图上忽略了xAxis startOnTick和endOnTick选项

时间:2013-12-30 14:59:18

标签: highcharts

似乎选项startOnTickendOnTick对箱线图没有影响。无论如何使用箱线图将最外面的刻度线对齐到图形边缘?

xAxis: {
  startOnTick: true,
  endOnTick: true,
  min: -1,
  max: 6,
},

我尝试添加minPadding / maxPadding,tickmarkPlacement的大多数组合:在/之间,并且用tickPositioner手动设置滴答,没有任何运气。我唯一的解决方法是缩小min / max,以便padding自行修复。我更喜欢更好的解决方案,因为这种解决方法对于动态数据来说变得非常难看。

以下是展示问题的fiddle demo和解决方法的another。再次,有没有办法用箱线图将最外面的刻度线对齐到图形边缘?

1 个答案:

答案 0 :(得分:5)

调查这一点导致我将这些评论埋没在parts/Axis.js中。

                if (!axis.single) {
                    // minPointOffset is the value padding to the left of
                    // the axis in order to make room for points with a
                    // pointRange, typically columns. When the
                    // pointPlacement option is 'between' or 'on', this
                    // padding does not apply.
                    minPointOffset = Math.max(
                        minPointOffset,
                        isString(pointPlacement) ? 0 : seriesPointRange / 2
                    );

                    // Determine the total padding needed to the length of
                    // the axis to make room for the pointRange. If the
                    // series' pointPlacement is 'on', no padding is added.
                    pointRangePadding = Math.max(
                        pointRangePadding,
                        pointPlacement === 'on' ? 0 : seriesPointRange
                    );
                }

问题是由点填充引起的,可能出现在任何列样式图上。如果系列中pointPlacement设置为'on''between',则会忽略填充。

series: {
  type: 'boxplot',
  pointPlacement: 'on',
  data: ...
}

Here是工作小提琴。

相关问题