Browse Source

show legend for gauges which have more than one arc

pull/1355/head
Gökhan Özen 10 years ago
parent
commit
0866234001
  1. 2
      src/core.js
  2. 4
      src/legend.js

2
src/core.js

@ -221,7 +221,7 @@ c3_chart_internal_fn.initWithData = function (data) {
} }
// when gauge, hide legend // TODO: fix // when gauge, hide legend // TODO: fix
if ($$.hasType('gauge')) { if ($$.hasType('gauge') && $$.config.data_columns.length <= 1) {
config.legend_show = false; config.legend_show = false;
} }

4
src/legend.js

@ -307,7 +307,9 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
tiles = $$.legend.selectAll('line.' + CLASS.legendItemTile) tiles = $$.legend.selectAll('line.' + CLASS.legendItemTile)
.data(targetIds); .data(targetIds);
(withTransition ? tiles.transition() : tiles) (withTransition ? tiles.transition() : tiles)
.style('stroke', $$.color) .style('stroke', $$.levelColor ? function(id) {
return $$.levelColor($$.cache[id].values[0].value);
} : $$.color)
.attr('x1', x1ForLegendTile) .attr('x1', x1ForLegendTile)
.attr('y1', yForLegendTile) .attr('y1', yForLegendTile)
.attr('x2', x2ForLegendTile) .attr('x2', x2ForLegendTile)

Loading…
Cancel
Save