Browse Source

Moves bar and arc opacity styling to CSS; closes #1069. (#2069)

pull/2111/head
Ændrew Rininsland 8 years ago committed by Yoshiya Hinosawa
parent
commit
aea27e0075
  1. 6
      src/arc.js
  2. 8
      src/scss/arc.scss
  3. 1
      src/scss/bar.scss
  4. 2
      src/shape.bar.js

6
src/arc.js

@ -191,8 +191,7 @@ c3_chart_internal_fn.unexpandArc = function (targetIds) {
return $$.expandDuration(d.data.id); return $$.expandDuration(d.data.id);
}) })
.attr("d", $$.svgArc); .attr("d", $$.svgArc);
$$.svg.selectAll('.' + CLASS.arc) $$.svg.selectAll('.' + CLASS.arc);
.style("opacity", 1);
}; };
c3_chart_internal_fn.expandDuration = function (id) { c3_chart_internal_fn.expandDuration = function (id) {
@ -297,7 +296,6 @@ c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransf
.attr("class", $$.classArc.bind($$)) .attr("class", $$.classArc.bind($$))
.style("fill", function (d) { return $$.color(d.data); }) .style("fill", function (d) { return $$.color(d.data); })
.style("cursor", function (d) { return config.interaction_enabled && config.data_selection_isselectable(d) ? "pointer" : null; }) .style("cursor", function (d) { return config.interaction_enabled && config.data_selection_isselectable(d) ? "pointer" : null; })
.style("opacity", 0)
.each(function (d) { .each(function (d) {
if ($$.isGaugeType(d.data)) { if ($$.isGaugeType(d.data)) {
d.startAngle = d.endAngle = config.gauge_startingAngle; d.startAngle = d.endAngle = config.gauge_startingAngle;
@ -306,7 +304,6 @@ c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransf
}); });
mainArc mainArc
.attr("transform", function (d) { return !$$.isGaugeType(d.data) && withTransform ? "scale(0)" : ""; }) .attr("transform", function (d) { return !$$.isGaugeType(d.data) && withTransform ? "scale(0)" : ""; })
.style("opacity", function (d) { return d === this._current ? 0 : 1; })
.on('mouseover', config.interaction_enabled ? function (d) { .on('mouseover', config.interaction_enabled ? function (d) {
var updated, arcData; var updated, arcData;
if ($$.transiting) { // skip while transiting if ($$.transiting) { // skip while transiting
@ -387,7 +384,6 @@ c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransf
.style("fill", function (d) { .style("fill", function (d) {
return $$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data.id); return $$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data.id);
}) // Where gauge reading color would receive customization. }) // Where gauge reading color would receive customization.
.style("opacity", 1)
.call($$.endall, function () { .call($$.endall, function () {
$$.transiting = false; $$.transiting = false;
}); });

8
src/scss/arc.scss

@ -22,3 +22,11 @@
fill: #000; fill: #000;
/* font-size: 28px !important;*/ /* font-size: 28px !important;*/
} }
.c3-chart-arc.c3-target g path {
opacity: 1;
}
.c3-chart-arc.c3-target.c3-focused g path {
opacity: 1;
}

1
src/scss/bar.scss

@ -2,5 +2,6 @@
stroke-width: 0; stroke-width: 0;
} }
.c3-bar._expanded_ { .c3-bar._expanded_ {
fill-opacity: 1;
fill-opacity: 0.75; fill-opacity: 0.75;
} }

2
src/shape.bar.js

@ -18,7 +18,6 @@ c3_chart_internal_fn.updateTargetsForBar = function (targets) {
.attr('class', function (d) { return classChartBar(d) + classFocus(d); }); .attr('class', function (d) { return classChartBar(d) + classFocus(d); });
mainBarEnter = mainBarUpdate.enter().append('g') mainBarEnter = mainBarUpdate.enter().append('g')
.attr('class', classChartBar) .attr('class', classChartBar)
.style('opacity', 0)
.style("pointer-events", "none"); .style("pointer-events", "none");
// Bars for each data // Bars for each data
mainBarEnter.append('g') mainBarEnter.append('g')
@ -41,7 +40,6 @@ c3_chart_internal_fn.updateBar = function (durationForExit) {
$$.mainBar $$.mainBar
.style("opacity", initialOpacity); .style("opacity", initialOpacity);
$$.mainBar.exit().transition().duration(durationForExit) $$.mainBar.exit().transition().duration(durationForExit)
.style('opacity', 0)
.remove(); .remove();
}; };
c3_chart_internal_fn.redrawBar = function (drawBar, withTransition) { c3_chart_internal_fn.redrawBar = function (drawBar, withTransition) {

Loading…
Cancel
Save