我有一个Flot图表,我想在其父容器中跨越100%。只要我关闭了xaxis show选项,它就可以像我想要的那样工作。

但是,一旦我打开它,它就会在左侧添加一个间隙(如您从所附图像中看到的)。权利很好。

有任何想法吗?这是我的网格和xaxis设置:

grid: {
  borderColor: 'transparent',
  hoverable: false,
  backgroundColor: 'transparent',
  minBorderMargin: 0,
  borderWidth: 0,
  margin: {
    top: 10,
    right: 0,
    bottom: 0,
    left: 0
  }
},
xaxis: {
  show: true,
  mode: "time",
  timezone: 'browser',
  timeformat: "%b",
  minTickSize: [1, "month"],
  reserveSpace: false,
  font: {
    size: 11,
  }
}

我使用的是Flot版本0.8.2和jQuery版本1.10.2。

最佳答案

你可以用css做。只需在类(class)上给左边留空白或在图表上输入ID即可。像这样的东西:

#chart {margin-left:-5px;}

我只是给你margin-left:5px;您可以据此进行调整。希望它会有所帮助:)

09-25 16:26
查看更多