javascript - jQuery Flot: Set width of chart (without labels) - Stack Overflow

Is there any way to set the actual size of the chart (without its labels)?I have a container that is 88

Is there any way to set the actual size of the chart (without its labels)?

I have a container that is 880 pixels width and I'd like to have the chart extend exactly to that and have the axes rather stick out. Right now it's of course applying padding so that the axes can fit in the designated area.

I fiddled around with fixed labelWidth options and negative margins applied to the container but that didn't get me anywhere useful.

Is there any way to set the actual size of the chart (without its labels)?

I have a container that is 880 pixels width and I'd like to have the chart extend exactly to that and have the axes rather stick out. Right now it's of course applying padding so that the axes can fit in the designated area.

I fiddled around with fixed labelWidth options and negative margins applied to the container but that didn't get me anywhere useful.

Share Improve this question asked Aug 7, 2013 at 12:26 maryisdeadmaryisdead 1,8002 gold badges21 silver badges30 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

To make the axes stick out, you can set the labelWidth and labelHeight of the axes (y and x, respectively) to a negative value and give the container a margin, so there's enough room outside.

CSS:

#placeholder {
    border 2px solid red;
    margin: 30px;
}

Flot options:

var options = {
    xaxis: { labelHeight: -10 },
    yaxis: { labelWidth: -10 }
}

There is still a gap between the container border and the plot, as you can see in jsFiddle. You can control that with the grid's minBorderMargin property, but it doesn't pletely hide the plot border, so you may want to set the grid's borderWidth to 0, or set borderColor. I updated the jsFiddle with that.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745110266a4611805.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信