首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >高图集删除第一栏之前和最后一栏之后的空间

高图集删除第一栏之前和最后一栏之后的空间
EN

Stack Overflow用户
提问于 2016-12-25 22:27:15
回答 1查看 822关注 0票数 0

我试图删除这个图表的顶部和底部的空间,http://jsfiddle.net/bfa1o0ar/7/。这是在第一条之前和最后一条之后的间距。我试过移除垫子、毛边等。

代码语言:javascript
复制
$(function() {
  Highcharts.chart('container', {
    chart: {
        marginTop: 0,
      marginBottom: 0,
      spacingTop: 0,
      spacingBottom: 0,
      type: 'bar',
      title: {
        text: ''
      }
    },
    credits: {
      enabled: false
    },
    title: {
      text: null
    },
    xAxis: {
      minPadding:0,
      maxPadding:0,
        lineWidth: 0,
        gridLineWidth: 0,
      tickWidth: 0,
      tickAmount: 0,
      tickmarkPlacement: 'on',
      categories: ['1-3', '4-7', '7-10', '11-14', '15-20'],
      allowDecimals: false,
    },
    yAxis: {
      minPadding:0,
      maxPadding:0,
        lineWidth: 0,
        gridLineWidth: 0,
      endOnTick: false,
      showFirstLabel: false,
      showLastLabel: false,
      startOnTick: false,
      tickWidth: 0,
      tickAmount: 0,
      //tickmarkPlacement: 'between',
      min: 0,
      allowDecimals: false,
      title: {
        text: ''
      },
      stackLabels: {
        enabled: true,
        style: {
          fontWeight: 'bold',
          color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
        }
      }
    },
    legend: {
      enabled: false
    },
    plotOptions: {
      column: {
        groupPadding: 0,
        pointPadding: 0,
        //pointWidth: 35, // width of bar
        pointRange: 0
      },
      series: {
        pointPadding: 0.1,
        groupPadding: 0,
        borderWidth: 0,
        //pointWidth: 30,
        shadow: false,
        stacking: 'normal',
        dataLabels: {
          align: 'right',
          enabled: false,
          color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
        },
      }
    },
    series: [{
      name: 'John',
      data: [5, 3, 4, 7, 2]
    }]
  });
});
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-12-27 14:05:16

将x轴的最小/最大值设置为first category index + 0.1last category index - 0.1

代码语言:javascript
复制
  min: 0 + 0.1,
  max: 4 - 0.1
},

示例:http://jsfiddle.net/bfa1o0ar/8/

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41324956

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档