您正在使用的选项:
size: {
height: 100,
width: 100
}
将svg 元素的高度和宽度设置为100px 而不是100%
我试过了
size: {
height: '100%',
width: '100%'
}
这将成功地将width 设置为100%,但不知何故height 将设置为320px
因此,如果您将其添加到您的 css 中:
.c3 svg {
width: 100%;
height: 100%;
}
这将解决您的尺寸问题。
编辑
只需稍作更改即可设置初始大小,并在 resize - stop 事件处理程序上将一些 cmets 添加到您的控制器中,您需要根据新大小添加一些图表大小调整。 See it here
resizable: {
enabled: true,
handles: ['n', 'e', 's', 'w', 'ne', 'se', 'sw', 'nw'],
// optional callback fired when resize is started
start: function(event, $element, widget) {},
// optional callback fired when item is resized,
resize: function(event, $element, widget) {},
// optional callback fired when item is finished resizing
stop: function(event, $element, widget) {
// here should update the size according to the widget size
// widget.sizeX (* 160px) and widget.sizeY (* 160px)
// and further adjustments
}
},