diff --git a/c3.js b/c3.js
index 87c29d5..330e407 100644
--- a/c3.js
+++ b/c3.js
@@ -209,7 +209,7 @@
// text when empty
main.append("text")
- .attr("class", CLASS[_text] + ' ' + CLASS[_empty])
+ .attr("class", CLASS.text + ' ' + CLASS.empty)
.attr("text-anchor", "middle") // horizontal centering of text at x position in all browsers.
.attr("dominant-baseline", "middle"); // vertical centering of text at y position in all browsers, except IE.
@@ -222,7 +222,7 @@
// Define g for chart area
main.append('g')
.attr("clip-path", $$.clipPath)
- .attr('class', CLASS[_chart]);
+ .attr('class', CLASS.chart);
// Cover whole with rects for events
$$.initEventRect();
@@ -242,8 +242,8 @@
// if zoom privileged, insert rect to forefront
// TODO: is this needed?
- main.insert('rect', config.zoom_privileged ? null : 'g.' + CLASS[_regions])
- .attr('class', CLASS[_zoomRect])
+ main.insert('rect', config.zoom_privileged ? null : 'g.' + CLASS.regions)
+ .attr('class', CLASS.zoomRect)
.attr('width', $$.width)
.attr('height', $$.height)
.style('opacity', 0)
@@ -399,7 +399,7 @@
/*-- Show --*/
// Fade-in each chart
- $$.svg.selectAll('.' + CLASS[_target]).filter(function (d) { return $$.isTargetToShow(d.id); })
+ $$.svg.selectAll('.' + CLASS.target).filter(function (d) { return $$.isTargetToShow(d.id); })
.transition().duration(config.transition_duration)
.style("opacity", 1);
};
@@ -475,14 +475,14 @@
break;
}
}
- $$.svg.selectAll('.' + CLASS[_axisX] + ' .tick text').each(function (e) {
+ $$.svg.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) {
var index = tickValues.indexOf(e);
if (index >= 0) {
d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block');
}
});
} else {
- $$.svg.selectAll('.' + CLASS[_axisX] + ' .tick text').style('display', 'block');
+ $$.svg.selectAll('.' + CLASS.axisX + ' .tick text').style('display', 'block');
}
}
@@ -509,7 +509,7 @@
$$.updateXgridFocus();
// Data empty label positioning and text.
- main.select("text." + CLASS[_text] + '.' + CLASS[_empty])
+ main.select("text." + CLASS.text + '.' + CLASS.empty)
.attr("x", $$.width / 2)
.attr("y", $$.height / 2)
.text(config.data_empty_label_text)
@@ -544,7 +544,7 @@
}
// circles for select
- main.selectAll('.' + CLASS[_selectedCircles])
+ main.selectAll('.' + CLASS.selectedCircles)
.filter($$.isBarType.bind($$))
.selectAll('circle')
.remove();
@@ -696,26 +696,26 @@
if (transitions && transitions.axisX) {
xAxis = transitions.axisX;
} else {
- xAxis = $$.main.select('.' + CLASS[_axisX]);
+ xAxis = $$.main.select('.' + CLASS.axisX);
if (withTransition) { xAxis = xAxis.transition(); }
}
if (transitions && transitions.axisY) {
yAxis = transitions.axisY;
} else {
- yAxis = $$.main.select('.' + CLASS[_axisY]);
+ yAxis = $$.main.select('.' + CLASS.axisY);
if (withTransition) { yAxis = yAxis.transition(); }
}
if (transitions && transitions.axisY2) {
y2Axis = transitions.axisY2;
} else {
- y2Axis = $$.main.select('.' + CLASS[_axisY2]);
+ y2Axis = $$.main.select('.' + CLASS.axisY2);
if (withTransition) { y2Axis = y2Axis.transition(); }
}
(withTransition ? $$.main.transition() : $$.main).attr("transform", $$.getTranslate('main'));
xAxis.attr("transform", $$.getTranslate('x'));
yAxis.attr("transform", $$.getTranslate('y'));
y2Axis.attr("transform", $$.getTranslate('y2'));
- $$.main.select('.' + CLASS[_chartArcs]).attr("transform", $$.getTranslate('arc'));
+ $$.main.select('.' + CLASS.chartArcs).attr("transform", $$.getTranslate('arc'));
};
c3_chart_internal_fn.transformAll = function (withTransition, transitions) {
var $$ = this;
@@ -740,7 +740,7 @@
.attr('y', $$.getYAxisClipY.bind($$))
.attr('width', $$.getYAxisClipWidth.bind($$))
.attr('height', $$.getYAxisClipHeight.bind($$));
- $$.svg.select('.' + CLASS[_zoomRect])
+ $$.svg.select('.' + CLASS.zoomRect)
.attr('width', $$.width)
.attr('height', $$.height);
// MEMO: parent div's height will be bigger than svg when
@@ -1935,7 +1935,7 @@
$$.withoutFadeIn[id] = false;
// Remove target's elements
if ($$.legend) {
- $$.legend.selectAll('.' + CLASS[_legendItem] + $$.getTargetSelectorSuffix(id)).remove();
+ $$.legend.selectAll('.' + CLASS.legendItem + $$.getTargetSelectorSuffix(id)).remove();
}
// Remove target
$$.data.targets = $$.data.targets.filter(function (t) {
@@ -1950,27 +1950,27 @@
};
c3_chart_internal_fn.initEventRect = function () {
- var $$ = this, CLASS = $$.CLASS;
- $$.main.select('.' + CLASS[_chart]).append("g")
- .attr("class", CLASS[_eventRects])
+ var $$ = this;
+ $$.main.select('.' + CLASS.chart).append("g")
+ .attr("class", CLASS.eventRects)
.style('fill-opacity', 0);
};
c3_chart_internal_fn.redrawEventRect = function () {
- var $$ = this, config = $$.config, CLASS = $$.CLASS,
+ var $$ = this, config = $$.config,
eventRectUpdate, maxDataCountTarget,
isMultipleX = $$.isMultipleX();
// rects for mouseover
- var eventRects = $$.main.select('.' + CLASS[_eventRects])
+ var eventRects = $$.main.select('.' + CLASS.eventRects)
.style('cursor', config.zoom_enabled ? config.axis_rotated ? 'ns-resize' : 'ew-resize' : null)
- .classed(CLASS[_eventRectsMultiple], isMultipleX)
- .classed(CLASS[_eventRectsSingle], !isMultipleX);
+ .classed(CLASS.eventRectsMultiple, isMultipleX)
+ .classed(CLASS.eventRectsSingle, !isMultipleX);
// clear old rects
- eventRects.selectAll('.' + CLASS[_eventRect]).remove();
+ eventRects.selectAll('.' + CLASS.eventRect).remove();
// open as public variable
- $$.eventRect = eventRects.selectAll('.' + CLASS[_eventRect]);
+ $$.eventRect = eventRects.selectAll('.' + CLASS.eventRect);
if (isMultipleX) {
eventRectUpdate = $$.eventRect.data([0]);
@@ -1984,7 +1984,7 @@
// Set data and update $$.eventRect
maxDataCountTarget = $$.getMaxDataCountTarget($$.data.targets);
eventRects.datum(maxDataCountTarget ? maxDataCountTarget.values : []);
- $$.eventRect = eventRects.selectAll('.' + CLASS[_eventRect]);
+ $$.eventRect = eventRects.selectAll('.' + CLASS.eventRect);
eventRectUpdate = $$.eventRect.data(function (d) { return d; });
// enter
$$.generateEventRectsForSingleX(eventRectUpdate.enter());
@@ -2071,7 +2071,7 @@
$$.expandBars(index);
// Call event handler
- $$.main.selectAll('.' + CLASS[_shape] + '-' + index).each(function (d) {
+ $$.main.selectAll('.' + CLASS.shape + '-' + index).each(function (d) {
config.data_onmouseover.call($$, d);
});
})
@@ -2084,13 +2084,13 @@
$$.unexpandCircles(index);
$$.unexpandBars();
// Call event handler
- $$.main.selectAll('.' + CLASS[_shape] + '-' + index).each(function (d) {
+ $$.main.selectAll('.' + CLASS.shape + '-' + index).each(function (d) {
config.data_onmouseout.call($$, d);
});
})
.on('mousemove', function (d) {
var selectedData, index = d.index,
- eventRect = $$.svg.select('.' + CLASS[_eventRect] + '-' + index);
+ eventRect = $$.svg.select('.' + CLASS.eventRect + '-' + index);
if ($$.dragging) { return; } // do nothing when dragging
if ($$.hasArcType()) { return; }
@@ -2109,9 +2109,9 @@
return;
}
- $$.main.selectAll('.' + CLASS[_shape] + '-' + index)
+ $$.main.selectAll('.' + CLASS.shape + '-' + index)
.each(function () {
- d3.select(this).classed(CLASS[_EXPANDED], true);
+ d3.select(this).classed(CLASS.EXPANDED, true);
if (config.data_selection_enabled) {
eventRect.style('cursor', config.data_selection_grouped ? 'pointer' : null);
}
@@ -2151,7 +2151,7 @@
$$.cancelClick = false;
return;
}
- $$.main.selectAll('.' + CLASS[_shape] + '-' + index).each(function (d) {
+ $$.main.selectAll('.' + CLASS.shape + '-' + index).each(function (d) {
$$.toggleShape(this, d, index);
});
})
@@ -2171,7 +2171,7 @@
.attr('y', 0)
.attr('width', $$.width)
.attr('height', $$.height)
- .attr('class', CLASS[_eventRect])
+ .attr('class', CLASS.eventRect)
.on('mouseout', function () {
if ($$.hasArcType()) { return; }
$$.hideXGridFocus();
@@ -2213,13 +2213,13 @@
// Show cursor as pointer if point is close to mouse position
if ($$.dist(closest, mouse) < 100) {
- $$.svg.select('.' + CLASS[_eventRect]).style('cursor', 'pointer');
+ $$.svg.select('.' + CLASS.eventRect).style('cursor', 'pointer');
if (!$$.mouseover) {
config.data_onmouseover.call($$, closest);
$$.mouseover = true;
}
} else if ($$.mouseover) {
- $$.svg.select('.' + CLASS[_eventRect]).style('cursor', null);
+ $$.svg.select('.' + CLASS.eventRect).style('cursor', null);
config.data_onmouseout.call($$, closest);
$$.mouseover = false;
}
@@ -2237,7 +2237,7 @@
// select if selection enabled
if ($$.dist(closest, mouse) < 100 && $$.toggleShape) {
- $$.main.select('.' + CLASS[_circles] + $$.getTargetSelectorSuffix(closest.id)).select('.' + CLASS[_circle] + '-' + closest.index).each(function () {
+ $$.main.select('.' + CLASS.circles + $$.getTargetSelectorSuffix(closest.id)).select('.' + CLASS.circle + '-' + closest.index).each(function () {
$$.toggleShape(this, closest, closest.index);
});
}
@@ -2312,7 +2312,7 @@
c3_chart_internal_fn.getSvgLeft = function () {
var $$ = this, config = $$.config,
- leftAxisClass = config.axis_rotated ? CLASS[_axisX] : CLASS[_axisY],
+ leftAxisClass = config.axis_rotated ? CLASS.axisX : CLASS.axisY,
leftAxis = $$.main.select('.' + leftAxisClass).node(),
svgRect = leftAxis ? leftAxis.getBoundingClientRect() : {right: 0},
chartRect = $$.selectChart.node().getBoundingClientRect(),
@@ -2408,18 +2408,18 @@
};
c3_chart_internal_fn.initLine = function () {
- var $$ = this, CLASS = $$.CLASS;
- $$.main.select('.' + CLASS[_chart]).append("g")
- .attr("class", CLASS[_chartLines]);
+ var $$ = this;
+ $$.main.select('.' + CLASS.chart).append("g")
+ .attr("class", CLASS.chartLines);
};
c3_chart_internal_fn.updateTargetsForLine = function (targets) {
- var $$ = this, config = $$.config, CLASS = $$.CLASS,
+ var $$ = this, config = $$.config,
mainLineUpdate, mainLineEnter,
classChartLine = $$.classChartLine.bind($$),
classLines = $$.classLines.bind($$),
classAreas = $$.classAreas.bind($$),
classCircles = $$.classCircles.bind($$);
- mainLineUpdate = $$.main.select('.' + CLASS[_chartLines]).selectAll('.' + CLASS[_chartLine])
+ mainLineUpdate = $$.main.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine)
.data(targets)
.attr('class', classChartLine);
mainLineEnter = mainLineUpdate.enter().append('g')
@@ -2434,13 +2434,13 @@
.attr('class', classAreas);
// Circles for each data point on lines
mainLineEnter.append('g')
- .attr("class", function (d) { return $$.generateClass(CLASS[_selectedCircles], d.id); });
+ .attr("class", function (d) { return $$.generateClass(CLASS.selectedCircles, d.id); });
mainLineEnter.append('g')
.attr("class", classCircles)
.style("cursor", function (d) { return config.data_selection_isselectable(d) ? "pointer" : null; });
// Update date for selected circles
targets.forEach(function (t) {
- $$.main.selectAll('.' + CLASS[_selectedCircles] + $$.getTargetSelectorSuffix(t.id)).selectAll('.' + CLASS[_selectedCircle]).each(function (d) {
+ $$.main.selectAll('.' + CLASS.selectedCircles + $$.getTargetSelectorSuffix(t.id)).selectAll('.' + CLASS.selectedCircle).each(function (d) {
d.value = t.values[d.index].value;
});
});
@@ -2448,8 +2448,8 @@
//mainLineUpdate.exit().remove();
};
c3_chart_internal_fn.redrawLine = function (durationForExit) {
- var $$ = this, CLASS = $$.CLASS;
- $$.mainLine = $$.main.selectAll('.' + CLASS[_lines]).selectAll('.' + CLASS[_line])
+ var $$ = this;
+ $$.mainLine = $$.main.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line)
.data($$.lineData.bind($$));
$$.mainLine.enter().append('path')
.attr('class', $$.classLine.bind($$))
@@ -2603,8 +2603,8 @@
c3_chart_internal_fn.redrawArea = function (durationForExit) {
- var $$ = this, CLASS = $$.CLASS, d3 = $$.d3;
- $$.mainArea = $$.main.selectAll('.' + CLASS[_areas]).selectAll('.' + CLASS[_area])
+ var $$ = this, d3 = $$.d3;
+ $$.mainArea = $$.main.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area)
.data($$.lineData.bind($$));
$$.mainArea.enter().append('path')
.attr("class", $$.classArea.bind($$))
@@ -2680,8 +2680,8 @@
c3_chart_internal_fn.redrawCircle = function () {
- var $$ = this, CLASS = $$.CLASS;
- $$.mainCircle = $$.main.selectAll('.' + CLASS[_circles]).selectAll('.' + CLASS[_circle])
+ var $$ = this;
+ $$.mainCircle = $$.main.selectAll('.' + CLASS.circles).selectAll('.' + CLASS.circle)
.data($$.lineOrScatterData.bind($$));
$$.mainCircle.enter().append("circle")
.attr("class", $$.classCircle.bind($$))
@@ -2698,7 +2698,7 @@
.style("fill", $$.color)
.attr("cx", cx)
.attr("cy", cy));
- transitions.push($$.main.selectAll('.' + CLASS[_selectedCircle]).transition()
+ transitions.push($$.main.selectAll('.' + CLASS.selectedCircle).transition()
.attr("cx", cx)
.attr("cy", cy));
};
@@ -2712,21 +2712,21 @@
};
c3_chart_internal_fn.getCircles = function (i, id) {
var $$ = this;
- return (id ? $$.main.selectAll('.' + CLASS[_circles] + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS[_circle] + (isValue(i) ? '-' + i : ''));
+ return (id ? $$.main.selectAll('.' + CLASS.circles + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS.circle + (isValue(i) ? '-' + i : ''));
};
c3_chart_internal_fn.expandCircles = function (i, id) {
var $$ = this,
r = $$.pointExpandedR.bind($$);
$$.getCircles(i, id)
- .classed(CLASS[_EXPANDED], true)
+ .classed(CLASS.EXPANDED, true)
.attr('r', r);
};
c3_chart_internal_fn.unexpandCircles = function (i) {
var $$ = this,
r = $$.pointR.bind($$);
$$.getCircles(i)
- .filter(function () { return $$.d3.select(this).classed(CLASS[_EXPANDED]); })
- .classed(CLASS[_EXPANDED], false)
+ .filter(function () { return $$.d3.select(this).classed(CLASS.EXPANDED); })
+ .classed(CLASS.EXPANDED, false)
.attr('r', r);
};
c3_chart_internal_fn.pointR = function (d) {
@@ -2749,16 +2749,16 @@
};
c3_chart_internal_fn.initBar = function () {
- var $$ = this, CLASS = $$.CLASS;
- $$.main.select('.' + CLASS[_chart]).append("g")
- .attr("class", CLASS[_chartBars]);
+ var $$ = this;
+ $$.main.select('.' + CLASS.chart).append("g")
+ .attr("class", CLASS.chartBars);
};
c3_chart_internal_fn.updateTargetsForBar = function (targets) {
- var $$ = this, config = $$.config, CLASS = $$.CLASS,
+ var $$ = this, config = $$.config,
mainBarUpdate, mainBarEnter,
classChartBar = $$.classChartBar.bind($$),
classBars = $$.classBars.bind($$);
- mainBarUpdate = $$.main.select('.' + CLASS[_chartBars]).selectAll('.' + CLASS[_chartBar])
+ mainBarUpdate = $$.main.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar)
.data(targets)
.attr('class', classChartBar);
mainBarEnter = mainBarUpdate.enter().append('g')
@@ -2772,12 +2772,12 @@
};
c3_chart_internal_fn.redrawBar = function (durationForExit) {
- var $$ = this, CLASS = $$.CLASS,
+ var $$ = this,
barData = $$.barData.bind($$),
classBar = $$.classBar.bind($$),
initialOpacity = $$.initialOpacity.bind($$),
color = function (d) { return $$.color(d.id); };
- $$.mainBar = $$.main.selectAll('.' + CLASS[_bars]).selectAll('.' + CLASS[_bar])
+ $$.mainBar = $$.main.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar)
.data(barData);
$$.mainBar.enter().append('path')
.attr("class", classBar)
@@ -2803,15 +2803,15 @@
};
c3_chart_internal_fn.getBars = function (i) {
var $$ = this;
- return $$.main.selectAll('.' + CLASS[_bar] + (isValue(i) ? '-' + i : ''));
+ return $$.main.selectAll('.' + CLASS.bar + (isValue(i) ? '-' + i : ''));
};
c3_chart_internal_fn.expandBars = function (i) {
var $$ = this;
- $$.getBars(i).classed(CLASS[_EXPANDED], true);
+ $$.getBars(i).classed(CLASS.EXPANDED, true);
};
c3_chart_internal_fn.unexpandBars = function (i) {
var $$ = this;
- $$.getBars(i).classed(CLASS[_EXPANDED], false);
+ $$.getBars(i).classed(CLASS.EXPANDED, false);
};
c3_chart_internal_fn.generateDrawBar = function (barIndices, isSub) {
var $$ = this, config = $$.config,
@@ -2868,16 +2868,16 @@
};
c3_chart_internal_fn.initText = function () {
- var $$ = this, CLASS = $$.CLASS;
- $$.main.select('.' + CLASS[_chart]).append("g")
- .attr("class", CLASS[_chartTexts]);
+ var $$ = this;
+ $$.main.select('.' + CLASS.chart).append("g")
+ .attr("class", CLASS.chartTexts);
$$.mainText = $$.d3.selectAll([]);
};
c3_chart_internal_fn.updateTargetsForText = function (targets) {
- var $$ = this, CLASS = $$.CLASS, mainTextUpdate, mainTextEnter,
+ var $$ = this, mainTextUpdate, mainTextEnter,
classChartText = $$.classChartText.bind($$),
classTexts = $$.classTexts.bind($$);
- mainTextUpdate = $$.main.select('.' + CLASS[_chartTexts]).selectAll('.' + CLASS[_chartText])
+ mainTextUpdate = $$.main.select('.' + CLASS.chartTexts).selectAll('.' + CLASS.chartText)
.data(targets)
.attr('class', classChartText);
mainTextEnter = mainTextUpdate.enter().append('g')
@@ -2888,10 +2888,10 @@
.attr('class', classTexts);
};
c3_chart_internal_fn.redrawText = function (durationForExit) {
- var $$ = this, config = $$.config, CLASS = $$.CLASS,
+ var $$ = this, config = $$.config,
barOrLineData = $$.barOrLineData.bind($$),
classText = $$.classText.bind($$);
- $$.mainText = $$.main.selectAll('.' + CLASS[_texts]).selectAll('.' + CLASS[_text])
+ $$.mainText = $$.main.selectAll('.' + CLASS.texts).selectAll('.' + CLASS.text)
.data(barOrLineData);
$$.mainText.enter().append('text')
.attr("class", classText)
@@ -3039,30 +3039,30 @@
};
c3_chart_internal_fn.initGrid = function () {
- var $$ = this, config = $$.config, CLASS = $$.CLASS, d3 = $$.d3;
+ var $$ = this, config = $$.config, d3 = $$.d3;
$$.grid = $$.main.append('g')
.attr("clip-path", $$.clipPath)
- .attr('class', CLASS[_grid]);
+ .attr('class', CLASS.grid);
if (config.grid_x_show) {
- $$.grid.append("g").attr("class", CLASS[_xgrids]);
+ $$.grid.append("g").attr("class", CLASS.xgrids);
}
if (config.grid_y_show) {
- $$.grid.append('g').attr('class', CLASS[_ygrids]);
+ $$.grid.append('g').attr('class', CLASS.ygrids);
}
- $$.grid.append('g').attr("class", CLASS[_xgridLines]);
- $$.grid.append('g').attr('class', CLASS[_ygridLines]);
+ $$.grid.append('g').attr("class", CLASS.xgridLines);
+ $$.grid.append('g').attr('class', CLASS.ygridLines);
if (config.grid_focus_show) {
$$.grid.append('g')
- .attr("class", CLASS[_xgridFocus])
+ .attr("class", CLASS.xgridFocus)
.append('line')
- .attr('class', CLASS[_xgridFocus]);
+ .attr('class', CLASS.xgridFocus);
}
$$.xgrid = d3.selectAll([]);
$$.xgridLines = d3.selectAll([]);
};
c3_chart_internal_fn.updateXGrid = function (withoutUpdate) {
- var $$ = this, config = $$.config, CLASS = $$.CLASS, d3 = $$.d3,
+ var $$ = this, config = $$.config, d3 = $$.d3,
xgridData = $$.generateGridData(config.grid_x_type, $$.x),
tickOffset = $$.isCategorized() ? $$.xAxis.tickOffset() : 0;
@@ -3078,9 +3078,9 @@
'y2': $$.height
};
- $$.xgrid = $$.main.select('.' + CLASS[_xgrids]).selectAll('.' + CLASS[_xgrid])
+ $$.xgrid = $$.main.select('.' + CLASS.xgrids).selectAll('.' + CLASS.xgrid)
.data(xgridData);
- $$.xgrid.enter().append('line').attr("class", CLASS[_xgrid]);
+ $$.xgrid.enter().append('line').attr("class", CLASS.xgrid);
if (!withoutUpdate) {
$$.xgrid.attr($$.xgridAttr)
.style("opacity", function () { return +d3.select(this).attr(config.axis_rotated ? 'y1' : 'x1') === (config.axis_rotated ? $$.height : 0) ? 0 : 1; });
@@ -3089,11 +3089,11 @@
};
c3_chart_internal_fn.updateYGrid = function () {
- var $$ = this, config = $$.config, CLASS = $$.CLASS;
- $$.ygrid = $$.main.select('.' + CLASS[_ygrids]).selectAll('.' + CLASS[_ygrid])
+ var $$ = this, config = $$.config;
+ $$.ygrid = $$.main.select('.' + CLASS.ygrids).selectAll('.' + CLASS.ygrid)
.data($$.y.ticks(config.grid_y_ticks));
$$.ygrid.enter().append('line')
- .attr('class', CLASS[_ygrid]);
+ .attr('class', CLASS.ygrid);
$$.ygrid.attr("x1", config.axis_rotated ? $$.y : 0)
.attr("x2", config.axis_rotated ? $$.y : $$.width)
.attr("y1", config.axis_rotated ? 0 : $$.y)
@@ -3104,17 +3104,17 @@
c3_chart_internal_fn.redrawGrid = function (duration, withY) {
- var $$ = this, main = $$.main, config = $$.config, CLASS = $$.CLASS,
+ var $$ = this, main = $$.main, config = $$.config,
xgridLine, ygridLine, yv;
- main.select('line.' + CLASS[_xgridFocus]).style("visibility", "hidden");
+ main.select('line.' + CLASS.xgridFocus).style("visibility", "hidden");
if (config.grid_x_show) {
$$.updateXGrid();
}
- $$.xgridLines = main.select('.' + CLASS[_xgridLines]).selectAll('.' + CLASS[_xgridLine])
+ $$.xgridLines = main.select('.' + CLASS.xgridLines).selectAll('.' + CLASS.xgridLine)
.data(config.grid_x_lines);
// enter
xgridLine = $$.xgridLines.enter().append('g')
- .attr("class", function (d) { return CLASS[_xgridLine] + (d.class ? ' ' + d.class : ''); });
+ .attr("class", function (d) { return CLASS.xgridLine + (d.class ? ' ' + d.class : ''); });
xgridLine.append('line')
.style("opacity", 0);
xgridLine.append('text')
@@ -3135,11 +3135,11 @@
$$.updateYGrid();
}
if (withY) {
- $$.ygridLines = main.select('.' + CLASS[_ygridLines]).selectAll('.' + CLASS[_ygridLine])
+ $$.ygridLines = main.select('.' + CLASS.ygridLines).selectAll('.' + CLASS.ygridLine)
.data(config.grid_y_lines);
// enter
ygridLine = $$.ygridLines.enter().append('g')
- .attr("class", function (d) { return CLASS[_ygridLine] + (d.class ? ' ' + d.class : ''); });
+ .attr("class", function (d) { return CLASS.ygridLine + (d.class ? ' ' + d.class : ''); });
ygridLine.append('line')
.style("opacity", 0);
ygridLine.append('text')
@@ -3186,7 +3186,7 @@
c3_chart_internal_fn.showXGridFocus = function (selectedData) {
var $$ = this, config = $$.config,
dataToShow = selectedData.filter(function (d) { return d && isValue(d.value); }),
- focusEl = $$.main.selectAll('line.' + CLASS[_xgridFocus]),
+ focusEl = $$.main.selectAll('line.' + CLASS.xgridFocus),
xx = $$.xx.bind($$);
if (! config.tooltip_show) { return; }
// Hide when scatter plot exists
@@ -3199,11 +3199,11 @@
$$.smoothLines(focusEl, 'grid');
};
c3_chart_internal_fn.hideXGridFocus = function () {
- this.main.select('line.' + CLASS[_xgridFocus]).style("visibility", "hidden");
+ this.main.select('line.' + CLASS.xgridFocus).style("visibility", "hidden");
};
c3_chart_internal_fn.updateXgridFocus = function () {
var $$ = this, config = $$.config;
- $$.main.select('line.' + CLASS[_xgridFocus])
+ $$.main.select('line.' + CLASS.xgridFocus)
.attr("x1", config.axis_rotated ? 0 : -10)
.attr("x2", config.axis_rotated ? $$.width : -10)
.attr("y1", config.axis_rotated ? -10 : 0)
@@ -3212,7 +3212,7 @@
c3_chart_internal_fn.generateGridData = function (type, scale) {
var $$ = this,
gridData = [], xDomain, firstYear, lastYear, i,
- tickNum = $$.main.select("." + CLASS[_axisX]).selectAll('.tick').size();
+ tickNum = $$.main.select("." + CLASS.axisX).selectAll('.tick').size();
if (type === 'year') {
xDomain = $$.getXDomain();
firstYear = xDomain[0].getFullYear();
@@ -3243,8 +3243,8 @@
var $$ = this, config = $$.config,
toRemove = $$.getGridFilterToRemove(params),
toShow = function (line) { return !toRemove(line); },
- classLines = forX ? CLASS[_xgridLines] : CLASS[_ygridLines],
- classLine = forX ? CLASS[_xgridLine] : CLASS.ygridLine;
+ classLines = forX ? CLASS.xgridLines : CLASS.ygridLines,
+ classLine = forX ? CLASS.xgridLine : CLASS.ygridLine;
$$.main.select('.' + classLines).selectAll('.' + classLine).filter(toRemove)
.transition().duration(config.transition_duration)
.style('opacity', 0).remove();
@@ -3292,14 +3292,14 @@
if (! text) {
title = titleFormat ? titleFormat(d[i].x) : d[i].x;
- text = "
"},f.showTooltip=function(a,b){var c,d,e,f,g,h,j,k=this,l=k.config,m=k.hasArcType(),n=a.filter(function(a){return a&&i(a.value)});0!==n.length&&l.tooltip_show&&(k.tooltip.html(l.tooltip_contents.call(k,a,k.getXAxisTickFormat(),k.getYFormat(m),k.color)).style("display","block"),c=k.tooltip.property("offsetWidth"),d=k.tooltip.property("offsetHeight"),m?(f=k.width/2+b[0],h=k.height/2+b[1]+20):(l.axis_rotated?(e=k.getSvgLeft(),f=e+b[0]+100,g=f+c,j=k.getCurrentWidth()-k.getCurrentPaddingRight(),h=k.x(n[0].x)+20):(e=k.getSvgLeft(),f=e+k.getCurrentPaddingLeft()+k.x(n[0].x)+20,g=f+c,j=e+k.getCurrentWidth()-k.getCurrentPaddingRight(),h=b[1]+15),g>j&&(f-=g-j),h+d>k.getCurrentHeight()&&h>d+30&&(h-=d+30)),k.tooltip.style("top",h+"px").style("left",f+"px"))},f.hideTooltip=function(){this.tooltip.style("display","none")},f.initLegend=function(){var a=this;a.legend=a.svg.append("g").attr("transform",a.getTranslate("legend")),a.config.legend_show||(a.legend.style("visibility","hidden"),a.hiddenLegendIds=a.mapToIds(a.data.targets)),a.updateLegend(a.mapToIds(a.data.targets),{withTransform:!1,withTransitionForTransform:!1,withTransition:!1})},f.updateSizeForLegend=function(a,b){var c=this,d=c.config,e={top:c.isLegendTop?c.getCurrentPaddingTop()+d.legend_inset_y+5.5:c.currentHeight-a-c.getCurrentPaddingBottom()-d.legend_inset_y,left:c.isLegendLeft?c.getCurrentPaddingLeft()+d.legend_inset_x+.5:c.currentWidth-b-c.getCurrentPaddingRight()-d.legend_inset_x+.5};c.margin3={top:c.isLegendRight?0:c.isLegendInset?e.top:c.currentHeight-a,right:0/0,bottom:0,left:c.isLegendRight?c.currentWidth-b:c.isLegendInset?e.left:0}},f.transformLegend=function(a){var b=this;(a?b.legend.transition():b.legend).attr("transform",b.getTranslate("legend"))},f.updateLegendStep=function(a){this.legendStep=a},f.updateLegendItemWidth=function(a){this.legendItemWidth=a},f.updateLegendItemHeight=function(a){this.legendItemHeight=a},f.getLegendWidth=function(){var a=this;return a.config.legend_show?a.isLegendRight||a.isLegendInset?a.legendItemWidth*(a.legendStep+1):a.currentWidth:0},f.getLegendHeight=function(){var a=this,b=a.config,c=0;return b.legend_show&&(c=a.isLegendRight?a.currentHeight:a.isLegendInset?b.legend_inset_step?Math.max(20,a.legendItemHeight)*(b.legend_inset_step+1):a.height:Math.max(20,a.legendItemHeight)*(a.legendStep+1)),c},f.opacityForLegend=function(a){var b=this;return a.classed(h.legendItemHidden)?b.legendOpacityForHidden:1},f.opacityForUnfocusedLegend=function(a){var b=this;return a.classed(h.legendItemHidden)?b.legendOpacityForHidden:.3},f.toggleFocusLegend=function(a,b){var c=this;c.legend.selectAll("."+h.legendItem).transition().duration(100).style("opacity",function(d){var e=c.d3.select(this);return a&&d!==a?b?c.opacityForUnfocusedLegend(e):c.opacityForLegend(e):b?c.opacityForLegend(e):c.opacityForUnfocusedLegend(e)})},f.revertLegend=function(){var a=this,b=a.d3;a.legend.selectAll("."+h.legendItem).transition().duration(100).style("opacity",function(){return a.opacityForLegend(b.select(this))})},f.showLegend=function(a){var b=this,c=b.config;c.legend_show||(c.legend_show=!0,b.legend.style("visibility","visible")),b.removeHiddenLegendIds(a),b.legend.selectAll(b.selectorLegends(a)).style("visibility","visible").transition().style("opacity",function(){return b.opacityForLegend(b.d3.select(this))})},f.hideLegend=function(a){var b=this,c=b.config;c.legend_show&&q(a)&&(c.legend_show=!1,b.legend.style("visibility","hidden")),b.addHiddenLegendIds(a),b.legend.selectAll(b.selectorLegends(a)).style("opacity",0).style("visibility","hidden")},f.updateLegend=function(a,b,c){function d(b,c,d){function e(a,b){b||(f=(m-A-l)/2,z>f&&(f=(m-l)/2,A=0,G++)),F[a]=G,E[G]=t.isLegendInset?10:f,B[a]=A,A+=l}var f,g,i=t.getTextRect(b.textContent,h.legendItem),j=10*Math.ceil((i.width+w)/10),k=10*Math.ceil((i.height+v)/10),l=t.isLegendRight||t.isLegendInset?k:j,m=t.isLegendRight||t.isLegendInset?t.getLegendHeight():t.getLegendWidth();return d&&(A=0,G=0,x=0,y=0),u.legend_show&&!t.isLegendToShow(c)?void(C[c]=D[c]=F[c]=B[c]=0):(C[c]=j,D[c]=k,(!x||j>=x)&&(x=j),(!y||k>=y)&&(y=k),g=t.isLegendRight||t.isLegendInset?y:x,void(u.legend_equally?(Object.keys(C).forEach(function(a){C[a]=x}),Object.keys(D).forEach(function(a){D[a]=y}),f=(m-g*a.length)/2,z>f?(A=0,G=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var e,f,g,i,j,k,l,n,o,p,q,r,t=this,u=t.config,v=4,w=36,x=0,y=0,z=10,A=0,B={},C={},D={},E=[0],F={},G=0,H=t.legend.selectAll("."+h.legendItemFocused).size();b=b||{},n=s(b,"withTransition",!0),o=s(b,"withTransitionForTransform",!0),t.isLegendRight?(e=function(a){return x*F[a]},i=function(a){return E[F[a]]+B[a]}):t.isLegendInset?(e=function(a){return x*F[a]+10},i=function(a){return E[F[a]]+B[a]}):(e=function(a){return E[F[a]]+B[a]},i=function(a){return y*F[a]}),f=function(a,b){return e(a,b)+14},j=function(a,b){return i(a,b)+9},g=function(a,b){return e(a,b)-4},k=function(a,b){return i(a,b)-7},l=t.legend.selectAll("."+h.legendItem).data(a).enter().append("g").attr("class",function(a){return t.generateClass(h.legendItem,a)}).style("visibility",function(a){return t.isLegendToShow(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){u.legend_item_onclick?u.legend_item_onclick.call(t,a):t.api.toggle(a)}).on("mouseover",function(a){t.d3.select(this).classed(h.legendItemFocused,!0),t.transiting||t.api.focus(a),u.legend_item_onmouseover&&u.legend_item_onmouseover.call(t,a)}).on("mouseout",function(a){t.d3.select(this).classed(h.legendItemFocused,!1),t.transiting||t.api.revert(),u.legend_item_onmouseout&&u.legend_item_onmouseout.call(t,a)}),l.append("text").text(function(a){return m(u.data_names[a])?u.data_names[a]:a}).each(function(a,b){d(this,a,0===b)}).style("pointer-events","none").attr("x",t.isLegendRight||t.isLegendInset?f:-200).attr("y",t.isLegendRight||t.isLegendInset?-200:j),l.append("rect").attr("class",h.legendItemEvent).style("fill-opacity",0).attr("x",t.isLegendRight||t.isLegendInset?g:-200).attr("y",t.isLegendRight||t.isLegendInset?-200:k),l.append("rect").attr("class",h.legendItemTile).style("pointer-events","none").style("fill",t.color).attr("x",t.isLegendRight||t.isLegendInset?f:-200).attr("y",t.isLegendRight||t.isLegendInset?-200:i).attr("width",10).attr("height",10),t.isLegendInset&&0!==x&&t.legend.insert("g","."+h.legendItem).attr("class",h.legendBackground).append("rect").attr("height",t.getLegendHeight()-10).attr("width",x*(G+1)+10),p=t.legend.selectAll("text").data(a).text(function(a){return m(u.data_names[a])?u.data_names[a]:a}).each(function(a,b){d(this,a,0===b)}),(n?p.transition():p).attr("x",f).attr("y",j),q=t.legend.selectAll("rect."+h.legendItemEvent).data(a),(n?q.transition():q).attr("width",function(a){return C[a]}).attr("height",function(a){return D[a]}).attr("x",g).attr("y",k),r=t.legend.selectAll("rect."+h.legendItemTile).data(a),(n?r.transition():r).style("fill",t.color).attr("x",e).attr("y",i),t.legend.selectAll("."+h.legendItem).classed(h.legendItemHidden,function(a){return!t.isTargetToShow(a)}).transition().style("opacity",function(a){var b=t.d3.select(this);return t.isTargetToShow(a)?!H||b.classed(h.legendItemFocused)?t.opacityForLegend(b):t.opacityForUnfocusedLegend(b):t.legendOpacityForHidden}),t.updateLegendItemWidth(x),t.updateLegendItemHeight(y),t.updateLegendStep(G),t.updateSizes(),t.updateScales(),t.updateSvgSize(),t.transformAll(o,c)},f.initAxis=function(){var a=this,b=a.config,c=a.main;a.axes.x=c.append("g").attr("class",h.axis+" "+h.axisX).attr("clip-path",a.clipPathForXAxis).attr("transform",a.getTranslate("x")).style("visibility",b.axis_x_show?"visible":"hidden"),a.axes.x.append("text").attr("class",h.axisXLabel).attr("transform",b.axis_rotated?"rotate(-90)":"").style("text-anchor",a.textAnchorForXAxisLabel.bind(a)),a.axes.y=c.append("g").attr("class",h.axis+" "+h.axisY).attr("clip-path",a.clipPathForYAxis).attr("transform",a.getTranslate("y")).style("visibility",b.axis_y_show?"visible":"hidden"),a.axes.y.append("text").attr("class",h.axisYLabel).attr("transform",b.axis_rotated?"":"rotate(-90)").style("text-anchor",a.textAnchorForYAxisLabel.bind(a)),a.axes.y2=c.append("g").attr("class",h.axis+" "+h.axisY2).attr("transform",a.getTranslate("y2")).style("visibility",b.axis_y2_show?"visible":"hidden"),a.axes.y2.append("text").attr("class",h.axisY2Label).attr("transform",b.axis_rotated?"":"rotate(-90)").style("text-anchor",a.textAnchorForY2AxisLabel.bind(a))},f.getXAxis=function(a,b,c,e){var f=this,g=f.config,h=d(f.d3,f.isCategorized()).scale(a).orient(b);return h.tickFormat(c).tickValues(e),f.isCategorized()?(h.tickCentered(g.axis_x_tick_centered),q(g.axis_x_tick_culling)&&(g.axis_x_tick_culling=!1)):h.tickOffset=function(){var a=f.getEdgeX(f.data.targets),b=f.x(a[1])-f.x(a[0]),c=b?b:g.axis_rotated?f.height:f.width;return c/f.getMaxDataCount()/2},h},f.getYAxis=function(a,b,c,e){return d(this.d3).scale(a).orient(b).tickFormat(c).ticks(e)},f.getAxisId=function(a){var b=this.config;return a in b.data_axes?b.data_axes[a]:"y"},f.getXAxisTickFormat=function(){var a=this,b=a.config,c=a.isTimeSeries()?a.defaultAxisTimeFormat:a.isCategorized()?a.categoryName:function(a){return 0>a?a.toFixed(0):a};return b.axis_x_tick_format&&(j(b.axis_x_tick_format)?c=b.axis_x_tick_format:a.isTimeSeries()&&(c=function(c){return c?a.axisTimeFormat(b.axis_x_tick_format)(c):""})),j(c)?function(b){return c.call(a,b)}:c},f.getAxisLabelOptionByAxisId=function(a){var b,c=this,d=c.config;return"y"===a?b=d.axis_y_label:"y2"===a?b=d.axis_y2_label:"x"===a&&(b=d.axis_x_label),b},f.getAxisLabelText=function(a){var b=this.getAxisLabelOptionByAxisId(a);return k(b)?b:b?b.text:null},f.setAxisLabelText=function(a,b){var c=this,d=c.config,e=c.getAxisLabelOptionByAxisId(a);k(e)?"y"===a?d.axis_y_label=b:"y2"===a?d.axis_y2_label=b:"x"===a&&(d.axis_x_label=b):e&&(e.text=b)},f.getAxisLabelPosition=function(a,b){var c=this.getAxisLabelOptionByAxisId(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}},f.getXAxisLabelPosition=function(){return this.getAxisLabelPosition("x",this.config.axis_rotated?"inner-top":"inner-right")},f.getYAxisLabelPosition=function(){return this.getAxisLabelPosition("y",this.config.axis_rotated?"inner-right":"inner-top")},f.getY2AxisLabelPosition=function(){return this.getAxisLabelPosition("y2",this.config.axis_rotated?"inner-right":"inner-top")},f.getAxisLabelPositionById=function(a){return"y2"===a?this.getY2AxisLabelPosition():"y"===a?this.getYAxisLabelPosition():this.getXAxisLabelPosition()},f.textForXAxisLabel=function(){return this.getAxisLabelText("x")},f.textForYAxisLabel=function(){return this.getAxisLabelText("y")},f.textForY2AxisLabel=function(){return this.getAxisLabelText("y2")},f.xForAxisLabel=function(a,b){var c=this;return a?b.isLeft?0:b.isCenter?c.width/2:c.width:b.isBottom?-c.height:b.isMiddle?-c.height/2:0},f.dxForAxisLabel=function(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"},f.textAnchorForAxisLabel=function(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"},f.xForXAxisLabel=function(){return this.xForAxisLabel(!this.config.axis_rotated,this.getXAxisLabelPosition())},f.xForYAxisLabel=function(){return this.xForAxisLabel(this.config.axis_rotated,this.getYAxisLabelPosition())},f.xForY2AxisLabel=function(){return this.xForAxisLabel(this.config.axis_rotated,this.getY2AxisLabelPosition())},f.dxForXAxisLabel=function(){return this.dxForAxisLabel(!this.config.axis_rotated,this.getXAxisLabelPosition())},f.dxForYAxisLabel=function(){return this.dxForAxisLabel(this.config.axis_rotated,this.getYAxisLabelPosition())},f.dxForY2AxisLabel=function(){return this.dxForAxisLabel(this.config.axis_rotated,this.getY2AxisLabelPosition())},f.dyForXAxisLabel=function(){var a=this,b=a.config,c=a.getXAxisLabelPosition();return b.axis_rotated?c.isInner?"1.2em":-25-a.getMaxTickWidth("x"):c.isInner?"-0.5em":b.axis_x_height?b.axis_x_height-10:"3em"},f.dyForYAxisLabel=function(){var a=this,b=a.getYAxisLabelPosition();return a.config.axis_rotated?b.isInner?"-0.5em":"3em":b.isInner?"1.2em":-20-a.getMaxTickWidth("y")},f.dyForY2AxisLabel=function(){var a=this,b=a.getY2AxisLabelPosition();return a.config.axis_rotated?b.isInner?"1.2em":"-2.2em":b.isInner?"-0.5em":30+this.getMaxTickWidth("y2")},f.textAnchorForXAxisLabel=function(){var a=this;return a.textAnchorForAxisLabel(!a.config.axis_rotated,a.getXAxisLabelPosition())},f.textAnchorForYAxisLabel=function(){var a=this;return a.textAnchorForAxisLabel(a.config.axis_rotated,a.getYAxisLabelPosition())},f.textAnchorForY2AxisLabel=function(){var a=this;return a.textAnchorForAxisLabel(a.config.axis_rotated,a.getY2AxisLabelPosition())},f.xForRotatedTickText=function(a){return 10*Math.sin(Math.PI*(a/180))},f.yForRotatedTickText=function(a){return 11.5-2.5*(a/15)},f.rotateTickText=function(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",this.yForRotatedTickText(c)).attr("x",this.xForRotatedTickText(c)).attr("transform","rotate("+c+")")},f.getMaxTickWidth=function(a){var b,c,d,e=this,f=e.config,g=0;return e.svg&&(b=e.filterTargetsToShow(e.data.targets),"y"===a?(c=e.y.copy().domain(e.getYDomain(b,"y")),d=e.getYAxis(c,e.yOrient,f.axis_y_tick_format,f.axis_y_ticks)):"y2"===a?(c=e.y2.copy().domain(e.getYDomain(b,"y2")),d=e.getYAxis(c,e.y2Orient,f.axis_y2_tick_format,f.axis_y2_ticks)):(c=e.x.copy().domain(e.getXDomain(b)),d=e.getXAxis(c,e.xOrient,e.getXAxisTickFormat(),f.axis_x_tick_values?f.axis_x_tick_values:e.xAxis.tickValues())),e.main.append("g").call(d).each(function(){e.d3.select(this).selectAll("text").each(function(){var a=this.getBoundingClientRect();g=g?e.currentMaxTickWidth:g,e.currentMaxTickWidth},f.updateAxisLabels=function(a){var b=this,c=b.main.select("."+h.axisX+" ."+h.axisXLabel),d=b.main.select("."+h.axisY+" ."+h.axisYLabel),e=b.main.select("."+h.axisY2+" ."+h.axisY2Label);(a?c.transition():c).attr("x",b.xForXAxisLabel.bind(b)).attr("dx",b.dxForXAxisLabel.bind(b)).attr("dy",b.dyForXAxisLabel.bind(b)).text(b.textForXAxisLabel.bind(b)),(a?d.transition():d).attr("x",b.xForYAxisLabel.bind(b)).attr("dx",b.dxForYAxisLabel.bind(b)).attr("dy",b.dyForYAxisLabel.bind(b)).text(b.textForYAxisLabel.bind(b)),(a?e.transition():e).attr("x",b.xForY2AxisLabel.bind(b)).attr("dx",b.dxForY2AxisLabel.bind(b)).attr("dy",b.dyForY2AxisLabel.bind(b)).text(b.textForY2AxisLabel.bind(b))},f.getAxisPadding=function(a,b,c,d){var e="ratio"===a.unit?d:1;return i(a[b])?a[b]*e:c},f.generateTickValues=function(a,b){var c,d,e,f,g,h,i,k=this,l=a;if(b)if(c=j(b)?b():b,1===c)l=[a[0]];else if(2===c)l=[a[0],a[a.length-1]];else if(c>2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),l=[d],h=0;f>h;h++)i=+d+g*(h+1),l.push(k.isTimeSeries()?new Date(i):i);l.push(e)}return k.isTimeSeries()||(l=l.sort(function(a,b){return a-b})),l},f.generateAxisTransitions=function(a){var b=this,c=b.axes;return{axisX:a?c.x.transition().duration(a):c.x,axisY:a?c.y.transition().duration(a):c.y,axisY2:a?c.y2.transition().duration(a):c.y2,axisSubX:a?c.subx.transition().duration(a):c.subx}},f.redrawAxis=function(a,b){var c=this;c.axes.x.style("opacity",b?0:1),c.axes.y.style("opacity",b?0:1),c.axes.y2.style("opacity",b?0:1),c.axes.subx.style("opacity",b?0:1),a.axisX.call(c.xAxis),a.axisY.call(c.yAxis),a.axisY2.call(c.y2Axis),a.axisSubX.call(c.subXAxis)},f.getClipPath=function(b){var c=a.navigator.appVersion.toLowerCase().indexOf("msie 9.")>=0;return"url("+(c?"":document.URL.split("#")[0])+"#"+b+")"},f.getAxisClipX=function(a){return a?-31:-(this.margin.left-1)},f.getAxisClipY=function(a){return a?-20:-4},f.getXAxisClipX=function(){var a=this;return a.getAxisClipX(!a.config.axis_rotated)},f.getXAxisClipY=function(){var a=this;return a.getAxisClipY(!a.config.axis_rotated)},f.getYAxisClipX=function(){var a=this;return a.getAxisClipX(a.config.axis_rotated)},f.getYAxisClipY=function(){var a=this;return a.getAxisClipY(a.config.axis_rotated)},f.getAxisClipWidth=function(a){var b=this;return a?b.width+2+30+30:b.margin.left+20},f.getAxisClipHeight=function(a){var b=this,c=b.config;return a?(c.axis_x_height?c.axis_x_height:0)+80:b.height+8},f.getXAxisClipWidth=function(){var a=this;return a.getAxisClipWidth(!a.config.axis_rotated)},f.getXAxisClipHeight=function(){var a=this;return a.getAxisClipHeight(!a.config.axis_rotated)},f.getYAxisClipWidth=function(){var a=this;return a.getAxisClipWidth(a.config.axis_rotated)},f.getYAxisClipHeight=function(){var a=this;return a.getAxisClipHeight(a.config.axis_rotated)},f.initPie=function(){var a=this,b=a.d3,c=a.config;a.pie=b.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)}),c.data_order&&c.pie_sort&&c.donut_sort||a.pie.sort(null)},f.updateRadius=function(){var a=this,b=a.config,c=b.gauge_width||b.donut_width;a.radiusExpanded=Math.min(a.arcWidth,a.arcHeight)/2,a.radius=.95*a.radiusExpanded,a.innerRadiusRatio=c?(a.radius-c)/a.radius:.6,a.innerRadius=a.hasType("donut")||a.hasType("gauge")?a.radius*a.innerRadiusRatio:0},f.updateArc=function(){var a=this;a.svgArc=a.getSvgArc(),a.svgArcExpanded=a.getSvgArcExpanded(),a.svgArcExpandedSub=a.getSvgArcExpanded(.98)},f.updateAngle=function(a){var b=this,c=b.config,d=!1,e=0;if(b.pie(b.filterTargetsToShow(b.data.targets)).sort(b.descByStartAngle).forEach(function(b){d||b.data.id!==a.data.id||(d=!0,a=b,a.index=e),e++}),isNaN(a.endAngle)&&(a.endAngle=a.startAngle),b.isGaugeType(a.data)){var f=c.gauge_min,g=c.gauge_max,h=Math.abs(f)+g,i=Math.PI/h;a.startAngle=-1*(Math.PI/2)+i*Math.abs(f),a.endAngle=a.startAngle+i*(a.value>g?g:a.value)}return d?a:null},f.getSvgArc=function(){var a=this,b=a.d3.svg.arc().outerRadius(a.radius).innerRadius(a.innerRadius),c=function(c,d){var e;return d?b(c):(e=a.updateAngle(c),e?b(e):"M 0 0")};return c.centroid=b.centroid,c},f.getSvgArcExpanded=function(a){var b=this,c=b.d3.svg.arc().outerRadius(b.radiusExpanded*(a?a:1)).innerRadius(b.innerRadius);return function(a){var d=b.updateAngle(a);return d?c(d):"M 0 0"}},f.getArc=function(a,b,c){return c||this.isArcType(a.data)?this.svgArc(a,b):"M 0 0"},f.transformForArcLabel=function(a){var b,c,d,e,f,g=this,h=g.updateAngle(a),i="";return h&&!g.hasType("gauge")&&(b=this.svgArc.centroid(h),c=isNaN(b[0])?0:b[0],d=isNaN(b[1])?0:b[1],e=Math.sqrt(c*c+d*d),f=g.radius&&e?(36/g.radius>.375?1.175-36/g.radius:.8)*g.radius/e:0,i="translate("+c*f+","+d*f+")"),i},f.getArcRatio=function(a){var b=this,c=b.hasType("gauge")?Math.PI:2*Math.PI;return a?(a.endAngle-a.startAngle)/c:null},f.convertToArcData=function(a){return this.addName({id:a.data.id,value:a.value,ratio:this.getArcRatio(a),index:a.index})},f.textForArcLabel=function(a){var b,c,d,e,f=this;return f.shouldShowArcLabel()?(b=f.updateAngle(a),c=b?b.value:null,d=f.getArcRatio(b),f.hasType("gauge")||f.meetsArcLabelThreshold(d)?(e=f.getArcLabelFormat(),e?e(c,d):f.defaultArcValueFormat(c,d)):""):""},f.expandArc=function(a,b){var c=this,d=c.svg.selectAll("."+h.chartArc+c.selectorTarget(a)),e=c.svg.selectAll("."+h.arc).filter(function(b){return b.data.id!==a});c.shouldExpand(a)&&d.selectAll("path").transition().duration(50).attr("d",c.svgArcExpanded).transition().duration(100).attr("d",c.svgArcExpandedSub).each(function(a){c.isDonutType(a.data)}),b||e.style("opacity",.3)},f.unexpandArc=function(a){var b=this,c=b.svg.selectAll("."+h.chartArc+b.selectorTarget(a));c.selectAll("path."+h.arc).transition().duration(50).attr("d",b.svgArc),b.svg.selectAll("."+h.arc).style("opacity",1)},f.shouldExpand=function(a){var b=this,c=b.config;return b.isDonutType(a)&&c.donut_expand||b.isGaugeType(a)&&c.gauge_expand||b.isPieType(a)&&c.pie_expand},f.shouldShowArcLabel=function(){var a=this,b=a.config,c=!0;return a.hasType("donut")?c=b.donut_label_show:a.hasType("pie")&&(c=b.pie_label_show),c},f.meetsArcLabelThreshold=function(a){var b=this,c=b.config,d=b.hasType("donut")?c.donut_label_threshold:c.pie_label_threshold;return a>=d},f.getArcLabelFormat=function(){var a=this,b=a.config,c=b.pie_label_format;return a.hasType("gauge")?c=b.gauge_label_format:a.hasType("donut")&&(c=b.donut_label_format),c},f.getArcTitle=function(){var a=this;return a.hasType("donut")?a.config.donut_title:""},f.descByStartAngle=function(a,b){return a.startAngle-b.startAngle},f.updateTargetsForArc=function(a){var b,c,d=this,e=d.main,f=d.classChartArc.bind(d),g=d.classArcs.bind(d);b=e.select("."+h.chartArcs).selectAll("."+h.chartArc).data(d.pie(a)).attr("class",f),c=b.enter().append("g").attr("class",f),c.append("g").attr("class",g),c.append("text").attr("dy",d.hasType("gauge")?"-0.35em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none")},f.initArc=function(){var a=this;a.arcs=a.main.select("."+h.chart).append("g").attr("class",h.chartArcs).attr("transform",a.getTranslate("arc")),a.arcs.append("text").attr("class",h.chartArcsTitle).style("text-anchor","middle").text(a.getArcTitle())},f.redrawArc=function(a,b,c){var d,e=this,f=e.d3,g=e.config,i=e.main;d=i.selectAll("."+h.arcs).selectAll("."+h.arc).data(e.arcData.bind(e)),d.enter().append("path").attr("class",e.classArc.bind(e)).style("fill",function(a){return e.color(a.data)}).style("cursor",function(a){return g.data_selection_isselectable(a)?"pointer":null}).style("opacity",0).each(function(a){e.isGaugeType(a.data)&&(a.startAngle=a.endAngle=-1*(Math.PI/2)),this._current=a}).on("mouseover",function(a){var b,c;e.transiting||(b=e.updateAngle(a),c=e.convertToArcData(b),e.expandArc(b.data.id),e.toggleFocusLegend(b.data.id,!0),e.config.data_onmouseover(c,this))}).on("mousemove",function(a){var b=e.updateAngle(a),c=e.convertToArcData(b),d=[c];e.showTooltip(d,f.mouse(this))}).on("mouseout",function(a){var b,c;e.transiting||(b=e.updateAngle(a),c=e.convertToArcData(b),e.unexpandArc(b.data.id),e.revertLegend(),e.hideTooltip(),e.config.data_onmouseout(c,this))}).on("click",function(a,b){var c,d;e.toggleShape&&(c=e.updateAngle(a),d=e.convertToArcData(c),e.toggleShape(this,d,b))}),d.attr("transform",function(a){return!e.isGaugeType(a.data)&&c?"scale(0)":""}).style("opacity",function(a){return a===this._current?0:1}).each(function(){e.transiting=!0}).transition().duration(a).attrTween("d",function(a){var b,c=e.updateAngle(a);return c?(isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle),b=f.interpolate(this._current,c),this._current=b(0),function(a){return e.getArc(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",c?"scale(1)":"").style("fill",function(a){return e.levelColor?e.levelColor(a.data.values[0].value):e.color(a.data.id)}).style("opacity",1).call(e.endall,function(){e.transiting=!1}),d.exit().transition().duration(b).style("opacity",0).remove(),i.selectAll("."+h.chartArc).select("text").style("opacity",0).attr("class",function(a){return e.isGaugeType(a.data)?h.gaugeValue:""}).text(e.textForArcLabel.bind(e)).attr("transform",e.transformForArcLabel.bind(e)).transition().duration(a).style("opacity",function(a){return e.isTargetToShow(a.data.id)&&e.isArcType(a.data)?1:0}),i.select("."+h.chartArcsTitle).style("opacity",e.hasType("donut")||e.hasType("gauge")?1:0)},f.initGauge=function(){var a=this,b=a.config,c=a.arcs;a.hasType("gauge")&&(c.append("path").attr("class",h.chartArcsBackground).attr("d",function(){var c={data:[{value:b.gauge_max}],startAngle:-1*(Math.PI/2),endAngle:Math.PI/2};return a.getArc(c,!0,!0)}),c.append("text").attr("dy",".75em").attr("class",h.chartArcsGaugeUnit).style("text-anchor","middle").style("pointer-events","none").text(b.gauge_label_show?b.gauge_units:""),c.append("text").attr("dx",-1*(a.innerRadius+(a.radius-a.innerRadius)/2)+"px").attr("dy","1.2em").attr("class",h.chartArcsGaugeMin).style("text-anchor","middle").style("pointer-events","none").text(b.gauge_label_show?b.gauge_min:""),c.append("text").attr("dx",a.innerRadius+(a.radius-a.innerRadius)/2+"px").attr("dy","1.2em").attr("class",h.chartArcsGaugeMax).style("text-anchor","middle").style("pointer-events","none").text(b.gauge_label_show?b.gauge_max:""))},f.initRegion=function(){var a=this;a.main.append("g").attr("clip-path",a.clipPath).attr("class",h.regions)},f.redrawRegion=function(a){var b=this,c=b.config;b.mainRegion=b.main.select("."+h.regions).selectAll("."+h.region).data(c.regions),b.mainRegion.enter().append("g").attr("class",b.classRegion.bind(b)).append("rect").style("fill-opacity",0),b.mainRegion.exit().transition().duration(a).style("opacity",0).remove()},f.addTransitionForRegion=function(a){var b=this,c=b.regionX.bind(b),d=b.regionY.bind(b),e=b.regionWidth.bind(b),f=b.regionHeight.bind(b);a.push(b.mainRegion.selectAll("rect").transition().attr("x",c).attr("y",d).attr("width",e).attr("height",f).style("fill-opacity",function(a){return i(a.opacity)?a.opacity:.1}))},f.regionX=function(a){var b,c=this,d=c.config,e="y"===a.axis?c.y:c.y2;return b="y"===a.axis||"y2"===a.axis?d.axis_rotated?"start"in a?e(a.start):0:0:d.axis_rotated?0:"start"in a?c.x(c.isTimeSeries()?c.parseDate(a.start):a.start):0},f.regionY=function(a){var b,c=this,d=c.config,e="y"===a.axis?c.y:c.y2;return b="y"===a.axis||"y2"===a.axis?d.axis_rotated?0:"end"in a?e(a.end):0:d.axis_rotated?"start"in a?c.x(c.isTimeSeries()?c.parseDate(a.start):a.start):0:0},f.regionWidth=function(a){var b,c=this,d=c.config,e=c.regionX(a),f="y"===a.axis?c.y:c.y2;return b="y"===a.axis||"y2"===a.axis?d.axis_rotated?"end"in a?f(a.end):c.width:c.width:d.axis_rotated?c.width:"end"in a?c.x(c.isTimeSeries()?c.parseDate(a.end):a.end):c.width,e>b?0:b-e},f.regionHeight=function(a){var b,c=this,d=c.config,e=this.regionY(a),f="y"===a.axis?c.y:c.y2;return b="y"===a.axis||"y2"===a.axis?d.axis_rotated?c.height:"start"in a?f(a.start):c.height:d.axis_rotated?"end"in a?c.x(c.isTimeSeries()?c.parseDate(a.end):a.end):c.height:c.height,e>b?0:b-e},f.isRegionOnX=function(a){return!a.axis||"x"===a.axis},f.drag=function(a){var b,c,d,e,f,g,i,j,k=this,l=k.config,m=k.main,n=k.d3;k.hasArcType()||l.data_selection_enabled&&(!l.zoom_enabled||k.zoom.altDomain)&&l.data_selection_multiple&&(b=k.dragStart[0],c=k.dragStart[1],d=a[0],e=a[1],f=Math.min(b,d),g=Math.max(b,d),i=l.data_selection_grouped?k.margin.top:Math.min(c,e),j=l.data_selection_grouped?k.height:Math.max(c,e),m.select("."+h.dragarea).attr("x",f).attr("y",i).attr("width",g-f).attr("height",j-i),m.selectAll("."+h.shapes).selectAll("."+h.shape).filter(function(a){return l.data_selection_isselectable(a)}).each(function(a,b){var c,d,e,l,m,o,p=n.select(this),q=p.classed(h.SELECTED),r=p.classed(h.INCLUDED),s=!1;if(p.classed(h.circle))c=1*p.attr("cx"),d=1*p.attr("cy"),m=k.togglePoint,s=c>f&&g>c&&d>i&&j>d;else{if(!p.classed(h.bar))return;o=u(this),c=o.x,d=o.y,e=o.width,l=o.height,m=k.toggleBar,s=!(c>g||f>c+e||d>j||i>d+l)}s^r&&(p.classed(h.INCLUDED,!r),p.classed(h.SELECTED,!q),m.call(k,!q,p,a,b))}))},f.dragstart=function(a){var b=this,c=b.config;b.hasArcType()||c.data_selection_enabled&&(b.dragStart=a,b.main.select("."+h.chart).append("rect").attr("class",h.dragarea).style("opacity",.1),b.dragging=!0,b.config.data_ondragstart())},f.dragend=function(){var a=this,b=a.config;a.hasArcType()||b.data_selection_enabled&&(a.main.select("."+h.dragarea).transition().duration(100).style("opacity",0).remove(),a.main.selectAll("."+h.shape).classed(h.INCLUDED,!1),a.dragging=!1,a.config.data_ondragend())},f.selectPoint=function(a,b,c){var d=this,e=d.config,f=(e.axis_rotated?d.circleY:d.circleX).bind(d),g=(e.axis_rotated?d.circleX:d.circleY).bind(d),i=d.pointSelectR.bind(d);e.data_onselected.call(d.api,b,a.node()),d.main.select("."+h.selectedCircles+d.getTargetSelectorSuffix(b.id)).selectAll("."+h.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return d.generateClass(h.selectedCircle,c)}).attr("cx",f).attr("cy",g).attr("stroke",function(){return d.color(b)}).attr("r",function(a){return 1.4*d.pointSelectR(a)}).transition().duration(100).attr("r",i)},f.unselectPoint=function(a,b,c){var d=this;d.config.data_onunselected(b,a.node()),d.main.select("."+h.selectedCircles+d.getTargetSelectorSuffix(b.id)).selectAll("."+h.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()},f.togglePoint=function(a,b,c,d){a?this.selectPoint(b,c,d):this.unselectPoint(b,c,d)},f.selectBar=function(a,b){var c=this;c.config.data_onselected.call(c,b,a.node()),a.transition().duration(100).style("fill",function(){return c.d3.rgb(c.color(b)).brighter(.75)})},f.unselectBar=function(a,b){var c=this;c.config.data_onunselected.call(c,b,a.node()),a.transition().duration(100).style("fill",function(){return c.color(b)})},f.toggleBar=function(a,b,c,d){a?this.selectBar(b,c,d):this.unselectBar(b,c,d)},f.toggleArc=function(a,b,c,d){this.toggleBar(a,b,c.data,d)},f.getToggle=function(a){var b=this;return"circle"===a.nodeName?b.togglePoint:b.d3.select(a).classed(h.bar)?b.toggleBar:b.toggleArc},f.toggleShape=function(a,b,c){var d,e,f=this,g=f.d3,i=f.config,j=g.select(a),k=j.classed(h.SELECTED);"circle"===a.nodeName?(d=f.isWithinCircle(a,1.5*f.pointSelectR(b)),e=f.togglePoint):"path"===a.nodeName&&(j.classed(h.bar)?(d=f.isWithinBar(a),e=f.toggleBar):(d=!0,e=f.toggleArc)),(i.data_selection_grouped||d)&&(i.data_selection_enabled&&i.data_selection_isselectable(b)&&(i.data_selection_multiple||f.main.selectAll("."+h.shapes+(i.data_selection_grouped?f.getTargetSelectorSuffix(b.id):"")).selectAll("."+h.shape).each(function(a,b){var c=g.select(this);c.classed(h.SELECTED)&&e.call(f,!1,c.classed(h.SELECTED,!1),a,b)}),j.classed(h.SELECTED,!k),e.call(f,!k,j,b,c)),f.config.data_onclick.call(f.api,b,a))},f.initBrush=function(){var a=this,b=a.d3;a.brush=b.svg.brush().on("brush",function(){a.redrawForBrush()}),a.brush.update=function(){return a.context&&a.context.select("."+h.brush).call(this),this
+},a.brush.scale=function(b){return a.config.axis_rotated?this.y(b):this.x(b)}},f.initSubchart=function(){var a=this,b=a.config,c=a.context=a.svg.append("g").attr("transform",a.getTranslate("context"));b.subchart_show||c.style("visibility","hidden"),c.append("g").attr("clip-path",a.clipPath).attr("class",h.chart),c.select("."+h.chart).append("g").attr("class",h.chartBars),c.select("."+h.chart).append("g").attr("class",h.chartLines),c.append("g").attr("clip-path",a.clipPath).attr("class",h.brush).call(a.brush).selectAll("rect").attr(b.axis_rotated?"width":"height",b.axis_rotated?a.width2:a.height2),a.axes.subx=c.append("g").attr("class",h.axisX).attr("transform",a.getTranslate("subx")).attr("clip-path",b.axis_rotated?"":a.clipPathForXAxis)},f.updateTargetsForSubchart=function(a){var b,c,d,e,f=this,g=f.context,i=f.config,j=f.classChartBar.bind(f),k=f.classBars.bind(f),l=f.classChartLine.bind(f),m=f.classLines.bind(f),n=f.classAreas.bind(f);i.subchart_show&&(e=g.select("."+h.chartBars).selectAll("."+h.chartBar).data(a).attr("class",j),d=e.enter().append("g").style("opacity",0).attr("class",j),d.append("g").attr("class",k),c=g.select("."+h.chartLines).selectAll("."+h.chartLine).data(a).attr("class",l),b=c.enter().append("g").style("opacity",0).attr("class",l),b.append("g").attr("class",m),b.append("g").attr("class",n))},f.redrawSubchart=function(a,b,c,d,e,f,g){var i,j,k,l,m,n,o=this,p=o.d3,q=o.context,r=o.config,s=o.barData.bind(o),t=o.lineData.bind(o),u=o.classBar.bind(o),v=o.classLine.bind(o),w=o.classArea.bind(o),x=o.initialOpacity.bind(o);r.subchart_show&&(p.event&&"zoom"===p.event.type&&o.brush.extent(o.x.orgDomain()).update(),a&&(!r.axis_rotated&&r.axis_x_tick_rotate&&o.rotateTickText(o.axes.subx,b.axisSubX,r.axis_x_tick_rotate),o.brush.empty()||o.brush.extent(o.x.orgDomain()).update(),l=o.generateDrawArea(e,!0),m=o.generateDrawBar(f,!0),n=o.generateDrawLine(g,!0),k=q.selectAll("."+h.bars).selectAll("."+h.bar).data(s),k.enter().append("path").attr("class",u).style("stroke","none").style("fill",o.color),k.style("opacity",x).transition().duration(c).attr("d",m).style("opacity",1),k.exit().transition().duration(c).style("opacity",0).remove(),i=q.selectAll("."+h.lines).selectAll("."+h.line).data(t),i.enter().append("path").attr("class",v).style("stroke",o.color),i.style("opacity",x).transition().duration(c).attr("d",n).style("opacity",1),i.exit().transition().duration(c).style("opacity",0).remove(),j=q.selectAll("."+h.areas).selectAll("."+h.area).data(t),j.enter().append("path").attr("class",w).style("fill",o.color).style("opacity",function(){return o.orgAreaOpacity=+p.select(this).style("opacity"),0}),j.style("opacity",0).transition().duration(c).attr("d",l).style("fill",o.color).style("opacity",o.orgAreaOpacity),j.exit().transition().duration(d).style("opacity",0).remove()))},f.redrawForBrush=function(){var a=this,b=a.x;a.redraw({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0}),a.config.subchart_onbrush.call(a.api,b.orgDomain())},f.transformContext=function(a,b){var c,d=this;b&&b.axisSubX?c=b.axisSubX:(c=d.context.select("."+h.axisX),a&&(c=c.transition())),d.context.attr("transform",d.getTranslate("context")),c.attr("transform",d.getTranslate("subx"))},f.initZoom=function(){var a=this,b=a.d3,c=a.config;a.zoom=b.behavior.zoom().on("zoomstart",function(){a.zoom.altDomain=b.event.sourceEvent.altKey?a.x.orgDomain():null}).on("zoom",function(){a.redrawForZoom.call(a)}),a.zoom.scale=function(a){return c.axis_rotated?this.y(a):this.x(a)},a.zoom.orgScaleExtent=function(){var b=c.zoom_extent?c.zoom_extent:[1,10];return[b[0],Math.max(a.getMaxDataCount()/b[1],b[1])]},a.zoom.updateScaleExtent=function(){var b=p(a.x.orgDomain())/p(a.orgXDomain),c=this.orgScaleExtent();return this.scaleExtent([c[0]*b,c[1]*b]),this}},f.updateZoom=function(){var a=this,b=a.config.zoom_enabled?a.zoom:function(){};a.main.select("."+h.zoomRect).call(b),a.main.selectAll("."+h.eventRect).call(b)},f.redrawForZoom=function(){var a=this,b=a.d3,c=a.config,d=a.zoom,e=a.x,f=a.orgXDomain;if(c.zoom_enabled&&0!==a.filterTargetsToShow(a.data.targets).length){if("mousemove"===b.event.sourceEvent.type&&d.altDomain)return e.domain(d.altDomain),void d.scale(e).updateScaleExtent();a.isCategorized()&&e.orgDomain()[0]===f[0]&&e.domain([f[0]-1e-10,e.orgDomain()[1]]),a.redraw({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===b.event.sourceEvent.type&&(a.cancelClick=!0),c.zoom_onzoom.call(a.api,e.orgDomain())}},f.generateColor=function(){var a=this,b=a.config,c=a.d3,d=b.data_colors,e=r(b.color_pattern)?b.color_pattern:c.scale.category10().range(),f=b.data_color,g=[];return function(a){var b,c=a.id||a;return d[c]instanceof Function?b=d[c](a):d[c]?b=d[c]:(g.indexOf(c)<0&&g.push(c),b=e[g.indexOf(c)%e.length],d[c]=b),f instanceof Function?f(b,a):b}},f.generateLevelColor=function(){var a=this,b=a.config,c=b.color_pattern,d=b.color_threshold,e="value"===d.unit,f=d.values&&d.values.length?d.values:[],g=d.max||100;return r(b.color_threshold)?function(a){var b,d,h=c[c.length-1];for(b=0;b0},s=f.getOption=function(a,b,c){return m(a[b])?a[b]:c},t=f.hasValue=function(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c},u=f.getPathBox=function(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}};e.focus=function(a){function b(a){c.filterTargetsToShow(a).transition().duration(100).style("opacity",1)}var c=this.internal,d=c.svg.selectAll(c.selectorTarget(a)),e=d.filter(c.isNoneArc.bind(c)),f=d.filter(c.isArc.bind(c));this.revert(),this.defocus(),b(e.classed(h.focused,!0)),b(f),c.hasArcType()&&c.expandArc(a,!0),c.toggleFocusLegend(a,!0)},e.defocus=function(a){function b(a){c.filterTargetsToShow(a).transition().duration(100).style("opacity",.3)}var c=this.internal,d=c.svg.selectAll(c.selectorTarget(a)),e=d.filter(c.isNoneArc.bind(c)),f=d.filter(c.isArc.bind(c));this.revert(),b(e.classed(h.focused,!1)),b(f),c.hasArcType()&&c.unexpandArc(a),c.toggleFocusLegend(a,!1)},e.revert=function(a){function b(a){c.filterTargetsToShow(a).transition().duration(100).style("opacity",1)}var c=this.internal,d=c.svg.selectAll(c.selectorTarget(a)),e=d.filter(c.isNoneArc.bind(c)),f=d.filter(c.isArc.bind(c));b(e.classed(h.focused,!1)),b(f),c.hasArcType()&&c.unexpandArc(a),c.revertLegend()},e.show=function(a,b){var c=this.internal;a=c.mapToTargetIds(a),b=b||{},c.removeHiddenTargetIds(a),c.svg.selectAll(c.selectorTargets(a)).transition().style("opacity",1),b.withLegend&&c.showLegend(a),c.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},e.hide=function(a,b){var c=this.internal;a=c.mapToTargetIds(a),b=b||{},c.addHiddenTargetIds(a),c.svg.selectAll(c.selectorTargets(a)).transition().style("opacity",0),b.withLegend&&c.hideLegend(a),c.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},e.toggle=function(a){var b=this.internal;b.isTargetToShow(a)?this.hide(a):this.show(a)},e.zoom=function(){},e.zoom.enable=function(a){var b=this.internal;b.config.zoom_enabled=a,b.updateAndRedraw()},e.unzoom=function(){var a=this.internal;a.brush.clear().update(),a.redraw({withUpdateXDomain:!0})},e.load=function(a){var b=this.internal,c=b.config;return a.xs&&b.addXs(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){c.data_classes[b]=a.classes[b]}),"categories"in a&&b.isCategorized()&&(c.axis_x_categories=a.categories),"cacheIds"in a&&b.hasCaches(a.cacheIds)?void b.load(b.getCaches(a.cacheIds),a.done):void("unload"in a?b.unload(b.mapToTargetIds("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){b.loadFromArgs(a)}):b.loadFromArgs(a))},e.unload=function(a){var b=this.internal;a=a||{},b.unload(b.mapToTargetIds(a.ids),function(){b.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),a.done&&a.done()})},e.flow=function(a){var b,c,d,e,f,g,h,j,k=this.internal,l=[],n=k.getMaxDataCount(),o=0,p=0;if(a.json)c=k.convertJsonToData(a.json,a.keys);else if(a.rows)c=k.convertRowsToData(a.rows);else{if(!a.columns)return;c=k.convertColumnsToData(a.columns)}b=k.convertDataToTargets(c,!0),k.data.targets.forEach(function(a){var c,d,e=!1;for(c=0;cd;d++)b[c].values[d].index=p+d,k.isTimeSeries()||(b[c].values[d].x=p+d);a.values=a.values.concat(b[c].values),b.splice(c,1);break}e||l.push(a.id)}),k.data.targets.forEach(function(a){var b,c;for(b=0;bc;c++)a.values.push({id:a.id,index:p+c,x:k.isTimeSeries()?k.getOtherTargetX(p+c):p+c,value:null})}),k.data.targets.length&&b.forEach(function(a){var b,c=[];for(b=k.data.targets[0].values[0].index;p>b;b++)c.push({id:a.id,index:b,x:k.isTimeSeries()?k.getOtherTargetX(b):b,value:null});a.values.forEach(function(a){a.index+=p,k.isTimeSeries()||(a.x+=p)}),a.values=c.concat(a.values)}),k.data.targets=k.data.targets.concat(b),d=k.getMaxDataCount(),f=k.data.targets[0],g=f.values[0],m(a.to)?(o=0,j=k.isTimeSeries()?k.parseDate(a.to):a.to,f.values.forEach(function(a){a.x1?f.values[f.values.length-1].x-g.x:g.x-k.getXDomain(k.data.targets)[0]:1,e=[g.x-h,g.x],k.updateXDomain(null,!0,!0,e)),k.updateTargets(k.data.targets),k.redraw({flow:{index:g.index,length:o,duration:i(a.duration)?a.duration:k.config.transition_duration,done:a.done,orgDataCount:n},withLegend:!0,withTransition:n>1})},f.generateFlow=function(a){var b=this,c=b.config,d=b.d3;return function(){var e,f,g,i=a.targets,j=a.flow,k=a.drawBar,l=a.drawLine,m=a.drawArea,n=a.cx,o=a.cy,q=a.xv,r=a.xForText,s=a.yForText,t=a.duration,u=1,v=j.index,w=j.length,x=b.getValueOnIndex(b.data.targets[0].values,v),y=b.getValueOnIndex(b.data.targets[0].values,v+w),z=b.x.domain(),A=j.duration||t,B=j.done||function(){},C=b.generateWait(),D=b.xgrid||d.selectAll([]),E=b.xgridLines||d.selectAll([]),F=b.mainRegion||d.selectAll([]),G=b.mainText||d.selectAll([]),H=b.mainBar||d.selectAll([]),I=b.mainLine||d.selectAll([]),J=b.mainArea||d.selectAll([]),K=b.mainCircle||d.selectAll([]);b.data.targets.forEach(function(a){a.values.splice(0,w)}),g=b.updateXDomain(i,!0,!0),b.updateXGrid&&b.updateXGrid(!0),j.orgDataCount?e=1===j.orgDataCount||x.x===y.x?b.x(z[0])-b.x(g[0]):b.isTimeSeries()?b.x(z[0])-b.x(g[0]):b.x(x.x)-b.x(y.x):1!==b.data.targets[0].values.length?e=b.x(z[0])-b.x(g[0]):b.isTimeSeries()?(x=b.getValueOnIndex(b.data.targets[0].values,0),y=b.getValueOnIndex(b.data.targets[0].values,b.data.targets[0].values.length-1),e=b.x(x.x)-b.x(y.x)):e=p(g)/2,u=p(z)/p(g),f="translate("+e+",0) scale("+u+",1)",d.transition().ease("linear").duration(A).each(function(){C.add(b.axes.x.transition().call(b.xAxis)),C.add(H.transition().attr("transform",f)),C.add(I.transition().attr("transform",f)),C.add(J.transition().attr("transform",f)),C.add(K.transition().attr("transform",f)),C.add(G.transition().attr("transform",f)),C.add(F.filter(b.isRegionOnX).transition().attr("transform",f)),C.add(D.transition().attr("transform",f)),C.add(E.transition().attr("transform",f))}).call(C,function(){var a,d=[],e=[],f=[];if(w){for(a=0;w>a;a++)d.push("."+h.shape+"-"+(v+a)),e.push("."+h.text+"-"+(v+a)),f.push("."+h.eventRect+"-"+(v+a));b.svg.selectAll("."+h.shapes).selectAll(d).remove(),b.svg.selectAll("."+h.texts).selectAll(e).remove(),b.svg.selectAll("."+h.eventRects).selectAll(f).remove(),b.svg.select("."+h.xgrid).remove()}D.attr("transform",null).attr(b.xgridAttr),E.attr("transform",null),E.select("line").attr("x1",c.axis_rotated?0:q).attr("x2",c.axis_rotated?b.width:q),E.select("text").attr("x",c.axis_rotated?b.width:0).attr("y",q),H.attr("transform",null).attr("d",k),I.attr("transform",null).attr("d",l),J.attr("transform",null).attr("d",m),K.attr("transform",null).attr("cx",n).attr("cy",o),G.attr("transform",null).attr("x",r).attr("y",s).style("fill-opacity",b.opacityForText.bind(b)),F.attr("transform",null),F.select("rect").filter(b.isRegionOnX).attr("x",b.regionX.bind(b)).attr("width",b.regionWidth.bind(b)),b.updateEventRect(),B()})}},e.selected=function(a){var b=this.internal,c=b.d3;return c.merge(b.main.selectAll("."+h.shapes+b.getTargetSelectorSuffix(a)).selectAll("."+h.shape).filter(function(){return c.select(this).classed(h.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},e.select=function(a,b,c){var d=this.internal,e=d.d3,f=d.config;f.data_selection_enabled&&d.main.selectAll("."+h.shapes).selectAll("."+h.shape).each(function(g,i){var j=e.select(this),k=g.data?g.data.id:g.id,l=d.getToggle(this),n=f.data_selection_grouped||!a||a.indexOf(k)>=0,o=!b||b.indexOf(i)>=0,p=j.classed(h.SELECTED);j.classed(h.line)||j.classed(h.area)||(n&&o?f.data_selection_isselectable(g)&&!p&&l(!0,j.classed(h.SELECTED,!0),g,i):m(c)&&c&&p&&l(!1,j.classed(h.SELECTED,!1),g,i))})},e.unselect=function(a,b){var c=this.internal,d=c.d3,e=c.config;e.data_selection_enabled&&c.main.selectAll("."+h.shapes).selectAll("."+h.shape).each(function(f,g){var i=d.select(this),j=f.data?f.data.id:f.id,k=c.getToggle(this),l=e.data_selection_grouped||!a||a.indexOf(j)>=0,m=!b||b.indexOf(g)>=0,n=i.classed(h.SELECTED);i.classed(h.line)||i.classed(h.area)||l&&m&&e.data_selection_isselectable(f)&&n&&k(!1,i.classed(h.SELECTED,!1),f,g)})},e.transform=function(a,b){var c=this.internal,d=["pie","donut"].indexOf(a)>=0?{withTransform:!0}:null;c.transformTo(b,a,d)},f.transformTo=function(a,b,c){var d=this,e=!d.hasArcType(),f=c||{withTransitionForAxis:e};f.withTransitionForTransform=!1,d.transiting=!1,d.setTargetType(a,b),d.updateAndRedraw(f)},e.groups=function(a){var b=this.internal,c=b.config;return l(a)?c.data_groups:(c.data_groups=a,b.redraw(),c.data_groups)},e.xgrids=function(a){var b=this.internal,c=b.config;return a?(c.grid_x_lines=a,b.redraw(),c.grid_x_lines):c.grid_x_lines},e.xgrids.add=function(a){var b=this.internal;return this.xgrids(b.config.grid_x_lines.concat(a?a:[]))},e.xgrids.remove=function(a){var b=this.internal;b.removeGridLines(a,!0)},e.ygrids=function(a){var b=this.internal,c=b.config;return a?(c.grid_y_lines=a,b.redraw(),c.grid_y_lines):c.grid_y_lines},e.ygrids.add=function(a){var b=this.internal;return this.ygrids(b.config.grid_y_lines.concat(a?a:[]))},e.ygrids.remove=function(a){var b=this.internal;b.removeGridLines(a,!1)},e.regions=function(a){var b=this.internal,c=b.config;return a?(c.regions=a,b.redraw(),c.regions):c.regions},e.regions.add=function(a){var b=this.internal,c=b.config;return a?(c.regions=c.regions.concat(a),b.redraw(),c.regions):c.regions},e.regions.remove=function(a){var b,c,d,e=this.internal,f=e.config;return a=a||{},b=e.getOption(a,"duration",f.transition_duration),c=e.getOption(a,"classes",[h.region]),d=e.main.select("."+h.regions).selectAll(c.map(function(a){return"."+a})),(b?d.transition().duration(b):d).style("opacity",0).remove(),f.regions=f.regions.filter(function(a){var b=!1;return a.class?(a.class.split(" ").forEach(function(a){c.indexOf(a)>=0&&(b=!0)}),!b):!0}),f.regions},e.data=function(){},e.data.get=function(a){var b=this.data.getAsTarget(a);return m(b)?b.values.map(function(a){return a.value}):void 0},e.data.getAsTarget=function(a){var b=this.data.targets.filter(function(b){return b.id===a});return b.length>0?b[0]:void 0},e.data.names=function(a){var b=this.internal,c=b.config;return arguments.length?(Object.keys(a).forEach(function(b){c.data_names[b]=a[b]}),b.redraw({withLegend:!0}),c.data_names):c.data_names},e.data.colors=function(a){var b=this.internal,c=b.config;return arguments.length?(Object.keys(a).forEach(function(b){c.data_colors[b]=a[b]}),b.redraw({withLegend:!0}),c.data_colors):c.data_colors},e.category=function(a,b){var c=this.internal,d=c.config;return arguments.length>1&&(d.axis_x_categories[a]=b,c.redraw()),d.axis_x_categories[a]},e.categories=function(a){var b=this.internal,c=b.config;return arguments.length?(c.axis_x_categories=a,b.redraw(),c.axis_x_categories):c.axis_x_categories},e.color=function(a){var b=this.internal;return b.color(a)},e.x=function(a){var b=this.internal;return arguments.length&&(b.updateTargetX(b.data.targets,a),b.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),b.data.xs},e.xs=function(a){var b=this.internal;return arguments.length&&(b.updateTargetXs(b.data.targets,a),b.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),b.data.xs},e.axis=function(){},e.axis.labels=function(a){var b=this.internal;arguments.length&&(Object.keys(a).forEach(function(c){b.setAxisLabelText(c,a[c])}),b.updateAxisLabels())},e.axis.max=function(a){var b=this.internal,c=b.config;arguments.length&&("object"==typeof a?(i(a.x)&&(c.axis_x_max=a.x),i(a.y)&&(c.axis_y_max=a.y),i(a.y2)&&(c.axis_y2_max=a.y2)):c.axis_y_max=c.axis_y2_max=a,b.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},e.axis.min=function(a){var b=this.internal,c=b.config;arguments.length&&("object"==typeof a?(i(a.x)&&(c.axis_x_min=a.x),i(a.y)&&(c.axis_y_min=a.y),i(a.y2)&&(c.axis_y2_min=a.y2)):c.axis_y_min=c.axis_y2_min=a,b.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},e.axis.range=function(a){arguments.length&&(m(a.max)&&this.axis.max(a.max),m(a.min)&&this.axis.min(a.min))},e.legend=function(){},e.legend.show=function(a){var b=this.internal;b.showLegend(b.mapToTargetIds(a)),b.updateAndRedraw({withLegend:!0})},e.legend.hide=function(a){var b=this.internal;b.hideLegend(b.mapToTargetIds(a)),b.updateAndRedraw({withLegend:!0})},e.resize=function(a){var b=this.internal,c=b.config;c.size_width=a?a.width:null,c.size_height=a?a.height:null,this.flush()},e.flush=function(){var a=this.internal;a.updateAndRedraw({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},e.destroy=function(){var b=this.internal;b.data.targets=void 0,b.data.xs={},b.selectChart.classed("c3",!1).html(""),a.onresize=null},"function"==typeof define&&define.amd?define("c3",["d3"],g):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=g:a.c3=g}(window);
\ No newline at end of file
diff --git a/src/api.flow.js b/src/api.flow.js
index 861b678..b311b77 100644
--- a/src/api.flow.js
+++ b/src/api.flow.js
@@ -140,7 +140,7 @@ c3_chart_fn.flow = function (args) {
};
c3_chart_internal_fn.generateFlow = function (args) {
- var $$ = this, config = $$.config, d3 = $$.d3, CLASS = $$.CLASS;
+ var $$ = this, config = $$.config, d3 = $$.d3;
return function () {
var targets = args.targets,
@@ -226,14 +226,14 @@ c3_chart_internal_fn.generateFlow = function (args) {
// remove flowed elements
if (flowLength) {
for (i = 0; i < flowLength; i++) {
- shapes.push('.' + CLASS[_shape] + '-' + (flowIndex + i));
- texts.push('.' + CLASS[_text] + '-' + (flowIndex + i));
- eventRects.push('.' + CLASS[_eventRect] + '-' + (flowIndex + i));
+ shapes.push('.' + CLASS.shape + '-' + (flowIndex + i));
+ texts.push('.' + CLASS.text + '-' + (flowIndex + i));
+ eventRects.push('.' + CLASS.eventRect + '-' + (flowIndex + i));
}
- $$.svg.selectAll('.' + CLASS[_shapes]).selectAll(shapes).remove();
- $$.svg.selectAll('.' + CLASS[_texts]).selectAll(texts).remove();
- $$.svg.selectAll('.' + CLASS[_eventRects]).selectAll(eventRects).remove();
- $$.svg.select('.' + CLASS[_xgrid]).remove();
+ $$.svg.selectAll('.' + CLASS.shapes).selectAll(shapes).remove();
+ $$.svg.selectAll('.' + CLASS.texts).selectAll(texts).remove();
+ $$.svg.selectAll('.' + CLASS.eventRects).selectAll(eventRects).remove();
+ $$.svg.select('.' + CLASS.xgrid).remove();
}
// draw again for removing flowed elements and reverting attr
diff --git a/src/api.focus.js b/src/api.focus.js
index 4710d77..f3a4eb7 100644
--- a/src/api.focus.js
+++ b/src/api.focus.js
@@ -8,7 +8,7 @@ c3_chart_fn.focus = function (targetId) {
}
this.revert();
this.defocus();
- focus(candidatesForNoneArc.classed(CLASS[_focused], true));
+ focus(candidatesForNoneArc.classed(CLASS.focused, true));
focus(candidatesForArc);
if ($$.hasArcType()) {
$$.expandArc(targetId, true);
@@ -25,7 +25,7 @@ c3_chart_fn.defocus = function (targetId) {
$$.filterTargetsToShow(targets).transition().duration(100).style('opacity', 0.3);
}
this.revert();
- defocus(candidatesForNoneArc.classed(CLASS[_focused], false));
+ defocus(candidatesForNoneArc.classed(CLASS.focused, false));
defocus(candidatesForArc);
if ($$.hasArcType()) {
$$.unexpandArc(targetId);
@@ -41,7 +41,7 @@ c3_chart_fn.revert = function (targetId) {
function revert(targets) {
$$.filterTargetsToShow(targets).transition().duration(100).style('opacity', 1);
}
- revert(candidatesForNoneArc.classed(CLASS[_focused], false));
+ revert(candidatesForNoneArc.classed(CLASS.focused, false));
revert(candidatesForArc);
if ($$.hasArcType()) {
$$.unexpandArc(targetId);
diff --git a/src/api.region.js b/src/api.region.js
index 9316e1f..640427f 100644
--- a/src/api.region.js
+++ b/src/api.region.js
@@ -18,9 +18,9 @@ c3_chart_fn.regions.remove = function (options) {
options = options || {};
duration = $$.getOption(options, "duration", config.transition_duration);
- classes = $$.getOption(options, "classes", [CLASS[_region]]);
+ classes = $$.getOption(options, "classes", [CLASS.region]);
- regions = $$.main.select('.' + CLASS[_regions]).selectAll(classes.map(function (c) { return '.' + c; }));
+ regions = $$.main.select('.' + CLASS.regions).selectAll(classes.map(function (c) { return '.' + c; }));
(duration ? regions.transition().duration(duration) : regions)
.style('opacity', 0)
.remove();
diff --git a/src/api.selection.js b/src/api.selection.js
index cbfc5ba..87c631b 100644
--- a/src/api.selection.js
+++ b/src/api.selection.js
@@ -1,30 +1,30 @@
c3_chart_fn.selected = function (targetId) {
var $$ = this.internal, d3 = $$.d3;
return d3.merge(
- $$.main.selectAll('.' + CLASS[_shapes] + $$.getTargetSelectorSuffix(targetId)).selectAll('.' + CLASS[_shape])
- .filter(function () { return d3.select(this).classed(CLASS[_SELECTED]); })
+ $$.main.selectAll('.' + CLASS.shapes + $$.getTargetSelectorSuffix(targetId)).selectAll('.' + CLASS.shape)
+ .filter(function () { return d3.select(this).classed(CLASS.SELECTED); })
.map(function (d) { return d.map(function (d) { var data = d.__data__; return data.data ? data.data : data; }); })
);
};
c3_chart_fn.select = function (ids, indices, resetOther) {
var $$ = this.internal, d3 = $$.d3, config = $$.config;
if (! config.data_selection_enabled) { return; }
- $$.main.selectAll('.' + CLASS[_shapes]).selectAll('.' + CLASS[_shape]).each(function (d, i) {
+ $$.main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) {
var shape = d3.select(this), id = d.data ? d.data.id : d.id, toggle = $$.getToggle(this),
isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,
isTargetIndex = !indices || indices.indexOf(i) >= 0,
- isSelected = shape.classed(CLASS[_SELECTED]);
+ isSelected = shape.classed(CLASS.SELECTED);
// line/area selection not supported yet
- if (shape.classed(CLASS[_line]) || shape.classed(CLASS[_area])) {
+ if (shape.classed(CLASS.line) || shape.classed(CLASS.area)) {
return;
}
if (isTargetId && isTargetIndex) {
if (config.data_selection_isselectable(d) && !isSelected) {
- toggle(true, shape.classed(CLASS[_SELECTED], true), d, i);
+ toggle(true, shape.classed(CLASS.SELECTED, true), d, i);
}
} else if (isDefined(resetOther) && resetOther) {
if (isSelected) {
- toggle(false, shape.classed(CLASS[_SELECTED], false), d, i);
+ toggle(false, shape.classed(CLASS.SELECTED, false), d, i);
}
}
});
@@ -32,19 +32,19 @@ c3_chart_fn.select = function (ids, indices, resetOther) {
c3_chart_fn.unselect = function (ids, indices) {
var $$ = this.internal, d3 = $$.d3, config = $$.config;
if (! config.data_selection_enabled) { return; }
- $$.main.selectAll('.' + CLASS[_shapes]).selectAll('.' + CLASS[_shape]).each(function (d, i) {
+ $$.main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape).each(function (d, i) {
var shape = d3.select(this), id = d.data ? d.data.id : d.id, toggle = $$.getToggle(this),
isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,
isTargetIndex = !indices || indices.indexOf(i) >= 0,
- isSelected = shape.classed(CLASS[_SELECTED]);
+ isSelected = shape.classed(CLASS.SELECTED);
// line/area selection not supported yet
- if (shape.classed(CLASS[_line]) || shape.classed(CLASS[_area])) {
+ if (shape.classed(CLASS.line) || shape.classed(CLASS.area)) {
return;
}
if (isTargetId && isTargetIndex) {
if (config.data_selection_isselectable(d)) {
if (isSelected) {
- toggle(false, shape.classed(CLASS[_SELECTED], false), d, i);
+ toggle(false, shape.classed(CLASS.SELECTED, false), d, i);
}
}
}
diff --git a/src/arc.js b/src/arc.js
index 007ef63..be2f735 100644
--- a/src/arc.js
+++ b/src/arc.js
@@ -120,8 +120,8 @@ c3_chart_internal_fn.textForArcLabel = function (d) {
c3_chart_internal_fn.expandArc = function (id, withoutFadeOut) {
var $$ = this,
- target = $$.svg.selectAll('.' + CLASS[_chartArc] + $$.selectorTarget(id)),
- noneTargets = $$.svg.selectAll('.' + CLASS[_arc]).filter(function (data) { return data.data.id !== id; });
+ target = $$.svg.selectAll('.' + CLASS.chartArc + $$.selectorTarget(id)),
+ noneTargets = $$.svg.selectAll('.' + CLASS.arc).filter(function (data) { return data.data.id !== id; });
if ($$.shouldExpand(id)) {
target.selectAll('path')
@@ -142,11 +142,11 @@ c3_chart_internal_fn.expandArc = function (id, withoutFadeOut) {
c3_chart_internal_fn.unexpandArc = function (id) {
var $$ = this,
- target = $$.svg.selectAll('.' + CLASS[_chartArc] + $$.selectorTarget(id));
- target.selectAll('path.' + CLASS[_arc])
+ target = $$.svg.selectAll('.' + CLASS.chartArc + $$.selectorTarget(id));
+ target.selectAll('path.' + CLASS.arc)
.transition().duration(50)
.attr("d", $$.svgArc);
- $$.svg.selectAll('.' + CLASS[_arc])
+ $$.svg.selectAll('.' + CLASS.arc)
.style("opacity", 1);
};
@@ -197,7 +197,7 @@ c3_chart_internal_fn.updateTargetsForArc = function (targets) {
mainPieUpdate, mainPieEnter,
classChartArc = $$.classChartArc.bind($$),
classArcs = $$.classArcs.bind($$);
- mainPieUpdate = main.select('.' + CLASS[_chartArcs]).selectAll('.' + CLASS[_chartArc])
+ mainPieUpdate = main.select('.' + CLASS.chartArcs).selectAll('.' + CLASS.chartArc)
.data($$.pie(targets))
.attr("class", classChartArc);
mainPieEnter = mainPieUpdate.enter().append("g")
@@ -215,11 +215,11 @@ c3_chart_internal_fn.updateTargetsForArc = function (targets) {
c3_chart_internal_fn.initArc = function () {
var $$ = this;
- $$.arcs = $$.main.select('.' + CLASS[_chart]).append("g")
- .attr("class", CLASS[_chartArcs])
+ $$.arcs = $$.main.select('.' + CLASS.chart).append("g")
+ .attr("class", CLASS.chartArcs)
.attr("transform", $$.getTranslate('arc'));
$$.arcs.append('text')
- .attr('class', CLASS[_chartArcsTitle])
+ .attr('class', CLASS.chartArcsTitle)
.style("text-anchor", "middle")
.text($$.getArcTitle());
};
@@ -227,7 +227,7 @@ c3_chart_internal_fn.initArc = function () {
c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransform) {
var $$ = this, d3 = $$.d3, config = $$.config, main = $$.main,
mainArc;
- mainArc = main.selectAll('.' + CLASS[_arcs]).selectAll('.' + CLASS[_arc])
+ mainArc = main.selectAll('.' + CLASS.arcs).selectAll('.' + CLASS.arc)
.data($$.arcData.bind($$));
mainArc.enter().append('path')
.attr("class", $$.classArc.bind($$))
@@ -314,14 +314,14 @@ c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransf
mainArc.exit().transition().duration(durationForExit)
.style('opacity', 0)
.remove();
- main.selectAll('.' + CLASS[_chartArc]).select('text')
+ main.selectAll('.' + CLASS.chartArc).select('text')
.style("opacity", 0)
- .attr('class', function (d) { return $$.isGaugeType(d.data) ? CLASS[_gaugeValue] : ''; })
+ .attr('class', function (d) { return $$.isGaugeType(d.data) ? CLASS.gaugeValue : ''; })
.text($$.textForArcLabel.bind($$))
.attr("transform", $$.transformForArcLabel.bind($$))
.transition().duration(duration)
.style("opacity", function (d) { return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? 1 : 0; });
- main.select('.' + CLASS[_chartArcsTitle])
+ main.select('.' + CLASS.chartArcsTitle)
.style("opacity", $$.hasType('donut') || $$.hasType('gauge') ? 1 : 0);
};
@@ -329,7 +329,7 @@ c3_chart_internal_fn.initGauge = function () {
var $$ = this, config = $$.config, arcs = $$.arcs;
if ($$.hasType('gauge')) {
arcs.append('path')
- .attr("class", CLASS[_chartArcsBackground])
+ .attr("class", CLASS.chartArcsBackground)
.attr("d", function () {
var d = {
data: [{value: config.gauge_max}],
@@ -340,21 +340,21 @@ c3_chart_internal_fn.initGauge = function () {
});
arcs.append("text")
.attr("dy", ".75em")
- .attr("class", CLASS[_chartArcsGaugeUnit])
+ .attr("class", CLASS.chartArcsGaugeUnit)
.style("text-anchor", "middle")
.style("pointer-events", "none")
.text(config.gauge_label_show ? config.gauge_units : '');
arcs.append("text")
.attr("dx", -1 * ($$.innerRadius + (($$.radius - $$.innerRadius) / 2)) + "px")
.attr("dy", "1.2em")
- .attr("class", CLASS[_chartArcsGaugeMin])
+ .attr("class", CLASS.chartArcsGaugeMin)
.style("text-anchor", "middle")
.style("pointer-events", "none")
.text(config.gauge_label_show ? config.gauge_min : '');
arcs.append("text")
.attr("dx", $$.innerRadius + (($$.radius - $$.innerRadius) / 2) + "px")
.attr("dy", "1.2em")
- .attr("class", CLASS[_chartArcsGaugeMax])
+ .attr("class", CLASS.chartArcsGaugeMax)
.style("text-anchor", "middle")
.style("pointer-events", "none")
.text(config.gauge_label_show ? config.gauge_max : '');
diff --git a/src/axis.js b/src/axis.js
index 7f28b91..447564d 100644
--- a/src/axis.js
+++ b/src/axis.js
@@ -1,32 +1,32 @@
c3_chart_internal_fn.initAxis = function () {
- var $$ = this, config = $$.config, main = $$.main, CLASS = $$.CLASS;
+ var $$ = this, config = $$.config, main = $$.main;
$$.axes.x = main.append("g")
- .attr("class", CLASS[_axis] + ' ' + CLASS[_axisX])
+ .attr("class", CLASS.axis + ' ' + CLASS.axisX)
.attr("clip-path", $$.clipPathForXAxis)
.attr("transform", $$.getTranslate('x'))
.style("visibility", config.axis_x_show ? 'visible' : 'hidden');
$$.axes.x.append("text")
- .attr("class", CLASS[_axisXLabel])
+ .attr("class", CLASS.axisXLabel)
.attr("transform", config.axis_rotated ? "rotate(-90)" : "")
.style("text-anchor", $$.textAnchorForXAxisLabel.bind($$));
$$.axes.y = main.append("g")
- .attr("class", CLASS[_axis] + ' ' + CLASS[_axisY])
+ .attr("class", CLASS.axis + ' ' + CLASS.axisY)
.attr("clip-path", $$.clipPathForYAxis)
.attr("transform", $$.getTranslate('y'))
.style("visibility", config.axis_y_show ? 'visible' : 'hidden');
$$.axes.y.append("text")
- .attr("class", CLASS[_axisYLabel])
+ .attr("class", CLASS.axisYLabel)
.attr("transform", config.axis_rotated ? "" : "rotate(-90)")
.style("text-anchor", $$.textAnchorForYAxisLabel.bind($$));
$$.axes.y2 = main.append("g")
- .attr("class", CLASS[_axis] + ' ' + CLASS[_axisY2])
+ .attr("class", CLASS.axis + ' ' + CLASS.axisY2)
// clip-path?
.attr("transform", $$.getTranslate('y2'))
.style("visibility", config.axis_y2_show ? 'visible' : 'hidden');
$$.axes.y2.append("text")
- .attr("class", CLASS[_axisY2Label])
+ .attr("class", CLASS.axisY2Label)
.attr("transform", config.axis_rotated ? "" : "rotate(-90)")
.style("text-anchor", $$.textAnchorForY2AxisLabel.bind($$));
};
@@ -261,9 +261,9 @@ c3_chart_internal_fn.getMaxTickWidth = function (id) {
c3_chart_internal_fn.updateAxisLabels = function (withTransition) {
var $$ = this;
- var axisXLabel = $$.main.select('.' + CLASS[_axisX] + ' .' + CLASS[_axisXLabel]),
- axisYLabel = $$.main.select('.' + CLASS[_axisY] + ' .' + CLASS[_axisYLabel]),
- axisY2Label = $$.main.select('.' + CLASS[_axisY2] + ' .' + CLASS[_axisY2Label]);
+ var axisXLabel = $$.main.select('.' + CLASS.axisX + ' .' + CLASS.axisXLabel),
+ axisYLabel = $$.main.select('.' + CLASS.axisY + ' .' + CLASS.axisYLabel),
+ axisY2Label = $$.main.select('.' + CLASS.axisY2 + ' .' + CLASS.axisY2Label);
(withTransition ? axisXLabel.transition() : axisXLabel)
.attr("x", $$.xForXAxisLabel.bind($$))
.attr("dx", $$.dxForXAxisLabel.bind($$))
diff --git a/src/class.js b/src/class.js
index 10d9f17..4e487ce 100644
--- a/src/class.js
+++ b/src/class.js
@@ -1,231 +1,159 @@
-var _target = 'target',
- _chart = 'chart ',
- _chartLine = 'chartLine',
- _chartLines = 'chartLines',
- _chartBar = 'chartBar',
- _chartBars = 'chartBars',
- _chartText = 'chartText',
- _chartTexts = 'chartTexts',
- _chartArc = 'chartArc',
- _chartArcs = 'chartArcs',
- _chartArcsTitle = 'chartArcsTitle',
- _chartArcsBackground = 'chartArcsBackground',
- _chartArcsGaugeUnit = 'chartArcsGaugeUnit',
- _chartArcsGaugeMax = 'chartArcsGaugeMax',
- _chartArcsGaugeMin = 'chartArcsGaugeMin',
- _selectedCircle = 'selectedCircle',
- _selectedCircles = 'selectedCircles',
- _eventRect = 'eventRect',
- _eventRects = 'eventRects',
- _eventRectsSingle = 'eventRectsSingle',
- _eventRectsMultiple = 'eventRectsMultiple',
- _zoomRect = 'zoomRect',
- _brush = 'brush',
- _focused = 'focused',
- _region = 'region',
- _regions = 'regions',
- _tooltip = 'tooltip',
- _tooltipName = 'tooltipName',
- _shape = 'shape',
- _shapes = 'shapes',
- _line = 'line',
- _lines = 'lines',
- _bar = 'bar',
- _bars = 'bars',
- _circle = 'circle',
- _circles = 'circles',
- _arc = 'arc',
- _arcs = 'arcs',
- _area = 'area',
- _areas = 'areas',
- _empty = 'empty',
- _text = 'text',
- _texts = 'texts',
- _gaugeValue = 'gaugeValue',
- _grid = 'grid',
- _xgrid = 'xgrid',
- _xgrids = 'xgrids',
- _xgridLine = 'xgridLine',
- _xgridLines = 'xgridLines',
- _xgridFocus = 'xgridFocus',
- _ygrid = 'ygrid',
- _ygrids = 'ygrids',
- _ygridLine = 'ygridLine',
- _ygridLines = 'ygridLines',
- _axis = 'axis',
- _axisX = 'axisX',
- _axisXLabel = 'axisXLabel',
- _axisY = 'axisY',
- _axisYLabel = 'axisYLabel',
- _axisY2 = 'axisY2',
- _axisY2Label = 'axisY2Label',
- _legendBackground = 'legendBackground',
- _legendItem = 'legendItem',
- _legendItemEvent = 'legendItemEvent',
- _legendItemTile = 'legendItemTile',
- _legendItemHidden = 'legendItemHidden',
- _legendItemFocused = 'legendItemFocused',
- _dragarea = 'dragarea',
- _EXPANDED = 'EXPANDED',
- _SELECTED = 'SELECTED',
- _INCLUDED = 'INCLUDED';
-
-var CLASS = c3_chart_internal_fn.CLASS = {};
-CLASS[_target] = 'c3-target';
-CLASS[_chart] = 'c3-chart';
-CLASS[_chartLine] = 'c3-chart-line';
-CLASS[_chartLines] = 'c3-chart-lines';
-CLASS[_chartBar] = 'c3-chart-bar';
-CLASS[_chartBars] = 'c3-chart-bars';
-CLASS[_chartText] = 'c3-chart-text';
-CLASS[_chartTexts] = 'c3-chart-texts';
-CLASS[_chartArc] = 'c3-chart-arc';
-CLASS[_chartArcs] = 'c3-chart-arcs';
-CLASS[_chartArcsTitle] = 'c3-chart-arcs-title';
-CLASS[_chartArcsBackground] = 'c3-chart-arcs-background';
-CLASS[_chartArcsGaugeUnit] = 'c3-chart-arcs-gauge-unit';
-CLASS[_chartArcsGaugeMax] = 'c3-chart-arcs-gauge-max';
-CLASS[_chartArcsGaugeMin] = 'c3-chart-arcs-gauge-min';
-CLASS[_selectedCircle] = 'c3-selected-circle';
-CLASS[_selectedCircles] = 'c3-selected-circles';
-CLASS[_eventRect] = 'c3-event-rect';
-CLASS[_eventRects] = 'c3-event-rects';
-CLASS[_eventRectsSingle] = 'c3-event-rects-single';
-CLASS[_eventRectsMultiple] = 'c3-event-rects-multiple';
-CLASS[_zoomRect] = 'c3-zoom-rect';
-CLASS[_brush] = 'c3-brush';
-CLASS[_focused] = 'c3-focused';
-CLASS[_region] = 'c3-region';
-CLASS[_regions] = 'c3-regions';
-CLASS[_tooltip] = 'c3-tooltip';
-CLASS[_tooltipName] = 'c3-tooltip-name';
-CLASS[_shape] = 'c3-shape';
-CLASS[_shapes] = 'c3-shapes';
-CLASS[_line] = 'c3-line';
-CLASS[_lines] = 'c3-lines';
-CLASS[_bar] = 'c3-bar';
-CLASS[_bars] = 'c3-bars';
-CLASS[_circle] = 'c3-circle';
-CLASS[_circles] = 'c3-circles';
-CLASS[_arc] = 'c3-arc';
-CLASS[_arcs] = 'c3-arcs';
-CLASS[_area] = 'c3-area';
-CLASS[_areas] = 'c3-areas';
-CLASS[_empty] = 'c3-empty';
-CLASS[_text] = 'c3-text';
-CLASS[_texts] = 'c3-texts';
-CLASS[_gaugeValue] = 'c3-gauge-value';
-CLASS[_grid] = 'c3-grid';
-CLASS[_xgrid] = 'c3-xgrid';
-CLASS[_xgrids] = 'c3-xgrids';
-CLASS[_xgridLine] = 'c3-xgrid-line';
-CLASS[_xgridLines] = 'c3-xgrid-lines';
-CLASS[_xgridFocus] = 'c3-xgrid-focus';
-CLASS[_ygrid] = 'c3-ygrid';
-CLASS[_ygrids] = 'c3-ygrids';
-CLASS[_ygridLine] = 'c3-ygrid-line';
-CLASS[_ygridLines] = 'c3-ygrid-lines';
-CLASS[_axis] = 'c3-axis';
-CLASS[_axisX] = 'c3-axis-x';
-CLASS[_axisXLabel] = 'c3-axis-x-label';
-CLASS[_axisY] = 'c3-axis-y';
-CLASS[_axisYLabel] = 'c3-axis-y-label';
-CLASS[_axisY2] = 'c3-axis-y2';
-CLASS[_axisY2Label] = 'c3-axis-y2-label';
-CLASS[_legendBackground] = 'c3-legend-background';
-CLASS[_legendItem] = 'c3-legend-item';
-CLASS[_legendItemEvent] = 'c3-legend-item-event';
-CLASS[_legendItemTile] = 'c3-legend-item-tile';
-CLASS[_legendItemHidden] = 'c3-legend-item-hidden';
-CLASS[_legendItemFocused] = 'c3-legend-item-focused';
-CLASS[_dragarea] = 'c3-dragarea';
-CLASS[_EXPANDED] = '_expanded_';
-CLASS[_SELECTED] = '_selected_';
-CLASS[_INCLUDED] = '_included_';
-
+var CLASS = c3_chart_internal_fn.CLASS = {
+ target: 'c3-target',
+ chart: 'c3-chart',
+ chartLine: 'c3-chart-line',
+ chartLines: 'c3-chart-lines',
+ chartBar: 'c3-chart-bar',
+ chartBars: 'c3-chart-bars',
+ chartText: 'c3-chart-text',
+ chartTexts: 'c3-chart-texts',
+ chartArc: 'c3-chart-arc',
+ chartArcs: 'c3-chart-arcs',
+ chartArcsTitle: 'c3-chart-arcs-title',
+ chartArcsBackground: 'c3-chart-arcs-background',
+ chartArcsGaugeUnit: 'c3-chart-arcs-gauge-unit',
+ chartArcsGaugeMax: 'c3-chart-arcs-gauge-max',
+ chartArcsGaugeMin: 'c3-chart-arcs-gauge-min',
+ selectedCircle: 'c3-selected-circle',
+ selectedCircles: 'c3-selected-circles',
+ eventRect: 'c3-event-rect',
+ eventRects: 'c3-event-rects',
+ eventRectsSingle: 'c3-event-rects-single',
+ eventRectsMultiple: 'c3-event-rects-multiple',
+ zoomRect: 'c3-zoom-rect',
+ brush: 'c3-brush',
+ focused: 'c3-focused',
+ region: 'c3-region',
+ regions: 'c3-regions',
+ tooltip: 'c3-tooltip',
+ tooltipName: 'c3-tooltip-name',
+ shape: 'c3-shape',
+ shapes: 'c3-shapes',
+ line: 'c3-line',
+ lines: 'c3-lines',
+ bar: 'c3-bar',
+ bars: 'c3-bars',
+ circle: 'c3-circle',
+ circles: 'c3-circles',
+ arc: 'c3-arc',
+ arcs: 'c3-arcs',
+ area: 'c3-area',
+ areas: 'c3-areas',
+ empty: 'c3-empty',
+ text: 'c3-text',
+ texts: 'c3-texts',
+ gaugeValue: 'c3-gauge-value',
+ grid: 'c3-grid',
+ xgrid: 'c3-xgrid',
+ xgrids: 'c3-xgrids',
+ xgridLine: 'c3-xgrid-line',
+ xgridLines: 'c3-xgrid-lines',
+ xgridFocus: 'c3-xgrid-focus',
+ ygrid: 'c3-ygrid',
+ ygrids: 'c3-ygrids',
+ ygridLine: 'c3-ygrid-line',
+ ygridLines: 'c3-ygrid-lines',
+ axis: 'c3-axis',
+ axisX: 'c3-axis-x',
+ axisXLabel: 'c3-axis-x-label',
+ axisY: 'c3-axis-y',
+ axisYLabel: 'c3-axis-y-label',
+ axisY2: 'c3-axis-y2',
+ axisY2Label: 'c3-axis-y2-label',
+ legendBackground: 'c3-legend-background',
+ legendItem: 'c3-legend-item',
+ legendItemEvent: 'c3-legend-item-event',
+ legendItemTile: 'c3-legend-item-tile',
+ legendItemHidden: 'c3-legend-item-hidden',
+ legendItemFocused: 'c3-legend-item-focused',
+ dragarea: 'c3-dragarea',
+ EXPANDED: '_expanded_',
+ SELECTED: '_selected_',
+ INCLUDED: '_included_'
+};
c3_chart_internal_fn.generateClass = function (prefix, targetId) {
return " " + prefix + " " + prefix + this.getTargetSelectorSuffix(targetId);
};
c3_chart_internal_fn.classText = function (d) {
- return this.generateClass(CLASS[_text], d.index);
+ return this.generateClass(CLASS.text, d.index);
};
c3_chart_internal_fn.classTexts = function (d) {
- return this.generateClass(CLASS[_texts], d.id);
+ return this.generateClass(CLASS.texts, d.id);
};
c3_chart_internal_fn.classShape = function (d) {
- return this.generateClass(CLASS[_shape], d.index);
+ return this.generateClass(CLASS.shape, d.index);
};
c3_chart_internal_fn.classShapes = function (d) {
- return this.generateClass(CLASS[_shapes], d.id);
+ return this.generateClass(CLASS.shapes, d.id);
};
c3_chart_internal_fn.classLine = function (d) {
- return this.classShape(d) + this.generateClass(CLASS[_line], d.id);
+ return this.classShape(d) + this.generateClass(CLASS.line, d.id);
};
c3_chart_internal_fn.classLines = function (d) {
- return this.classShapes(d) + this.generateClass(CLASS[_lines], d.id);
+ return this.classShapes(d) + this.generateClass(CLASS.lines, d.id);
};
c3_chart_internal_fn.classCircle = function (d) {
- return this.classShape(d) + this.generateClass(CLASS[_circle], d.index);
+ return this.classShape(d) + this.generateClass(CLASS.circle, d.index);
};
c3_chart_internal_fn.classCircles = function (d) {
- return this.classShapes(d) + this.generateClass(CLASS[_circles], d.id);
+ return this.classShapes(d) + this.generateClass(CLASS.circles, d.id);
};
c3_chart_internal_fn.classBar = function (d) {
- return this.classShape(d) + this.generateClass(CLASS[_bar], d.index);
+ return this.classShape(d) + this.generateClass(CLASS.bar, d.index);
};
c3_chart_internal_fn.classBars = function (d) {
- return this.classShapes(d) + this.generateClass(CLASS[_bars], d.id);
+ return this.classShapes(d) + this.generateClass(CLASS.bars, d.id);
};
c3_chart_internal_fn.classArc = function (d) {
- return this.classShape(d.data) + this.generateClass(CLASS[_arc], d.data.id);
+ return this.classShape(d.data) + this.generateClass(CLASS.arc, d.data.id);
};
c3_chart_internal_fn.classArcs = function (d) {
- return this.classShapes(d.data) + this.generateClass(CLASS[_arcs], d.data.id);
+ return this.classShapes(d.data) + this.generateClass(CLASS.arcs, d.data.id);
};
c3_chart_internal_fn.classArea = function (d) {
- return this.classShape(d) + this.generateClass(CLASS[_area], d.id);
+ return this.classShape(d) + this.generateClass(CLASS.area, d.id);
};
c3_chart_internal_fn.classAreas = function (d) {
- return this.classShapes(d) + this.generateClass(CLASS[_areas], d.id);
+ return this.classShapes(d) + this.generateClass(CLASS.areas, d.id);
};
c3_chart_internal_fn.classRegion = function (d, i) {
- return this.generateClass(CLASS[_region], i) + ' ' + ('class' in d ? d.class : '');
+ return this.generateClass(CLASS.region, i) + ' ' + ('class' in d ? d.class : '');
};
c3_chart_internal_fn.classEvent = function (d) {
- return this.generateClass(CLASS[_eventRect], d.index);
+ return this.generateClass(CLASS.eventRect, d.index);
};
c3_chart_internal_fn.classTarget = function (id) {
var $$ = this;
var additionalClassSuffix = $$.config.data_classes[id], additionalClass = '';
if (additionalClassSuffix) {
- additionalClass = ' ' + CLASS[_target] + '-' + additionalClassSuffix;
+ additionalClass = ' ' + CLASS.target + '-' + additionalClassSuffix;
}
- return $$.generateClass(CLASS[_target], id) + additionalClass;
+ return $$.generateClass(CLASS.target, id) + additionalClass;
};
c3_chart_internal_fn.classChartText = function (d) {
- return CLASS[_chartText] + this.classTarget(d.id);
+ return CLASS.chartText + this.classTarget(d.id);
};
c3_chart_internal_fn.classChartLine = function (d) {
- return CLASS[_chartLine] + this.classTarget(d.id);
+ return CLASS.chartLine + this.classTarget(d.id);
};
c3_chart_internal_fn.classChartBar = function (d) {
- return CLASS[_chartBar] + this.classTarget(d.id);
+ return CLASS.chartBar + this.classTarget(d.id);
};
c3_chart_internal_fn.classChartArc = function (d) {
- return CLASS[_chartArc] + this.classTarget(d.data.id);
+ return CLASS.chartArc + this.classTarget(d.data.id);
};
c3_chart_internal_fn.getTargetSelectorSuffix = function (targetId) {
return targetId || targetId === 0 ? '-' + (targetId.replace ? targetId.replace(/([^a-zA-Z0-9-_])/g, '-') : targetId) : '';
};
c3_chart_internal_fn.selectorTarget = function (id) {
- return '.' + CLASS[_target] + this.getTargetSelectorSuffix(id);
+ return '.' + CLASS.target + this.getTargetSelectorSuffix(id);
};
c3_chart_internal_fn.selectorTargets = function (ids) {
var $$ = this;
return ids.length ? ids.map(function (id) { return $$.selectorTarget(id); }) : null;
};
c3_chart_internal_fn.selectorLegend = function (id) {
- return '.' + CLASS[_legendItem] + this.getTargetSelectorSuffix(id);
+ return '.' + CLASS.legendItem + this.getTargetSelectorSuffix(id);
};
c3_chart_internal_fn.selectorLegends = function (ids) {
var $$ = this;
diff --git a/src/core.js b/src/core.js
index e6e76ee..60a6542 100644
--- a/src/core.js
+++ b/src/core.js
@@ -204,7 +204,7 @@ c3_chart_internal_fn.initWithData = function (data) {
// text when empty
main.append("text")
- .attr("class", CLASS[_text] + ' ' + CLASS[_empty])
+ .attr("class", CLASS.text + ' ' + CLASS.empty)
.attr("text-anchor", "middle") // horizontal centering of text at x position in all browsers.
.attr("dominant-baseline", "middle"); // vertical centering of text at y position in all browsers, except IE.
@@ -217,7 +217,7 @@ c3_chart_internal_fn.initWithData = function (data) {
// Define g for chart area
main.append('g')
.attr("clip-path", $$.clipPath)
- .attr('class', CLASS[_chart]);
+ .attr('class', CLASS.chart);
// Cover whole with rects for events
$$.initEventRect();
@@ -237,8 +237,8 @@ c3_chart_internal_fn.initWithData = function (data) {
// if zoom privileged, insert rect to forefront
// TODO: is this needed?
- main.insert('rect', config.zoom_privileged ? null : 'g.' + CLASS[_regions])
- .attr('class', CLASS[_zoomRect])
+ main.insert('rect', config.zoom_privileged ? null : 'g.' + CLASS.regions)
+ .attr('class', CLASS.zoomRect)
.attr('width', $$.width)
.attr('height', $$.height)
.style('opacity', 0)
@@ -394,7 +394,7 @@ c3_chart_internal_fn.updateTargets = function (targets) {
/*-- Show --*/
// Fade-in each chart
- $$.svg.selectAll('.' + CLASS[_target]).filter(function (d) { return $$.isTargetToShow(d.id); })
+ $$.svg.selectAll('.' + CLASS.target).filter(function (d) { return $$.isTargetToShow(d.id); })
.transition().duration(config.transition_duration)
.style("opacity", 1);
};
@@ -470,14 +470,14 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
break;
}
}
- $$.svg.selectAll('.' + CLASS[_axisX] + ' .tick text').each(function (e) {
+ $$.svg.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) {
var index = tickValues.indexOf(e);
if (index >= 0) {
d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block');
}
});
} else {
- $$.svg.selectAll('.' + CLASS[_axisX] + ' .tick text').style('display', 'block');
+ $$.svg.selectAll('.' + CLASS.axisX + ' .tick text').style('display', 'block');
}
}
@@ -504,7 +504,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
$$.updateXgridFocus();
// Data empty label positioning and text.
- main.select("text." + CLASS[_text] + '.' + CLASS[_empty])
+ main.select("text." + CLASS.text + '.' + CLASS.empty)
.attr("x", $$.width / 2)
.attr("y", $$.height / 2)
.text(config.data_empty_label_text)
@@ -539,7 +539,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
}
// circles for select
- main.selectAll('.' + CLASS[_selectedCircles])
+ main.selectAll('.' + CLASS.selectedCircles)
.filter($$.isBarType.bind($$))
.selectAll('circle')
.remove();
@@ -691,26 +691,26 @@ c3_chart_internal_fn.transformMain = function (withTransition, transitions) {
if (transitions && transitions.axisX) {
xAxis = transitions.axisX;
} else {
- xAxis = $$.main.select('.' + CLASS[_axisX]);
+ xAxis = $$.main.select('.' + CLASS.axisX);
if (withTransition) { xAxis = xAxis.transition(); }
}
if (transitions && transitions.axisY) {
yAxis = transitions.axisY;
} else {
- yAxis = $$.main.select('.' + CLASS[_axisY]);
+ yAxis = $$.main.select('.' + CLASS.axisY);
if (withTransition) { yAxis = yAxis.transition(); }
}
if (transitions && transitions.axisY2) {
y2Axis = transitions.axisY2;
} else {
- y2Axis = $$.main.select('.' + CLASS[_axisY2]);
+ y2Axis = $$.main.select('.' + CLASS.axisY2);
if (withTransition) { y2Axis = y2Axis.transition(); }
}
(withTransition ? $$.main.transition() : $$.main).attr("transform", $$.getTranslate('main'));
xAxis.attr("transform", $$.getTranslate('x'));
yAxis.attr("transform", $$.getTranslate('y'));
y2Axis.attr("transform", $$.getTranslate('y2'));
- $$.main.select('.' + CLASS[_chartArcs]).attr("transform", $$.getTranslate('arc'));
+ $$.main.select('.' + CLASS.chartArcs).attr("transform", $$.getTranslate('arc'));
};
c3_chart_internal_fn.transformAll = function (withTransition, transitions) {
var $$ = this;
@@ -735,7 +735,7 @@ c3_chart_internal_fn.updateSvgSize = function () {
.attr('y', $$.getYAxisClipY.bind($$))
.attr('width', $$.getYAxisClipWidth.bind($$))
.attr('height', $$.getYAxisClipHeight.bind($$));
- $$.svg.select('.' + CLASS[_zoomRect])
+ $$.svg.select('.' + CLASS.zoomRect)
.attr('width', $$.width)
.attr('height', $$.height);
// MEMO: parent div's height will be bigger than svg when
diff --git a/src/data.load.js b/src/data.load.js
index 0a5fc05..242bcdd 100644
--- a/src/data.load.js
+++ b/src/data.load.js
@@ -77,7 +77,7 @@ c3_chart_internal_fn.unload = function (targetIds, done) {
$$.withoutFadeIn[id] = false;
// Remove target's elements
if ($$.legend) {
- $$.legend.selectAll('.' + CLASS[_legendItem] + $$.getTargetSelectorSuffix(id)).remove();
+ $$.legend.selectAll('.' + CLASS.legendItem + $$.getTargetSelectorSuffix(id)).remove();
}
// Remove target
$$.data.targets = $$.data.targets.filter(function (t) {
diff --git a/src/drag.js b/src/drag.js
index bd2446a..3f21f3b 100644
--- a/src/drag.js
+++ b/src/drag.js
@@ -16,26 +16,26 @@ c3_chart_internal_fn.drag = function (mouse) {
minY = (config.data_selection_grouped) ? $$.margin.top : Math.min(sy, my);
maxY = (config.data_selection_grouped) ? $$.height : Math.max(sy, my);
- main.select('.' + CLASS[_dragarea])
+ main.select('.' + CLASS.dragarea)
.attr('x', minX)
.attr('y', minY)
.attr('width', maxX - minX)
.attr('height', maxY - minY);
// TODO: binary search when multiple xs
- main.selectAll('.' + CLASS[_shapes]).selectAll('.' + CLASS[_shape])
+ main.selectAll('.' + CLASS.shapes).selectAll('.' + CLASS.shape)
.filter(function (d) { return config.data_selection_isselectable(d); })
.each(function (d, i) {
var shape = d3.select(this),
- isSelected = shape.classed(CLASS[_SELECTED]),
- isIncluded = shape.classed(CLASS[_INCLUDED]),
+ isSelected = shape.classed(CLASS.SELECTED),
+ isIncluded = shape.classed(CLASS.INCLUDED),
_x, _y, _w, _h, toggle, isWithin = false, box;
- if (shape.classed(CLASS[_circle])) {
+ if (shape.classed(CLASS.circle)) {
_x = shape.attr("cx") * 1;
_y = shape.attr("cy") * 1;
toggle = $$.togglePoint;
isWithin = minX < _x && _x < maxX && minY < _y && _y < maxY;
}
- else if (shape.classed(CLASS[_bar])) {
+ else if (shape.classed(CLASS.bar)) {
box = getPathBox(this);
_x = box.x;
_y = box.y;
@@ -48,9 +48,9 @@ c3_chart_internal_fn.drag = function (mouse) {
return;
}
if (isWithin ^ isIncluded) {
- shape.classed(CLASS[_INCLUDED], !isIncluded);
+ shape.classed(CLASS.INCLUDED, !isIncluded);
// TODO: included/unincluded callback here
- shape.classed(CLASS[_SELECTED], !isSelected);
+ shape.classed(CLASS.SELECTED, !isSelected);
toggle.call($$, !isSelected, shape, d, i);
}
});
@@ -61,8 +61,8 @@ c3_chart_internal_fn.dragstart = function (mouse) {
if ($$.hasArcType()) { return; }
if (! config.data_selection_enabled) { return; } // do nothing if not selectable
$$.dragStart = mouse;
- $$.main.select('.' + CLASS[_chart]).append('rect')
- .attr('class', CLASS[_dragarea])
+ $$.main.select('.' + CLASS.chart).append('rect')
+ .attr('class', CLASS.dragarea)
.style('opacity', 0.1);
$$.dragging = true;
$$.config.data_ondragstart();
@@ -72,12 +72,12 @@ c3_chart_internal_fn.dragend = function () {
var $$ = this, config = $$.config;
if ($$.hasArcType()) { return; }
if (! config.data_selection_enabled) { return; } // do nothing if not selectable
- $$.main.select('.' + CLASS[_dragarea])
+ $$.main.select('.' + CLASS.dragarea)
.transition().duration(100)
.style('opacity', 0)
.remove();
- $$.main.selectAll('.' + CLASS[_shape])
- .classed(CLASS[_INCLUDED], false);
+ $$.main.selectAll('.' + CLASS.shape)
+ .classed(CLASS.INCLUDED, false);
$$.dragging = false;
$$.config.data_ondragend();
};
diff --git a/src/grid.js b/src/grid.js
index c76a8ac..31d8962 100644
--- a/src/grid.js
+++ b/src/grid.js
@@ -1,28 +1,28 @@
c3_chart_internal_fn.initGrid = function () {
- var $$ = this, config = $$.config, CLASS = $$.CLASS, d3 = $$.d3;
+ var $$ = this, config = $$.config, d3 = $$.d3;
$$.grid = $$.main.append('g')
.attr("clip-path", $$.clipPath)
- .attr('class', CLASS[_grid]);
+ .attr('class', CLASS.grid);
if (config.grid_x_show) {
- $$.grid.append("g").attr("class", CLASS[_xgrids]);
+ $$.grid.append("g").attr("class", CLASS.xgrids);
}
if (config.grid_y_show) {
- $$.grid.append('g').attr('class', CLASS[_ygrids]);
+ $$.grid.append('g').attr('class', CLASS.ygrids);
}
- $$.grid.append('g').attr("class", CLASS[_xgridLines]);
- $$.grid.append('g').attr('class', CLASS[_ygridLines]);
+ $$.grid.append('g').attr("class", CLASS.xgridLines);
+ $$.grid.append('g').attr('class', CLASS.ygridLines);
if (config.grid_focus_show) {
$$.grid.append('g')
- .attr("class", CLASS[_xgridFocus])
+ .attr("class", CLASS.xgridFocus)
.append('line')
- .attr('class', CLASS[_xgridFocus]);
+ .attr('class', CLASS.xgridFocus);
}
$$.xgrid = d3.selectAll([]);
$$.xgridLines = d3.selectAll([]);
};
c3_chart_internal_fn.updateXGrid = function (withoutUpdate) {
- var $$ = this, config = $$.config, CLASS = $$.CLASS, d3 = $$.d3,
+ var $$ = this, config = $$.config, d3 = $$.d3,
xgridData = $$.generateGridData(config.grid_x_type, $$.x),
tickOffset = $$.isCategorized() ? $$.xAxis.tickOffset() : 0;
@@ -38,9 +38,9 @@ c3_chart_internal_fn.updateXGrid = function (withoutUpdate) {
'y2': $$.height
};
- $$.xgrid = $$.main.select('.' + CLASS[_xgrids]).selectAll('.' + CLASS[_xgrid])
+ $$.xgrid = $$.main.select('.' + CLASS.xgrids).selectAll('.' + CLASS.xgrid)
.data(xgridData);
- $$.xgrid.enter().append('line').attr("class", CLASS[_xgrid]);
+ $$.xgrid.enter().append('line').attr("class", CLASS.xgrid);
if (!withoutUpdate) {
$$.xgrid.attr($$.xgridAttr)
.style("opacity", function () { return +d3.select(this).attr(config.axis_rotated ? 'y1' : 'x1') === (config.axis_rotated ? $$.height : 0) ? 0 : 1; });
@@ -49,11 +49,11 @@ c3_chart_internal_fn.updateXGrid = function (withoutUpdate) {
};
c3_chart_internal_fn.updateYGrid = function () {
- var $$ = this, config = $$.config, CLASS = $$.CLASS;
- $$.ygrid = $$.main.select('.' + CLASS[_ygrids]).selectAll('.' + CLASS[_ygrid])
+ var $$ = this, config = $$.config;
+ $$.ygrid = $$.main.select('.' + CLASS.ygrids).selectAll('.' + CLASS.ygrid)
.data($$.y.ticks(config.grid_y_ticks));
$$.ygrid.enter().append('line')
- .attr('class', CLASS[_ygrid]);
+ .attr('class', CLASS.ygrid);
$$.ygrid.attr("x1", config.axis_rotated ? $$.y : 0)
.attr("x2", config.axis_rotated ? $$.y : $$.width)
.attr("y1", config.axis_rotated ? 0 : $$.y)
@@ -64,17 +64,17 @@ c3_chart_internal_fn.updateYGrid = function () {
c3_chart_internal_fn.redrawGrid = function (duration, withY) {
- var $$ = this, main = $$.main, config = $$.config, CLASS = $$.CLASS,
+ var $$ = this, main = $$.main, config = $$.config,
xgridLine, ygridLine, yv;
- main.select('line.' + CLASS[_xgridFocus]).style("visibility", "hidden");
+ main.select('line.' + CLASS.xgridFocus).style("visibility", "hidden");
if (config.grid_x_show) {
$$.updateXGrid();
}
- $$.xgridLines = main.select('.' + CLASS[_xgridLines]).selectAll('.' + CLASS[_xgridLine])
+ $$.xgridLines = main.select('.' + CLASS.xgridLines).selectAll('.' + CLASS.xgridLine)
.data(config.grid_x_lines);
// enter
xgridLine = $$.xgridLines.enter().append('g')
- .attr("class", function (d) { return CLASS[_xgridLine] + (d.class ? ' ' + d.class : ''); });
+ .attr("class", function (d) { return CLASS.xgridLine + (d.class ? ' ' + d.class : ''); });
xgridLine.append('line')
.style("opacity", 0);
xgridLine.append('text')
@@ -95,11 +95,11 @@ c3_chart_internal_fn.redrawGrid = function (duration, withY) {
$$.updateYGrid();
}
if (withY) {
- $$.ygridLines = main.select('.' + CLASS[_ygridLines]).selectAll('.' + CLASS[_ygridLine])
+ $$.ygridLines = main.select('.' + CLASS.ygridLines).selectAll('.' + CLASS.ygridLine)
.data(config.grid_y_lines);
// enter
ygridLine = $$.ygridLines.enter().append('g')
- .attr("class", function (d) { return CLASS[_ygridLine] + (d.class ? ' ' + d.class : ''); });
+ .attr("class", function (d) { return CLASS.ygridLine + (d.class ? ' ' + d.class : ''); });
ygridLine.append('line')
.style("opacity", 0);
ygridLine.append('text')
@@ -146,7 +146,7 @@ c3_chart_internal_fn.addTransitionForGrid = function (transitions) {
c3_chart_internal_fn.showXGridFocus = function (selectedData) {
var $$ = this, config = $$.config,
dataToShow = selectedData.filter(function (d) { return d && isValue(d.value); }),
- focusEl = $$.main.selectAll('line.' + CLASS[_xgridFocus]),
+ focusEl = $$.main.selectAll('line.' + CLASS.xgridFocus),
xx = $$.xx.bind($$);
if (! config.tooltip_show) { return; }
// Hide when scatter plot exists
@@ -159,11 +159,11 @@ c3_chart_internal_fn.showXGridFocus = function (selectedData) {
$$.smoothLines(focusEl, 'grid');
};
c3_chart_internal_fn.hideXGridFocus = function () {
- this.main.select('line.' + CLASS[_xgridFocus]).style("visibility", "hidden");
+ this.main.select('line.' + CLASS.xgridFocus).style("visibility", "hidden");
};
c3_chart_internal_fn.updateXgridFocus = function () {
var $$ = this, config = $$.config;
- $$.main.select('line.' + CLASS[_xgridFocus])
+ $$.main.select('line.' + CLASS.xgridFocus)
.attr("x1", config.axis_rotated ? 0 : -10)
.attr("x2", config.axis_rotated ? $$.width : -10)
.attr("y1", config.axis_rotated ? -10 : 0)
@@ -172,7 +172,7 @@ c3_chart_internal_fn.updateXgridFocus = function () {
c3_chart_internal_fn.generateGridData = function (type, scale) {
var $$ = this,
gridData = [], xDomain, firstYear, lastYear, i,
- tickNum = $$.main.select("." + CLASS[_axisX]).selectAll('.tick').size();
+ tickNum = $$.main.select("." + CLASS.axisX).selectAll('.tick').size();
if (type === 'year') {
xDomain = $$.getXDomain();
firstYear = xDomain[0].getFullYear();
@@ -203,8 +203,8 @@ c3_chart_internal_fn.removeGridLines = function (params, forX) {
var $$ = this, config = $$.config,
toRemove = $$.getGridFilterToRemove(params),
toShow = function (line) { return !toRemove(line); },
- classLines = forX ? CLASS[_xgridLines] : CLASS[_ygridLines],
- classLine = forX ? CLASS[_xgridLine] : CLASS.ygridLine;
+ classLines = forX ? CLASS.xgridLines : CLASS.ygridLines,
+ classLine = forX ? CLASS.xgridLine : CLASS.ygridLine;
$$.main.select('.' + classLines).selectAll('.' + classLine).filter(toRemove)
.transition().duration(config.transition_duration)
.style('opacity', 0).remove();
diff --git a/src/interaction.js b/src/interaction.js
index 15fec7c..1cf09ce 100644
--- a/src/interaction.js
+++ b/src/interaction.js
@@ -1,25 +1,25 @@
c3_chart_internal_fn.initEventRect = function () {
- var $$ = this, CLASS = $$.CLASS;
- $$.main.select('.' + CLASS[_chart]).append("g")
- .attr("class", CLASS[_eventRects])
+ var $$ = this;
+ $$.main.select('.' + CLASS.chart).append("g")
+ .attr("class", CLASS.eventRects)
.style('fill-opacity', 0);
};
c3_chart_internal_fn.redrawEventRect = function () {
- var $$ = this, config = $$.config, CLASS = $$.CLASS,
+ var $$ = this, config = $$.config,
eventRectUpdate, maxDataCountTarget,
isMultipleX = $$.isMultipleX();
// rects for mouseover
- var eventRects = $$.main.select('.' + CLASS[_eventRects])
+ var eventRects = $$.main.select('.' + CLASS.eventRects)
.style('cursor', config.zoom_enabled ? config.axis_rotated ? 'ns-resize' : 'ew-resize' : null)
- .classed(CLASS[_eventRectsMultiple], isMultipleX)
- .classed(CLASS[_eventRectsSingle], !isMultipleX);
+ .classed(CLASS.eventRectsMultiple, isMultipleX)
+ .classed(CLASS.eventRectsSingle, !isMultipleX);
// clear old rects
- eventRects.selectAll('.' + CLASS[_eventRect]).remove();
+ eventRects.selectAll('.' + CLASS.eventRect).remove();
// open as public variable
- $$.eventRect = eventRects.selectAll('.' + CLASS[_eventRect]);
+ $$.eventRect = eventRects.selectAll('.' + CLASS.eventRect);
if (isMultipleX) {
eventRectUpdate = $$.eventRect.data([0]);
@@ -33,7 +33,7 @@ c3_chart_internal_fn.redrawEventRect = function () {
// Set data and update $$.eventRect
maxDataCountTarget = $$.getMaxDataCountTarget($$.data.targets);
eventRects.datum(maxDataCountTarget ? maxDataCountTarget.values : []);
- $$.eventRect = eventRects.selectAll('.' + CLASS[_eventRect]);
+ $$.eventRect = eventRects.selectAll('.' + CLASS.eventRect);
eventRectUpdate = $$.eventRect.data(function (d) { return d; });
// enter
$$.generateEventRectsForSingleX(eventRectUpdate.enter());
@@ -120,7 +120,7 @@ c3_chart_internal_fn.generateEventRectsForSingleX = function (eventRectEnter) {
$$.expandBars(index);
// Call event handler
- $$.main.selectAll('.' + CLASS[_shape] + '-' + index).each(function (d) {
+ $$.main.selectAll('.' + CLASS.shape + '-' + index).each(function (d) {
config.data_onmouseover.call($$, d);
});
})
@@ -133,13 +133,13 @@ c3_chart_internal_fn.generateEventRectsForSingleX = function (eventRectEnter) {
$$.unexpandCircles(index);
$$.unexpandBars();
// Call event handler
- $$.main.selectAll('.' + CLASS[_shape] + '-' + index).each(function (d) {
+ $$.main.selectAll('.' + CLASS.shape + '-' + index).each(function (d) {
config.data_onmouseout.call($$, d);
});
})
.on('mousemove', function (d) {
var selectedData, index = d.index,
- eventRect = $$.svg.select('.' + CLASS[_eventRect] + '-' + index);
+ eventRect = $$.svg.select('.' + CLASS.eventRect + '-' + index);
if ($$.dragging) { return; } // do nothing when dragging
if ($$.hasArcType()) { return; }
@@ -158,9 +158,9 @@ c3_chart_internal_fn.generateEventRectsForSingleX = function (eventRectEnter) {
return;
}
- $$.main.selectAll('.' + CLASS[_shape] + '-' + index)
+ $$.main.selectAll('.' + CLASS.shape + '-' + index)
.each(function () {
- d3.select(this).classed(CLASS[_EXPANDED], true);
+ d3.select(this).classed(CLASS.EXPANDED, true);
if (config.data_selection_enabled) {
eventRect.style('cursor', config.data_selection_grouped ? 'pointer' : null);
}
@@ -200,7 +200,7 @@ c3_chart_internal_fn.generateEventRectsForSingleX = function (eventRectEnter) {
$$.cancelClick = false;
return;
}
- $$.main.selectAll('.' + CLASS[_shape] + '-' + index).each(function (d) {
+ $$.main.selectAll('.' + CLASS.shape + '-' + index).each(function (d) {
$$.toggleShape(this, d, index);
});
})
@@ -220,7 +220,7 @@ c3_chart_internal_fn.generateEventRectsForMultipleXs = function (eventRectEnter)
.attr('y', 0)
.attr('width', $$.width)
.attr('height', $$.height)
- .attr('class', CLASS[_eventRect])
+ .attr('class', CLASS.eventRect)
.on('mouseout', function () {
if ($$.hasArcType()) { return; }
$$.hideXGridFocus();
@@ -262,13 +262,13 @@ c3_chart_internal_fn.generateEventRectsForMultipleXs = function (eventRectEnter)
// Show cursor as pointer if point is close to mouse position
if ($$.dist(closest, mouse) < 100) {
- $$.svg.select('.' + CLASS[_eventRect]).style('cursor', 'pointer');
+ $$.svg.select('.' + CLASS.eventRect).style('cursor', 'pointer');
if (!$$.mouseover) {
config.data_onmouseover.call($$, closest);
$$.mouseover = true;
}
} else if ($$.mouseover) {
- $$.svg.select('.' + CLASS[_eventRect]).style('cursor', null);
+ $$.svg.select('.' + CLASS.eventRect).style('cursor', null);
config.data_onmouseout.call($$, closest);
$$.mouseover = false;
}
@@ -286,7 +286,7 @@ c3_chart_internal_fn.generateEventRectsForMultipleXs = function (eventRectEnter)
// select if selection enabled
if ($$.dist(closest, mouse) < 100 && $$.toggleShape) {
- $$.main.select('.' + CLASS[_circles] + $$.getTargetSelectorSuffix(closest.id)).select('.' + CLASS[_circle] + '-' + closest.index).each(function () {
+ $$.main.select('.' + CLASS.circles + $$.getTargetSelectorSuffix(closest.id)).select('.' + CLASS.circle + '-' + closest.index).each(function () {
$$.toggleShape(this, closest, closest.index);
});
}
diff --git a/src/legend.js b/src/legend.js
index 85f0288..b9e7b4c 100644
--- a/src/legend.js
+++ b/src/legend.js
@@ -53,15 +53,15 @@ c3_chart_internal_fn.getLegendHeight = function () {
};
c3_chart_internal_fn.opacityForLegend = function (legendItem) {
var $$ = this;
- return legendItem.classed(CLASS[_legendItemHidden]) ? $$.legendOpacityForHidden : 1;
+ return legendItem.classed(CLASS.legendItemHidden) ? $$.legendOpacityForHidden : 1;
};
c3_chart_internal_fn.opacityForUnfocusedLegend = function (legendItem) {
var $$ = this;
- return legendItem.classed(CLASS[_legendItemHidden]) ? $$.legendOpacityForHidden : 0.3;
+ return legendItem.classed(CLASS.legendItemHidden) ? $$.legendOpacityForHidden : 0.3;
};
c3_chart_internal_fn.toggleFocusLegend = function (id, focus) {
var $$ = this;
- $$.legend.selectAll('.' + CLASS[_legendItem])
+ $$.legend.selectAll('.' + CLASS.legendItem)
.transition().duration(100)
.style('opacity', function (_id) {
var This = $$.d3.select(this);
@@ -74,7 +74,7 @@ c3_chart_internal_fn.toggleFocusLegend = function (id, focus) {
};
c3_chart_internal_fn.revertLegend = function () {
var $$ = this, d3 = $$.d3;
- $$.legend.selectAll('.' + CLASS[_legendItem])
+ $$.legend.selectAll('.' + CLASS.legendItem)
.transition().duration(100)
.style('opacity', function () { return $$.opacityForLegend(d3.select(this)); });
};
@@ -107,7 +107,7 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
var paddingTop = 4, paddingRight = 36, maxWidth = 0, maxHeight = 0, posMin = 10;
var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0;
var withTransition, withTransitionForTransform;
- var hasFocused = $$.legend.selectAll('.' + CLASS[_legendItemFocused]).size();
+ var hasFocused = $$.legend.selectAll('.' + CLASS.legendItemFocused).size();
var texts, rects, tiles;
options = options || {};
@@ -115,7 +115,7 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
withTransitionForTransform = getOption(options, "withTransitionForTransform", true);
function updatePositions(textElement, id, reset) {
- var box = $$.getTextRect(textElement.textContent, CLASS[_legendItem]),
+ var box = $$.getTextRect(textElement.textContent, CLASS.legendItem),
itemWidth = Math.ceil((box.width + paddingRight) / 10) * 10,
itemHeight = Math.ceil((box.height + paddingTop) / 10) * 10,
itemLength = $$.isLegendRight || $$.isLegendInset ? itemHeight : itemWidth,
@@ -190,17 +190,17 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
yForLegendRect = function (id, i) { return yForLegend(id, i) - 7; };
// Define g for legend area
- l = $$.legend.selectAll('.' + CLASS[_legendItem])
+ l = $$.legend.selectAll('.' + CLASS.legendItem)
.data(targetIds)
.enter().append('g')
- .attr('class', function (id) { return $$.generateClass(CLASS[_legendItem], id); })
+ .attr('class', function (id) { return $$.generateClass(CLASS.legendItem, id); })
.style('visibility', function (id) { return $$.isLegendToShow(id) ? 'visible' : 'hidden'; })
.style('cursor', 'pointer')
.on('click', function (id) {
config.legend_item_onclick ? config.legend_item_onclick.call($$, id) : $$.api.toggle(id);
})
.on('mouseover', function (id) {
- $$.d3.select(this).classed(CLASS[_legendItemFocused], true);
+ $$.d3.select(this).classed(CLASS.legendItemFocused, true);
if (!$$.transiting) {
$$.api.focus(id);
}
@@ -209,7 +209,7 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
}
})
.on('mouseout', function (id) {
- $$.d3.select(this).classed(CLASS[_legendItemFocused], false);
+ $$.d3.select(this).classed(CLASS.legendItemFocused, false);
if (!$$.transiting) {
$$.api.revert();
}
@@ -224,12 +224,12 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
.attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendText : -200)
.attr('y', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendText);
l.append('rect')
- .attr("class", CLASS[_legendItemEvent])
+ .attr("class", CLASS.legendItemEvent)
.style('fill-opacity', 0)
.attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendRect : -200)
.attr('y', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendRect);
l.append('rect')
- .attr("class", CLASS[_legendItemTile])
+ .attr("class", CLASS.legendItemTile)
.style("pointer-events", "none")
.style('fill', $$.color)
.attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendText : -200)
@@ -238,8 +238,8 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
.attr('height', 10);
// Set background for inset legend
if ($$.isLegendInset && maxWidth !== 0) {
- $$.legend.insert('g', '.' + CLASS[_legendItem])
- .attr("class", CLASS[_legendBackground])
+ $$.legend.insert('g', '.' + CLASS.legendItem)
+ .attr("class", CLASS.legendBackground)
.append('rect')
.attr('height', $$.getLegendHeight() - 10)
.attr('width', maxWidth * (step + 1) + 10);
@@ -253,7 +253,7 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
.attr('x', xForLegendText)
.attr('y', yForLegendText);
- rects = $$.legend.selectAll('rect.' + CLASS[_legendItemEvent])
+ rects = $$.legend.selectAll('rect.' + CLASS.legendItemEvent)
.data(targetIds);
(withTransition ? rects.transition() : rects)
.attr('width', function (id) { return widths[id]; })
@@ -261,7 +261,7 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
.attr('x', xForLegendRect)
.attr('y', yForLegendRect);
- tiles = $$.legend.selectAll('rect.' + CLASS[_legendItemTile])
+ tiles = $$.legend.selectAll('rect.' + CLASS.legendItemTile)
.data(targetIds);
(withTransition ? tiles.transition() : tiles)
.style('fill', $$.color)
@@ -269,13 +269,13 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
.attr('y', yForLegend);
// toggle legend state
- $$.legend.selectAll('.' + CLASS[_legendItem])
- .classed(CLASS[_legendItemHidden], function (id) { return !$$.isTargetToShow(id); })
+ $$.legend.selectAll('.' + CLASS.legendItem)
+ .classed(CLASS.legendItemHidden, function (id) { return !$$.isTargetToShow(id); })
.transition()
.style('opacity', function (id) {
var This = $$.d3.select(this);
if ($$.isTargetToShow(id)) {
- return !hasFocused || This.classed(CLASS[_legendItemFocused]) ? $$.opacityForLegend(This) : $$.opacityForUnfocusedLegend(This);
+ return !hasFocused || This.classed(CLASS.legendItemFocused) ? $$.opacityForLegend(This) : $$.opacityForUnfocusedLegend(This);
} else {
return $$.legendOpacityForHidden;
}
diff --git a/src/region.js b/src/region.js
index f6a9601..7bdb46b 100644
--- a/src/region.js
+++ b/src/region.js
@@ -1,12 +1,12 @@
c3_chart_internal_fn.initRegion = function () {
- var $$ = this, CLASS = $$.CLASS;
+ var $$ = this;
$$.main.append('g')
.attr("clip-path", $$.clipPath)
- .attr("class", CLASS[_regions]);
+ .attr("class", CLASS.regions);
};
c3_chart_internal_fn.redrawRegion = function (duration) {
- var $$ = this, config = $$.config, CLASS = $$.CLASS;
- $$.mainRegion = $$.main.select('.' + CLASS[_regions]).selectAll('.' + CLASS[_region])
+ var $$ = this, config = $$.config;
+ $$.mainRegion = $$.main.select('.' + CLASS.regions).selectAll('.' + CLASS.region)
.data(config.regions);
$$.mainRegion.enter().append('g')
.attr('class', $$.classRegion.bind($$))
diff --git a/src/selection.js b/src/selection.js
index 6746087..b131bb0 100644
--- a/src/selection.js
+++ b/src/selection.js
@@ -5,10 +5,10 @@ c3_chart_internal_fn.selectPoint = function (target, d, i) {
r = $$.pointSelectR.bind($$);
config.data_onselected.call($$.api, d, target.node());
// add selected-circle on low layer g
- $$.main.select('.' + CLASS[_selectedCircles] + $$.getTargetSelectorSuffix(d.id)).selectAll('.' + CLASS[_selectedCircle] + '-' + i)
+ $$.main.select('.' + CLASS.selectedCircles + $$.getTargetSelectorSuffix(d.id)).selectAll('.' + CLASS.selectedCircle + '-' + i)
.data([d])
.enter().append('circle')
- .attr("class", function () { return $$.generateClass(CLASS[_selectedCircle], i); })
+ .attr("class", function () { return $$.generateClass(CLASS.selectedCircle, i); })
.attr("cx", cx)
.attr("cy", cy)
.attr("stroke", function () { return $$.color(d); })
@@ -20,7 +20,7 @@ c3_chart_internal_fn.unselectPoint = function (target, d, i) {
var $$ = this;
$$.config.data_onunselected(d, target.node());
// remove selected-circle from low layer g
- $$.main.select('.' + CLASS[_selectedCircles] + $$.getTargetSelectorSuffix(d.id)).selectAll('.' + CLASS[_selectedCircle] + '-' + i)
+ $$.main.select('.' + CLASS.selectedCircles + $$.getTargetSelectorSuffix(d.id)).selectAll('.' + CLASS.selectedCircle + '-' + i)
.transition().duration(100).attr('r', 0)
.remove();
};
@@ -48,17 +48,17 @@ c3_chart_internal_fn.toggleArc = function (selected, target, d, i) {
c3_chart_internal_fn.getToggle = function (that) {
var $$ = this;
// path selection not supported yet
- return that.nodeName === 'circle' ? $$.togglePoint : ($$.d3.select(that).classed(CLASS[_bar]) ? $$.toggleBar : $$.toggleArc);
+ return that.nodeName === 'circle' ? $$.togglePoint : ($$.d3.select(that).classed(CLASS.bar) ? $$.toggleBar : $$.toggleArc);
};
c3_chart_internal_fn.toggleShape = function (that, d, i) {
var $$ = this, d3 = $$.d3, config = $$.config,
- shape = d3.select(that), isSelected = shape.classed(CLASS[_SELECTED]), isWithin, toggle;
+ shape = d3.select(that), isSelected = shape.classed(CLASS.SELECTED), isWithin, toggle;
if (that.nodeName === 'circle') {
isWithin = $$.isWithinCircle(that, $$.pointSelectR(d) * 1.5);
toggle = $$.togglePoint;
}
else if (that.nodeName === 'path') {
- if (shape.classed(CLASS[_bar])) {
+ if (shape.classed(CLASS.bar)) {
isWithin = $$.isWithinBar(that);
toggle = $$.toggleBar;
} else { // would be arc
@@ -69,12 +69,12 @@ c3_chart_internal_fn.toggleShape = function (that, d, i) {
if (config.data_selection_grouped || isWithin) {
if (config.data_selection_enabled && config.data_selection_isselectable(d)) {
if (!config.data_selection_multiple) {
- $$.main.selectAll('.' + CLASS[_shapes] + (config.data_selection_grouped ? $$.getTargetSelectorSuffix(d.id) : "")).selectAll('.' + CLASS[_shape]).each(function (d, i) {
+ $$.main.selectAll('.' + CLASS.shapes + (config.data_selection_grouped ? $$.getTargetSelectorSuffix(d.id) : "")).selectAll('.' + CLASS.shape).each(function (d, i) {
var shape = d3.select(this);
- if (shape.classed(CLASS[_SELECTED])) { toggle.call($$, false, shape.classed(CLASS[_SELECTED], false), d, i); }
+ if (shape.classed(CLASS.SELECTED)) { toggle.call($$, false, shape.classed(CLASS.SELECTED, false), d, i); }
});
}
- shape.classed(CLASS[_SELECTED], !isSelected);
+ shape.classed(CLASS.SELECTED, !isSelected);
toggle.call($$, !isSelected, shape, d, i);
}
$$.config.data_onclick.call($$.api, d, that);
diff --git a/src/shape.bar.js b/src/shape.bar.js
index 195eeb2..4e8c0da 100644
--- a/src/shape.bar.js
+++ b/src/shape.bar.js
@@ -1,14 +1,14 @@
c3_chart_internal_fn.initBar = function () {
- var $$ = this, CLASS = $$.CLASS;
- $$.main.select('.' + CLASS[_chart]).append("g")
- .attr("class", CLASS[_chartBars]);
+ var $$ = this;
+ $$.main.select('.' + CLASS.chart).append("g")
+ .attr("class", CLASS.chartBars);
};
c3_chart_internal_fn.updateTargetsForBar = function (targets) {
- var $$ = this, config = $$.config, CLASS = $$.CLASS,
+ var $$ = this, config = $$.config,
mainBarUpdate, mainBarEnter,
classChartBar = $$.classChartBar.bind($$),
classBars = $$.classBars.bind($$);
- mainBarUpdate = $$.main.select('.' + CLASS[_chartBars]).selectAll('.' + CLASS[_chartBar])
+ mainBarUpdate = $$.main.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar)
.data(targets)
.attr('class', classChartBar);
mainBarEnter = mainBarUpdate.enter().append('g')
@@ -22,12 +22,12 @@ c3_chart_internal_fn.updateTargetsForBar = function (targets) {
};
c3_chart_internal_fn.redrawBar = function (durationForExit) {
- var $$ = this, CLASS = $$.CLASS,
+ var $$ = this,
barData = $$.barData.bind($$),
classBar = $$.classBar.bind($$),
initialOpacity = $$.initialOpacity.bind($$),
color = function (d) { return $$.color(d.id); };
- $$.mainBar = $$.main.selectAll('.' + CLASS[_bars]).selectAll('.' + CLASS[_bar])
+ $$.mainBar = $$.main.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar)
.data(barData);
$$.mainBar.enter().append('path')
.attr("class", classBar)
@@ -53,15 +53,15 @@ c3_chart_internal_fn.getBarW = function (axis, barTargetsNum) {
};
c3_chart_internal_fn.getBars = function (i) {
var $$ = this;
- return $$.main.selectAll('.' + CLASS[_bar] + (isValue(i) ? '-' + i : ''));
+ return $$.main.selectAll('.' + CLASS.bar + (isValue(i) ? '-' + i : ''));
};
c3_chart_internal_fn.expandBars = function (i) {
var $$ = this;
- $$.getBars(i).classed(CLASS[_EXPANDED], true);
+ $$.getBars(i).classed(CLASS.EXPANDED, true);
};
c3_chart_internal_fn.unexpandBars = function (i) {
var $$ = this;
- $$.getBars(i).classed(CLASS[_EXPANDED], false);
+ $$.getBars(i).classed(CLASS.EXPANDED, false);
};
c3_chart_internal_fn.generateDrawBar = function (barIndices, isSub) {
var $$ = this, config = $$.config,
diff --git a/src/shape.line.js b/src/shape.line.js
index 7b55175..27d0e3f 100644
--- a/src/shape.line.js
+++ b/src/shape.line.js
@@ -1,16 +1,16 @@
c3_chart_internal_fn.initLine = function () {
- var $$ = this, CLASS = $$.CLASS;
- $$.main.select('.' + CLASS[_chart]).append("g")
- .attr("class", CLASS[_chartLines]);
+ var $$ = this;
+ $$.main.select('.' + CLASS.chart).append("g")
+ .attr("class", CLASS.chartLines);
};
c3_chart_internal_fn.updateTargetsForLine = function (targets) {
- var $$ = this, config = $$.config, CLASS = $$.CLASS,
+ var $$ = this, config = $$.config,
mainLineUpdate, mainLineEnter,
classChartLine = $$.classChartLine.bind($$),
classLines = $$.classLines.bind($$),
classAreas = $$.classAreas.bind($$),
classCircles = $$.classCircles.bind($$);
- mainLineUpdate = $$.main.select('.' + CLASS[_chartLines]).selectAll('.' + CLASS[_chartLine])
+ mainLineUpdate = $$.main.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine)
.data(targets)
.attr('class', classChartLine);
mainLineEnter = mainLineUpdate.enter().append('g')
@@ -25,13 +25,13 @@ c3_chart_internal_fn.updateTargetsForLine = function (targets) {
.attr('class', classAreas);
// Circles for each data point on lines
mainLineEnter.append('g')
- .attr("class", function (d) { return $$.generateClass(CLASS[_selectedCircles], d.id); });
+ .attr("class", function (d) { return $$.generateClass(CLASS.selectedCircles, d.id); });
mainLineEnter.append('g')
.attr("class", classCircles)
.style("cursor", function (d) { return config.data_selection_isselectable(d) ? "pointer" : null; });
// Update date for selected circles
targets.forEach(function (t) {
- $$.main.selectAll('.' + CLASS[_selectedCircles] + $$.getTargetSelectorSuffix(t.id)).selectAll('.' + CLASS[_selectedCircle]).each(function (d) {
+ $$.main.selectAll('.' + CLASS.selectedCircles + $$.getTargetSelectorSuffix(t.id)).selectAll('.' + CLASS.selectedCircle).each(function (d) {
d.value = t.values[d.index].value;
});
});
@@ -39,8 +39,8 @@ c3_chart_internal_fn.updateTargetsForLine = function (targets) {
//mainLineUpdate.exit().remove();
};
c3_chart_internal_fn.redrawLine = function (durationForExit) {
- var $$ = this, CLASS = $$.CLASS;
- $$.mainLine = $$.main.selectAll('.' + CLASS[_lines]).selectAll('.' + CLASS[_line])
+ var $$ = this;
+ $$.mainLine = $$.main.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line)
.data($$.lineData.bind($$));
$$.mainLine.enter().append('path')
.attr('class', $$.classLine.bind($$))
@@ -194,8 +194,8 @@ c3_chart_internal_fn.lineWithRegions = function (d, x, y, _regions) {
c3_chart_internal_fn.redrawArea = function (durationForExit) {
- var $$ = this, CLASS = $$.CLASS, d3 = $$.d3;
- $$.mainArea = $$.main.selectAll('.' + CLASS[_areas]).selectAll('.' + CLASS[_area])
+ var $$ = this, d3 = $$.d3;
+ $$.mainArea = $$.main.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area)
.data($$.lineData.bind($$));
$$.mainArea.enter().append('path')
.attr("class", $$.classArea.bind($$))
@@ -271,8 +271,8 @@ c3_chart_internal_fn.generateGetAreaPoint = function (areaIndices, isSub) { // p
c3_chart_internal_fn.redrawCircle = function () {
- var $$ = this, CLASS = $$.CLASS;
- $$.mainCircle = $$.main.selectAll('.' + CLASS[_circles]).selectAll('.' + CLASS[_circle])
+ var $$ = this;
+ $$.mainCircle = $$.main.selectAll('.' + CLASS.circles).selectAll('.' + CLASS.circle)
.data($$.lineOrScatterData.bind($$));
$$.mainCircle.enter().append("circle")
.attr("class", $$.classCircle.bind($$))
@@ -289,7 +289,7 @@ c3_chart_internal_fn.addTransitionForCircle = function (transitions, cx, cy) {
.style("fill", $$.color)
.attr("cx", cx)
.attr("cy", cy));
- transitions.push($$.main.selectAll('.' + CLASS[_selectedCircle]).transition()
+ transitions.push($$.main.selectAll('.' + CLASS.selectedCircle).transition()
.attr("cx", cx)
.attr("cy", cy));
};
@@ -303,21 +303,21 @@ c3_chart_internal_fn.circleY = function (d, i) {
};
c3_chart_internal_fn.getCircles = function (i, id) {
var $$ = this;
- return (id ? $$.main.selectAll('.' + CLASS[_circles] + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS[_circle] + (isValue(i) ? '-' + i : ''));
+ return (id ? $$.main.selectAll('.' + CLASS.circles + $$.getTargetSelectorSuffix(id)) : $$.main).selectAll('.' + CLASS.circle + (isValue(i) ? '-' + i : ''));
};
c3_chart_internal_fn.expandCircles = function (i, id) {
var $$ = this,
r = $$.pointExpandedR.bind($$);
$$.getCircles(i, id)
- .classed(CLASS[_EXPANDED], true)
+ .classed(CLASS.EXPANDED, true)
.attr('r', r);
};
c3_chart_internal_fn.unexpandCircles = function (i) {
var $$ = this,
r = $$.pointR.bind($$);
$$.getCircles(i)
- .filter(function () { return $$.d3.select(this).classed(CLASS[_EXPANDED]); })
- .classed(CLASS[_EXPANDED], false)
+ .filter(function () { return $$.d3.select(this).classed(CLASS.EXPANDED); })
+ .classed(CLASS.EXPANDED, false)
.attr('r', r);
};
c3_chart_internal_fn.pointR = function (d) {
diff --git a/src/size.js b/src/size.js
index 9c12c79..d29f7c8 100644
--- a/src/size.js
+++ b/src/size.js
@@ -59,7 +59,7 @@ c3_chart_internal_fn.getParentHeight = function () {
c3_chart_internal_fn.getSvgLeft = function () {
var $$ = this, config = $$.config,
- leftAxisClass = config.axis_rotated ? CLASS[_axisX] : CLASS[_axisY],
+ leftAxisClass = config.axis_rotated ? CLASS.axisX : CLASS.axisY,
leftAxis = $$.main.select('.' + leftAxisClass).node(),
svgRect = leftAxis ? leftAxis.getBoundingClientRect() : {right: 0},
chartRect = $$.selectChart.node().getBoundingClientRect(),
diff --git a/src/subchart.js b/src/subchart.js
index da089de..5602b0b 100644
--- a/src/subchart.js
+++ b/src/subchart.js
@@ -2,7 +2,7 @@ c3_chart_internal_fn.initBrush = function () {
var $$ = this, d3 = $$.d3;
$$.brush = d3.svg.brush().on("brush", function () { $$.redrawForBrush(); });
$$.brush.update = function () {
- if ($$.context) { $$.context.select('.' + $$.CLASS[_brush]).call(this); }
+ if ($$.context) { $$.context.select('.' + CLASS.brush).call(this); }
return this;
};
$$.brush.scale = function (scale) {
@@ -20,20 +20,20 @@ c3_chart_internal_fn.initSubchart = function () {
// Define g for chart area
context.append('g')
.attr("clip-path", $$.clipPath)
- .attr('class', CLASS[_chart]);
+ .attr('class', CLASS.chart);
// Define g for bar chart area
- context.select('.' + CLASS[_chart]).append("g")
- .attr("class", CLASS[_chartBars]);
+ context.select('.' + CLASS.chart).append("g")
+ .attr("class", CLASS.chartBars);
// Define g for line chart area
- context.select('.' + CLASS[_chart]).append("g")
- .attr("class", CLASS[_chartLines]);
+ context.select('.' + CLASS.chart).append("g")
+ .attr("class", CLASS.chartLines);
// Add extent rect for Brush
context.append("g")
.attr("clip-path", $$.clipPath)
- .attr("class", CLASS[_brush])
+ .attr("class", CLASS.brush)
.call($$.brush)
.selectAll("rect")
.attr(config.axis_rotated ? "width" : "height", config.axis_rotated ? $$.width2 : $$.height2);
@@ -41,7 +41,7 @@ c3_chart_internal_fn.initSubchart = function () {
// ATTENTION: This must be called AFTER chart added
// Add Axis
$$.axes.subx = context.append("g")
- .attr("class", CLASS[_axisX])
+ .attr("class", CLASS.axisX)
.attr("transform", $$.getTranslate('subx'))
.attr("clip-path", config.axis_rotated ? "" : $$.clipPathForXAxis);
};
@@ -55,7 +55,7 @@ c3_chart_internal_fn.updateTargetsForSubchart = function (targets) {
classAreas = $$.classAreas.bind($$);
if (config.subchart_show) {
- contextBarUpdate = context.select('.' + CLASS[_chartBars]).selectAll('.' + CLASS[_chartBar])
+ contextBarUpdate = context.select('.' + CLASS.chartBars).selectAll('.' + CLASS.chartBar)
.data(targets)
.attr('class', classChartBar);
contextBarEnter = contextBarUpdate.enter().append('g')
@@ -66,7 +66,7 @@ c3_chart_internal_fn.updateTargetsForSubchart = function (targets) {
.attr("class", classBars);
//-- Line --//
- contextLineUpdate = context.select('.' + CLASS[_chartLines]).selectAll('.' + CLASS[_chartLine])
+ contextLineUpdate = context.select('.' + CLASS.chartLines).selectAll('.' + CLASS.chartLine)
.data(targets)
.attr('class', classChartLine);
contextLineEnter = contextLineUpdate.enter().append('g')
@@ -113,7 +113,7 @@ c3_chart_internal_fn.redrawSubchart = function (withSubchart, transitions, durat
drawBarOnSub = $$.generateDrawBar(barIndices, true);
drawLineOnSub = $$.generateDrawLine(lineIndices, true);
// bars
- contextBar = context.selectAll('.' + CLASS[_bars]).selectAll('.' + CLASS[_bar])
+ contextBar = context.selectAll('.' + CLASS.bars).selectAll('.' + CLASS.bar)
.data(barData);
contextBar.enter().append('path')
.attr("class", classBar)
@@ -128,7 +128,7 @@ c3_chart_internal_fn.redrawSubchart = function (withSubchart, transitions, durat
.style('opacity', 0)
.remove();
// lines
- contextLine = context.selectAll('.' + CLASS[_lines]).selectAll('.' + CLASS[_line])
+ contextLine = context.selectAll('.' + CLASS.lines).selectAll('.' + CLASS.line)
.data(lineData);
contextLine.enter().append('path')
.attr('class', classLine)
@@ -142,7 +142,7 @@ c3_chart_internal_fn.redrawSubchart = function (withSubchart, transitions, durat
.style('opacity', 0)
.remove();
// area
- contextArea = context.selectAll('.' + CLASS[_areas]).selectAll('.' + CLASS[_area])
+ contextArea = context.selectAll('.' + CLASS.areas).selectAll('.' + CLASS.area)
.data(lineData);
contextArea.enter().append('path')
.attr("class", classArea)
@@ -175,7 +175,7 @@ c3_chart_internal_fn.transformContext = function (withTransition, transitions) {
if (transitions && transitions.axisSubX) {
subXAxis = transitions.axisSubX;
} else {
- subXAxis = $$.context.select('.' + CLASS[_axisX]);
+ subXAxis = $$.context.select('.' + CLASS.axisX);
if (withTransition) { subXAxis = subXAxis.transition(); }
}
$$.context.attr("transform", $$.getTranslate('context'));
diff --git a/src/text.js b/src/text.js
index 55a2615..351d027 100644
--- a/src/text.js
+++ b/src/text.js
@@ -1,14 +1,14 @@
c3_chart_internal_fn.initText = function () {
- var $$ = this, CLASS = $$.CLASS;
- $$.main.select('.' + CLASS[_chart]).append("g")
- .attr("class", CLASS[_chartTexts]);
+ var $$ = this;
+ $$.main.select('.' + CLASS.chart).append("g")
+ .attr("class", CLASS.chartTexts);
$$.mainText = $$.d3.selectAll([]);
};
c3_chart_internal_fn.updateTargetsForText = function (targets) {
- var $$ = this, CLASS = $$.CLASS, mainTextUpdate, mainTextEnter,
+ var $$ = this, mainTextUpdate, mainTextEnter,
classChartText = $$.classChartText.bind($$),
classTexts = $$.classTexts.bind($$);
- mainTextUpdate = $$.main.select('.' + CLASS[_chartTexts]).selectAll('.' + CLASS[_chartText])
+ mainTextUpdate = $$.main.select('.' + CLASS.chartTexts).selectAll('.' + CLASS.chartText)
.data(targets)
.attr('class', classChartText);
mainTextEnter = mainTextUpdate.enter().append('g')
@@ -19,10 +19,10 @@ c3_chart_internal_fn.updateTargetsForText = function (targets) {
.attr('class', classTexts);
};
c3_chart_internal_fn.redrawText = function (durationForExit) {
- var $$ = this, config = $$.config, CLASS = $$.CLASS,
+ var $$ = this, config = $$.config,
barOrLineData = $$.barOrLineData.bind($$),
classText = $$.classText.bind($$);
- $$.mainText = $$.main.selectAll('.' + CLASS[_texts]).selectAll('.' + CLASS[_text])
+ $$.mainText = $$.main.selectAll('.' + CLASS.texts).selectAll('.' + CLASS.text)
.data(barOrLineData);
$$.mainText.enter().append('text')
.attr("class", classText)
diff --git a/src/tooltip.js b/src/tooltip.js
index c960f8b..1603993 100644
--- a/src/tooltip.js
+++ b/src/tooltip.js
@@ -35,14 +35,14 @@ c3_chart_internal_fn.getTooltipContent = function (d, defaultTitleFormat, defaul
if (! text) {
title = titleFormat ? titleFormat(d[i].x) : d[i].x;
- text = "