4

我有一个极坐标图,我试图在 x 轴上移动四个标签中的两个。它是狭窄空间中的菱形,因此左右的标签被切断。我试图移动它们,但我无法让它们移动。我正在尝试将标签类别 1 和类别 3 向下移动 30 像素并向中心移动约 100 像素。

标签代码

  xAxis: {
   categories: ['Category 1', 'Category 2', 'Category 3', 'Category 4'],
   tickmarkPlacement: 'on',
   lineWidth: 0,
   labels: {
   style: { fontSize: '150%',
},
},
},

小提琴 https://jsfiddle.net/Adam300/kuvs0eah/8/

我从这里查看了这个小提琴,但我无法理解它。

4

2 回答 2

2

由于只有一个系列,我能想到的唯一解决方案是使用这个 CSS 代码:

.highcharts-xaxis-labels text:nth-child(1), .highcharts-xaxis-labels text:nth-child(3){
   transform: translate(0,47px); !important;
}

它并不完美,但它的作品

小提琴

于 2018-08-09T17:58:23.583 回答
2

您可以设置chart.marginLeftchart.marginRight属性来定义图表容器的边距。请看下面的代码和示例:

chart: {
   polar: true,
   type: 'line',
   marginLeft: 100,
   marginRight: 100,
   style: {
    fontFamily: 'Georgia',
   }
}

现场示例:https ://jsfiddle.net/fjhz4wx7/

API参考:

https://api.highcharts.com/highcharts/chart.marginLeft

https://api.highcharts.com/highcharts/chart.marginRight

亲切的问候!

于 2018-08-09T20:15:32.020 回答