Browse Source

chore(version): bump to v0.4.21

pull/2296/head v0.4.21
Yoshiya Hinosawa 7 years ago
parent
commit
8780cdd4aa
  1. 2
      .bmp.yml
  2. 6
      c3.css
  3. 116
      c3.js
  4. 2
      c3.min.css
  5. 4
      c3.min.js
  6. 2
      component.json
  7. 2
      package.json
  8. 2
      src/core.js

2
.bmp.yml

@ -1,5 +1,5 @@
---
version: 0.4.20
version: 0.4.21
commit: 'chore(version): bump to v%.%.%'
files:
src/core.js: 'version: "%.%.%"'

6
c3.css

@ -22,6 +22,10 @@
.c3-chart-arc path {
stroke: #fff; }
.c3-chart-arc rect {
stroke: white;
stroke-width: 1; }
.c3-chart-arc text {
fill: #fff;
font-size: 13px; }
@ -151,7 +155,7 @@
.c3-chart-arcs .c3-chart-arcs-background {
fill: #e0e0e0;
stroke: none; }
stroke: #FFF; }
.c3-chart-arcs .c3-chart-arcs-gauge-unit {
fill: #000;

116
c3.js

@ -1,4 +1,4 @@
/* @license C3.js v0.4.20 | (c) C3 Team and other contributors | http://c3js.org/ */
/* @license C3.js v0.4.21 | (c) C3 Team and other contributors | http://c3js.org/ */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
@ -46,6 +46,7 @@ var CLASS = {
circle: 'c3-circle',
circles: 'c3-circles',
arc: 'c3-arc',
arcLabelLine: 'c3-arc-label-line',
arcs: 'c3-arcs',
area: 'c3-area',
areas: 'c3-areas',
@ -1002,7 +1003,7 @@ c3_axis_fn.redraw = function redraw(transitions, isHidden) {
transitions.axisSubX.call($$.subXAxis);
};
var c3 = { version: "0.4.20" };
var c3 = { version: "0.4.21" };
var c3_chart_fn;
var c3_chart_internal_fn;
@ -1219,11 +1220,6 @@ c3_chart_internal_fn.initWithData = function (data) {
$$.addHiddenLegendIds(config.legend_hide === true ? $$.mapToIds($$.data.targets) : config.legend_hide);
}
// when gauge, hide legend // TODO: fix
if ($$.hasType('gauge')) {
config.legend_show = false;
}
// Init sizes and scales
$$.updateSizes();
$$.updateScales();
@ -1803,7 +1799,7 @@ c3_chart_internal_fn.getTranslate = function (target) {
y = config.axis_rotated ? 0 : $$.height2;
} else if (target === 'arc') {
x = $$.arcWidth / 2;
y = $$.arcHeight / 2;
y = $$.arcHeight / 2 - ($$.hasType('gauge') ? 6 : 0); // to prevent wrong display of min and max label
}
return "translate(" + x + "," + y + ")";
};
@ -4349,11 +4345,13 @@ c3_chart_internal_fn.initPie = function () {
c3_chart_internal_fn.updateRadius = function () {
var $$ = this,
config = $$.config,
w = config.gauge_width || config.donut_width;
$$.radiusExpanded = Math.min($$.arcWidth, $$.arcHeight) / 2;
w = config.gauge_width || config.donut_width,
gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length * $$.config.gauge_arcs_minWidth;
$$.radiusExpanded = Math.min($$.arcWidth, $$.arcHeight) / 2 * ($$.hasType('gauge') ? 0.85 : 1);
$$.radius = $$.radiusExpanded * 0.95;
$$.innerRadiusRatio = w ? ($$.radius - w) / $$.radius : 0.6;
$$.innerRadius = $$.hasType('donut') || $$.hasType('gauge') ? $$.radius * $$.innerRadiusRatio : 0;
$$.gaugeArcWidth = w ? w : gaugeArcWidth <= $$.radius - $$.innerRadius ? $$.radius - $$.innerRadius : gaugeArcWidth <= $$.radius ? gaugeArcWidth : $$.radius;
};
c3_chart_internal_fn.updateArc = function () {
@ -4404,7 +4402,13 @@ c3_chart_internal_fn.updateAngle = function (d) {
c3_chart_internal_fn.getSvgArc = function () {
var $$ = this,
arc = $$.d3.svg.arc().outerRadius($$.radius).innerRadius($$.innerRadius),
hasGaugeType = $$.hasType('gauge'),
singleArcWidth = $$.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
arc = $$.d3.svg.arc().outerRadius(function (d) {
return hasGaugeType ? $$.radius - singleArcWidth * d.index : $$.radius;
}).innerRadius(function (d) {
return hasGaugeType ? $$.radius - singleArcWidth * (d.index + 1) : $$.innerRadius;
}),
newArc = function newArc(d, withoutUpdate) {
var updated;
if (withoutUpdate) {
@ -4419,8 +4423,16 @@ c3_chart_internal_fn.getSvgArc = function () {
};
c3_chart_internal_fn.getSvgArcExpanded = function (rate) {
var $$ = this,
arc = $$.d3.svg.arc().outerRadius($$.radiusExpanded * (rate ? rate : 1)).innerRadius($$.innerRadius);
rate = rate || 1;
var $$ = this,
hasGaugeType = $$.hasType('gauge'),
singleArcWidth = $$.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
expandWidth = Math.min($$.radiusExpanded * rate - $$.radius, singleArcWidth * 0.8 - (1 - rate) * 100),
arc = $$.d3.svg.arc().outerRadius(function (d) {
return hasGaugeType ? $$.radius - singleArcWidth * d.index + expandWidth : $$.radiusExpanded * rate;
}).innerRadius(function (d) {
return hasGaugeType ? $$.radius - singleArcWidth * (d.index + 1) : $$.innerRadius;
});
return function (d) {
var updated = $$.updateAngle(d);
return updated ? arc(updated) : "M 0 0";
@ -4440,8 +4452,9 @@ c3_chart_internal_fn.transformForArcLabel = function (d) {
y,
h,
ratio,
translate = "";
if (updated && !$$.hasType('gauge')) {
translate = "",
hasGauge = $$.hasType('gauge');
if (updated && !hasGauge) {
c = this.svgArc.centroid(updated);
x = isNaN(c[0]) ? 0 : c[0];
y = isNaN(c[1]) ? 0 : c[1];
@ -4454,6 +4467,11 @@ c3_chart_internal_fn.transformForArcLabel = function (d) {
ratio = $$.radius && h ? (36 / $$.radius > 0.375 ? 1.175 - 36 / $$.radius : 0.8) * $$.radius / h : 0;
}
translate = "translate(" + x * ratio + ',' + y * ratio + ")";
} else if (updated && hasGauge && $$.filterTargetsToShow($$.data.targets).length > 1) {
var y1 = Math.sin(updated.endAngle - Math.PI / 2);
x = Math.cos(updated.endAngle - Math.PI / 2) * ($$.radiusExpanded + 25);
y = y1 * ($$.radiusExpanded + 15 - Math.abs(y1 * 10)) + 3;
translate = "translate(" + x + ',' + y + ")";
}
return translate;
};
@ -4641,7 +4659,10 @@ c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransf
d3 = $$.d3,
config = $$.config,
main = $$.main,
mainArc;
mainArc,
backgroundArc,
mainArcLabelLine,
hasGaugeType = $$.hasType('gauge');
mainArc = main.selectAll('.' + CLASS.arcs).selectAll('.' + CLASS.arc).data($$.arcData.bind($$));
mainArc.enter().append('path').attr("class", $$.classArc.bind($$)).style("fill", function (d) {
return $$.color(d.data);
@ -4653,6 +4674,37 @@ c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransf
}
this._current = d;
});
if (hasGaugeType) {
mainArcLabelLine = main.selectAll('.' + CLASS.arcs).selectAll('.' + CLASS.arcLabelLine).data($$.arcData.bind($$));
mainArcLabelLine.enter().append('rect').attr("class", function (d) {
return CLASS.arcLabelLine + ' ' + CLASS.target + ' ' + CLASS.target + '-' + d.data.id;
});
if ($$.filterTargetsToShow($$.data.targets).length === 1) {
mainArcLabelLine.style("display", "none");
} else {
mainArcLabelLine.style("fill", function (d) {
return config.color_pattern.length > 0 ? $$.levelColor(d.data.values[0].value) : $$.color(d.data);
}).style("display", config.gauge_labelLine_show ? "" : "none").each(function (d) {
var lineLength = 0,
lineThickness = 2,
x = 0,
y = 0,
transform = "";
if ($$.hiddenTargetIds.indexOf(d.data.id) < 0) {
var updated = $$.updateAngle(d),
innerLineLength = $$.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length * (updated.index + 1),
lineAngle = updated.endAngle - Math.PI / 2,
arcInnerRadius = $$.radius - innerLineLength,
linePositioningAngle = lineAngle - (arcInnerRadius === 0 ? 0 : 1 / arcInnerRadius);
lineLength = $$.radiusExpanded - $$.radius + innerLineLength;
x = Math.cos(linePositioningAngle) * arcInnerRadius;
y = Math.sin(linePositioningAngle) * arcInnerRadius;
transform = "rotate(" + lineAngle * 180 / Math.PI + ", " + x + ", " + y + ")";
}
d3.select(this).attr({ x: x, y: y, width: lineLength, height: lineThickness, transform: transform }).style("stroke-dasharray", "0, " + (lineLength + lineThickness) + ", 0");
});
}
}
mainArc.attr("transform", function (d) {
return !$$.isGaugeType(d.data) && withTransform ? "scale(0)" : "";
}).on('mouseover', config.interaction_enabled ? function (d) {
@ -4743,21 +4795,33 @@ c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransf
main.selectAll('.' + CLASS.chartArc).select('text').style("opacity", 0).attr('class', function (d) {
return $$.isGaugeType(d.data) ? CLASS.gaugeValue : '';
}).text($$.textForArcLabel.bind($$)).attr("transform", $$.transformForArcLabel.bind($$)).style('font-size', function (d) {
return $$.isGaugeType(d.data) ? Math.round($$.radius / 5) + 'px' : '';
return $$.isGaugeType(d.data) && $$.filterTargetsToShow($$.data.targets).length === 1 ? Math.round($$.radius / 5) + 'px' : '';
}).transition().duration(duration).style("opacity", function (d) {
return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? 1 : 0;
});
main.select('.' + CLASS.chartArcsTitle).style("opacity", $$.hasType('donut') || $$.hasType('gauge') ? 1 : 0);
main.select('.' + CLASS.chartArcsTitle).style("opacity", $$.hasType('donut') || hasGaugeType ? 1 : 0);
if (hasGaugeType) {
var index = 0;
backgroundArc = $$.arcs.select('g.' + CLASS.chartArcsBackground).selectAll('path.' + CLASS.chartArcsBackground).data($$.data.targets);
backgroundArc.enter().append("path");
backgroundArc.attr("class", function (d, i) {
return CLASS.chartArcsBackground + ' ' + CLASS.chartArcsBackground + '-' + i;
}).attr("d", function (d1) {
if ($$.hiddenTargetIds.indexOf(d1.id) >= 0) {
return "M 0 0";
}
if ($$.hasType('gauge')) {
$$.arcs.select('.' + CLASS.chartArcsBackground).attr("d", function () {
var d = {
data: [{ value: config.gauge_max }],
startAngle: config.gauge_startingAngle,
endAngle: -1 * config.gauge_startingAngle * (config.gauge_fullCircle ? Math.PI : 1)
endAngle: -1 * config.gauge_startingAngle * (config.gauge_fullCircle ? Math.PI : 1),
index: index++
};
return $$.getArc(d, true, true);
});
backgroundArc.exit().remove();
$$.arcs.select('.' + CLASS.chartArcsGaugeUnit).attr("dy", ".75em").text(config.gauge_label_show ? config.gauge_units : '');
$$.arcs.select('.' + CLASS.chartArcsGaugeMin).attr("dx", -1 * ($$.innerRadius + ($$.radius - $$.innerRadius) / (config.gauge_fullCircle ? 1 : 2)) + "px").attr("dy", "1.2em").text(config.gauge_label_show ? $$.textForGaugeMinMax(config.gauge_min, false) : '');
$$.arcs.select('.' + CLASS.chartArcsGaugeMax).attr("dx", $$.innerRadius + ($$.radius - $$.innerRadius) / (config.gauge_fullCircle ? 1 : 2) + "px").attr("dy", "1.2em").text(config.gauge_label_show ? $$.textForGaugeMinMax(config.gauge_max, true) : '');
@ -4766,7 +4830,7 @@ c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransf
c3_chart_internal_fn.initGauge = function () {
var arcs = this.arcs;
if (this.hasType('gauge')) {
arcs.append('path').attr("class", CLASS.chartArcsBackground);
arcs.append('g').attr("class", CLASS.chartArcsBackground);
arcs.append("text").attr("class", CLASS.chartArcsGaugeUnit).style("text-anchor", "middle").style("pointer-events", "none");
arcs.append("text").attr("class", CLASS.chartArcsGaugeMin).style("text-anchor", "middle").style("pointer-events", "none");
arcs.append("text").attr("class", CLASS.chartArcsGaugeMax).style("text-anchor", "middle").style("pointer-events", "none");
@ -5208,6 +5272,7 @@ c3_chart_internal_fn.getDefaultConfig = function () {
// gauge
gauge_fullCircle: false,
gauge_label_show: true,
gauge_labelLine_show: true,
gauge_label_format: undefined,
gauge_min: 0,
gauge_max: 100,
@ -5215,6 +5280,7 @@ c3_chart_internal_fn.getDefaultConfig = function () {
gauge_label_extents: undefined,
gauge_units: undefined,
gauge_width: undefined,
gauge_arcs_minWidth: 5,
gauge_expand: {},
gauge_expand_duration: 50,
// donut
@ -7479,7 +7545,9 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
}).attr('x', xForLegendRect).attr('y', yForLegendRect);
tiles = $$.legend.selectAll('line.' + CLASS.legendItemTile).data(targetIds);
(withTransition ? tiles.transition() : tiles).style('stroke', $$.color).attr('x1', x1ForLegendTile).attr('y1', yForLegendTile).attr('x2', x2ForLegendTile).attr('y2', yForLegendTile);
(withTransition ? tiles.transition() : tiles).style('stroke', $$.levelColor ? function (id) {
return $$.levelColor($$.cache[id].values[0].value);
} : $$.color).attr('x1', x1ForLegendTile).attr('y1', yForLegendTile).attr('x2', x2ForLegendTile).attr('y2', yForLegendTile);
if (background) {
(withTransition ? background.transition() : background).attr('height', $$.getLegendHeight() - 12).attr('width', maxWidth * (step + 1) + 10);
@ -9002,7 +9070,7 @@ c3_chart_internal_fn.tooltipPosition = function (dataToShow, tWidth, tHeight, el
// Determin tooltip position
if (forArc) {
tooltipLeft = ($$.width - ($$.isLegendRight ? $$.getLegendWidth() : 0)) / 2 + mouse[0];
tooltipTop = $$.height / 2 + mouse[1] + 20;
tooltipTop = ($$.hasType('gauge') ? $$.height : $$.height / 2) + mouse[1] + 20;
} else {
svgLeft = $$.getSvgLeft(true);
if (config.axis_rotated) {

2
c3.min.css vendored

@ -1 +1 @@
.c3 svg{font:10px sans-serif;-webkit-tap-highlight-color:transparent}.c3 line,.c3 path{fill:none;stroke:#000}.c3 text{-webkit-user-select:none;-moz-user-select:none;user-select:none}.c3-bars path,.c3-event-rect,.c3-legend-item-tile,.c3-xgrid-focus,.c3-ygrid{shape-rendering:crispEdges}.c3-chart-arc path{stroke:#fff}.c3-chart-arc text{fill:#fff;font-size:13px}.c3-grid line{stroke:#aaa}.c3-grid text{fill:#aaa}.c3-xgrid,.c3-ygrid{stroke-dasharray:3 3}.c3-text.c3-empty{fill:grey;font-size:2em}.c3-line{stroke-width:1px}.c3-circle._expanded_{stroke-width:1px;stroke:#fff}.c3-selected-circle{fill:#fff;stroke-width:2px}.c3-bar{stroke-width:0}.c3-bar._expanded_{fill-opacity:1;fill-opacity:.75}.c3-target.c3-focused{opacity:1}.c3-target.c3-focused path.c3-line,.c3-target.c3-focused path.c3-step{stroke-width:2px}.c3-target.c3-defocused{opacity:.3!important}.c3-region{fill:#4682b4;fill-opacity:.1}.c3-brush .extent{fill-opacity:.1}.c3-legend-item{font-size:12px}.c3-legend-item-hidden{opacity:.15}.c3-legend-background{opacity:.75;fill:#fff;stroke:#d3d3d3;stroke-width:1}.c3-title{font:14px sans-serif}.c3-tooltip-container{z-index:10}.c3-tooltip{border-collapse:collapse;border-spacing:0;background-color:#fff;empty-cells:show;-webkit-box-shadow:7px 7px 12px -9px #777;-moz-box-shadow:7px 7px 12px -9px #777;box-shadow:7px 7px 12px -9px #777;opacity:.9}.c3-tooltip tr{border:1px solid #ccc}.c3-tooltip th{background-color:#aaa;font-size:14px;padding:2px 5px;text-align:left;color:#fff}.c3-tooltip td{font-size:13px;padding:3px 6px;background-color:#fff;border-left:1px dotted #999}.c3-tooltip td>span{display:inline-block;width:10px;height:10px;margin-right:6px}.c3-tooltip td.value{text-align:right}.c3-area{stroke-width:0;opacity:.2}.c3-chart-arcs-title{dominant-baseline:middle;font-size:1.3em}.c3-chart-arcs .c3-chart-arcs-background{fill:#e0e0e0;stroke:none}.c3-chart-arcs .c3-chart-arcs-gauge-unit{fill:#000;font-size:16px}.c3-chart-arcs .c3-chart-arcs-gauge-max{fill:#777}.c3-chart-arcs .c3-chart-arcs-gauge-min{fill:#777}.c3-chart-arc .c3-gauge-value{fill:#000}.c3-chart-arc.c3-target g path{opacity:1}.c3-chart-arc.c3-target.c3-focused g path{opacity:1}
.c3 svg{font:10px sans-serif;-webkit-tap-highlight-color:transparent}.c3 line,.c3 path{fill:none;stroke:#000}.c3 text{-webkit-user-select:none;-moz-user-select:none;user-select:none}.c3-bars path,.c3-event-rect,.c3-legend-item-tile,.c3-xgrid-focus,.c3-ygrid{shape-rendering:crispEdges}.c3-chart-arc path{stroke:#fff}.c3-chart-arc rect{stroke:#fff;stroke-width:1}.c3-chart-arc text{fill:#fff;font-size:13px}.c3-grid line{stroke:#aaa}.c3-grid text{fill:#aaa}.c3-xgrid,.c3-ygrid{stroke-dasharray:3 3}.c3-text.c3-empty{fill:grey;font-size:2em}.c3-line{stroke-width:1px}.c3-circle._expanded_{stroke-width:1px;stroke:#fff}.c3-selected-circle{fill:#fff;stroke-width:2px}.c3-bar{stroke-width:0}.c3-bar._expanded_{fill-opacity:1;fill-opacity:.75}.c3-target.c3-focused{opacity:1}.c3-target.c3-focused path.c3-line,.c3-target.c3-focused path.c3-step{stroke-width:2px}.c3-target.c3-defocused{opacity:.3!important}.c3-region{fill:#4682b4;fill-opacity:.1}.c3-brush .extent{fill-opacity:.1}.c3-legend-item{font-size:12px}.c3-legend-item-hidden{opacity:.15}.c3-legend-background{opacity:.75;fill:#fff;stroke:#d3d3d3;stroke-width:1}.c3-title{font:14px sans-serif}.c3-tooltip-container{z-index:10}.c3-tooltip{border-collapse:collapse;border-spacing:0;background-color:#fff;empty-cells:show;-webkit-box-shadow:7px 7px 12px -9px #777;-moz-box-shadow:7px 7px 12px -9px #777;box-shadow:7px 7px 12px -9px #777;opacity:.9}.c3-tooltip tr{border:1px solid #ccc}.c3-tooltip th{background-color:#aaa;font-size:14px;padding:2px 5px;text-align:left;color:#fff}.c3-tooltip td{font-size:13px;padding:3px 6px;background-color:#fff;border-left:1px dotted #999}.c3-tooltip td>span{display:inline-block;width:10px;height:10px;margin-right:6px}.c3-tooltip td.value{text-align:right}.c3-area{stroke-width:0;opacity:.2}.c3-chart-arcs-title{dominant-baseline:middle;font-size:1.3em}.c3-chart-arcs .c3-chart-arcs-background{fill:#e0e0e0;stroke:#fff}.c3-chart-arcs .c3-chart-arcs-gauge-unit{fill:#000;font-size:16px}.c3-chart-arcs .c3-chart-arcs-gauge-max{fill:#777}.c3-chart-arcs .c3-chart-arcs-gauge-min{fill:#777}.c3-chart-arc .c3-gauge-value{fill:#000}.c3-chart-arc.c3-target g path{opacity:1}.c3-chart-arc.c3-target.c3-focused g path{opacity:1}

4
c3.min.js vendored

File diff suppressed because one or more lines are too long

2
component.json

@ -2,7 +2,7 @@
"name": "c3",
"repo": "masayuki0812/c3",
"description": "A D3-based reusable chart library",
"version": "0.4.20",
"version": "0.4.21",
"keywords": [],
"dependencies": {
"mbostock/d3": "v3.5.6"

2
package.json

@ -1,6 +1,6 @@
{
"name": "c3",
"version": "0.4.20",
"version": "0.4.21",
"description": "D3-based reusable chart library",
"main": "c3.js",
"scripts": {

2
src/core.js

@ -2,7 +2,7 @@ import Axis from './axis';
import CLASS from './class';
import { isValue, isFunction, isString, isUndefined, isDefined, ceil10, asHalfPixel, diffDomain, isEmpty, notEmpty, getOption, hasValue, sanitise, getPathBox } from './util';
export var c3 = { version: "0.4.20" };
export var c3 = { version: "0.4.21" };
export var c3_chart_fn;
export var c3_chart_internal_fn;

Loading…
Cancel
Save