Commit b90685c7 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix svg height when gauge - #470

parent 140cf726
...@@ -371,6 +371,9 @@ ...@@ -371,6 +371,9 @@
// for arc // for arc
$$.arcWidth = $$.width - ($$.isLegendRight ? legendWidth + 10 : 0); $$.arcWidth = $$.width - ($$.isLegendRight ? legendWidth + 10 : 0);
$$.arcHeight = $$.height - ($$.isLegendRight ? 0 : 10); $$.arcHeight = $$.height - ($$.isLegendRight ? 0 : 10);
if ($$.hasType('gauge')) {
$$.arcHeight += $$.height - $$.getGaugeLabelHeight();
}
if ($$.updateRadius) { $$.updateRadius(); } if ($$.updateRadius) { $$.updateRadius(); }
if ($$.isLegendRight && hasArc) { if ($$.isLegendRight && hasArc) {
...@@ -2257,7 +2260,7 @@ ...@@ -2257,7 +2260,7 @@
c3_chart_internal_fn.getCurrentHeight = function () { c3_chart_internal_fn.getCurrentHeight = function () {
var $$ = this, config = $$.config, var $$ = this, config = $$.config,
h = config.size_height ? config.size_height : $$.getParentHeight(); h = config.size_height ? config.size_height : $$.getParentHeight();
return h > 0 ? h : 320; return h > 0 ? h : 320 / ($$.hasType('gauge') ? 2 : 1);
}; };
c3_chart_internal_fn.getCurrentPaddingTop = function () { c3_chart_internal_fn.getCurrentPaddingTop = function () {
var config = this.config; var config = this.config;
...@@ -4399,6 +4402,9 @@ ...@@ -4399,6 +4402,9 @@
.text(config.gauge_label_show ? config.gauge_max : ''); .text(config.gauge_label_show ? config.gauge_max : '');
} }
}; };
c3_chart_internal_fn.getGaugeLabelHeight = function () {
return this.config.gauge_label_show ? 20 : 0;
};
c3_chart_internal_fn.initRegion = function () { c3_chart_internal_fn.initRegion = function () {
var $$ = this; var $$ = this;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -360,3 +360,6 @@ c3_chart_internal_fn.initGauge = function () { ...@@ -360,3 +360,6 @@ c3_chart_internal_fn.initGauge = function () {
.text(config.gauge_label_show ? config.gauge_max : ''); .text(config.gauge_label_show ? config.gauge_max : '');
} }
}; };
c3_chart_internal_fn.getGaugeLabelHeight = function () {
return this.config.gauge_label_show ? 20 : 0;
};
...@@ -366,6 +366,9 @@ c3_chart_internal_fn.updateSizes = function () { ...@@ -366,6 +366,9 @@ c3_chart_internal_fn.updateSizes = function () {
// for arc // for arc
$$.arcWidth = $$.width - ($$.isLegendRight ? legendWidth + 10 : 0); $$.arcWidth = $$.width - ($$.isLegendRight ? legendWidth + 10 : 0);
$$.arcHeight = $$.height - ($$.isLegendRight ? 0 : 10); $$.arcHeight = $$.height - ($$.isLegendRight ? 0 : 10);
if ($$.hasType('gauge')) {
$$.arcHeight += $$.height - $$.getGaugeLabelHeight();
}
if ($$.updateRadius) { $$.updateRadius(); } if ($$.updateRadius) { $$.updateRadius(); }
if ($$.isLegendRight && hasArc) { if ($$.isLegendRight && hasArc) {
......
...@@ -5,7 +5,7 @@ c3_chart_internal_fn.getCurrentWidth = function () { ...@@ -5,7 +5,7 @@ c3_chart_internal_fn.getCurrentWidth = function () {
c3_chart_internal_fn.getCurrentHeight = function () { c3_chart_internal_fn.getCurrentHeight = function () {
var $$ = this, config = $$.config, var $$ = this, config = $$.config,
h = config.size_height ? config.size_height : $$.getParentHeight(); h = config.size_height ? config.size_height : $$.getParentHeight();
return h > 0 ? h : 320; return h > 0 ? h : 320 / ($$.hasType('gauge') ? 2 : 1);
}; };
c3_chart_internal_fn.getCurrentPaddingTop = function () { c3_chart_internal_fn.getCurrentPaddingTop = function () {
var config = this.config; var config = this.config;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment