Browse Source

Fix svg height when gauge - #470

pull/1616/head
Masayuki Tanaka 10 years ago
parent
commit
b90685c723
  1. 8
      c3.js
  2. 8
      c3.min.js
  3. 3
      src/arc.js
  4. 3
      src/core.js
  5. 2
      src/size.js

8
c3.js

@ -371,6 +371,9 @@
// for arc
$$.arcWidth = $$.width - ($$.isLegendRight ? legendWidth + 10 : 0);
$$.arcHeight = $$.height - ($$.isLegendRight ? 0 : 10);
if ($$.hasType('gauge')) {
$$.arcHeight += $$.height - $$.getGaugeLabelHeight();
}
if ($$.updateRadius) { $$.updateRadius(); }
if ($$.isLegendRight && hasArc) {
@ -2257,7 +2260,7 @@
c3_chart_internal_fn.getCurrentHeight = function () {
var $$ = this, config = $$.config,
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 () {
var config = this.config;
@ -4399,6 +4402,9 @@
.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 () {
var $$ = this;

8
c3.min.js vendored

File diff suppressed because one or more lines are too long

3
src/arc.js

@ -360,3 +360,6 @@ c3_chart_internal_fn.initGauge = function () {
.text(config.gauge_label_show ? config.gauge_max : '');
}
};
c3_chart_internal_fn.getGaugeLabelHeight = function () {
return this.config.gauge_label_show ? 20 : 0;
};

3
src/core.js

@ -366,6 +366,9 @@ c3_chart_internal_fn.updateSizes = function () {
// for arc
$$.arcWidth = $$.width - ($$.isLegendRight ? legendWidth + 10 : 0);
$$.arcHeight = $$.height - ($$.isLegendRight ? 0 : 10);
if ($$.hasType('gauge')) {
$$.arcHeight += $$.height - $$.getGaugeLabelHeight();
}
if ($$.updateRadius) { $$.updateRadius(); }
if ($$.isLegendRight && hasArc) {

2
src/size.js

@ -5,7 +5,7 @@ c3_chart_internal_fn.getCurrentWidth = function () {
c3_chart_internal_fn.getCurrentHeight = function () {
var $$ = this, config = $$.config,
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 () {
var config = this.config;

Loading…
Cancel
Save