Commit 6ea5dbc6 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix class ref name

parent 39afb5e8
...@@ -395,14 +395,14 @@ ...@@ -395,14 +395,14 @@
if (! text) { if (! text) {
title = titleFormat ? titleFormat(d[i].x) : d[i].x; title = titleFormat ? titleFormat(d[i].x) : d[i].x;
text = "<table class='" + CLASS[tooltip] + "'>" + (title || title === 0 ? "<tr><th colspan='2'>" + title + "</th></tr>" : ""); text = "<table class='" + CLASS[_tooltip] + "'>" + (title || title === 0 ? "<tr><th colspan='2'>" + title + "</th></tr>" : "");
} }
name = nameFormat(d[i].name); name = nameFormat(d[i].name);
value = valueFormat(d[i].value, d[i].ratio, d[i].id, d[i].index); value = valueFormat(d[i].value, d[i].ratio, d[i].id, d[i].index);
bgcolor = $$.levelColor ? $$.levelColor(d[i].value) : color(d[i].id); bgcolor = $$.levelColor ? $$.levelColor(d[i].value) : color(d[i].id);
text += "<tr class='" + CLASS[tooltipName] + "-" + d[i].id + "'>"; text += "<tr class='" + CLASS[_tooltipName] + "-" + d[i].id + "'>";
text += "<td class='name'><span style='background-color:" + bgcolor + "'></span>" + name + "</td>"; text += "<td class='name'><span style='background-color:" + bgcolor + "'></span>" + name + "</td>";
text += "<td class='value'>" + value + "</td>"; text += "<td class='value'>" + value + "</td>";
text += "</tr>"; text += "</tr>";
...@@ -660,51 +660,51 @@ ...@@ -660,51 +660,51 @@
// text when empty // text when empty
main.append("text") 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("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. .attr("dominant-baseline", "middle"); // vertical centering of text at y position in all browsers, except IE.
// Regions // Regions
main.append('g') main.append('g')
.attr("clip-path", $$.clipPath) .attr("clip-path", $$.clipPath)
.attr("class", CLASS[regions]); .attr("class", CLASS[_regions]);
// Grids // Grids
$$.grid = main.append('g') $$.grid = main.append('g')
.attr("clip-path", $$.clipPath) .attr("clip-path", $$.clipPath)
.attr('class', CLASS[grid]); .attr('class', CLASS[_grid]);
if (config[__grid_x_show]) { if (config[__grid_x_show]) {
$$.grid.append("g").attr("class", CLASS[xgrids]); $$.grid.append("g").attr("class", CLASS[_xgrids]);
} }
if (config[__grid_y_show]) { 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[_xgridLines]);
$$.grid.append('g').attr('class', CLASS[ygridLines]); $$.grid.append('g').attr('class', CLASS[_ygridLines]);
if (config[__grid_focus_show]) { if (config[__grid_focus_show]) {
$$.grid.append('g') $$.grid.append('g')
.attr("class", CLASS[xgridFocus]) .attr("class", CLASS[_xgridFocus])
.append('line') .append('line')
.attr('class', CLASS[xgridFocus]); .attr('class', CLASS[_xgridFocus]);
} }
// Define g for chart area // Define g for chart area
main.append('g') main.append('g')
.attr("clip-path", $$.clipPath) .attr("clip-path", $$.clipPath)
.attr('class', CLASS[chart]); .attr('class', CLASS[_chart]);
// Cover whole with rects for events // Cover whole with rects for events
eventRect = main.select('.' + CLASS[chart]).append("g") eventRect = main.select('.' + CLASS[_chart]).append("g")
.attr("class", CLASS[eventRects]) .attr("class", CLASS[_eventRects])
.style('fill-opacity', 0); .style('fill-opacity', 0);
// Define g for bar chart area // Define g for bar chart area
main.select('.' + CLASS[chart]).append("g") main.select('.' + CLASS[_chart]).append("g")
.attr("class", CLASS[chartBars]); .attr("class", CLASS[_chartBars]);
// Define g for line chart area // Define g for line chart area
main.select('.' + CLASS[chart]).append("g") main.select('.' + CLASS[_chart]).append("g")
.attr("class", CLASS[chartLines]); .attr("class", CLASS[_chartLines]);
// Define g for arc chart area // Define g for arc chart area
if (isFunction($$.initArc)) { if (isFunction($$.initArc)) {
...@@ -714,12 +714,12 @@ ...@@ -714,12 +714,12 @@
$$.initGauge(); $$.initGauge();
} }
main.select('.' + CLASS[chart]).append("g") main.select('.' + CLASS[_chart]).append("g")
.attr("class", CLASS[chartTexts]); .attr("class", CLASS[_chartTexts]);
// if zoom privileged, insert rect to forefront // if zoom privileged, insert rect to forefront
main.insert('rect', config[__zoom_privileged] ? null : 'g.' + CLASS[regions]) main.insert('rect', config[__zoom_privileged] ? null : 'g.' + CLASS[_regions])
.attr('class', CLASS[zoomRect]) .attr('class', CLASS[_zoomRect])
.attr('width', $$.width) .attr('width', $$.width)
.attr('height', $$.height) .attr('height', $$.height)
.style('opacity', 0) .style('opacity', 0)
...@@ -732,32 +732,32 @@ ...@@ -732,32 +732,32 @@
// Add Axis // Add Axis
$$.axes.x = main.append("g") $$.axes.x = main.append("g")
.attr("class", CLASS[axis] + ' ' + CLASS[axisX]) .attr("class", CLASS[_axis] + ' ' + CLASS[_axisX])
.attr("clip-path", $$.clipPathForXAxis) .attr("clip-path", $$.clipPathForXAxis)
.attr("transform", $$.translate.x) .attr("transform", $$.translate.x)
.style("visibility", config[__axis_x_show] ? 'visible' : 'hidden'); .style("visibility", config[__axis_x_show] ? 'visible' : 'hidden');
$$.axes.x.append("text") $$.axes.x.append("text")
.attr("class", CLASS[axisXLabel]) .attr("class", CLASS[_axisXLabel])
.attr("transform", config[__axis_rotated] ? "rotate(-90)" : "") .attr("transform", config[__axis_rotated] ? "rotate(-90)" : "")
.style("text-anchor", generateCall($$.textAnchorForXAxisLabel, $$)); .style("text-anchor", generateCall($$.textAnchorForXAxisLabel, $$));
$$.axes.y = main.append("g") $$.axes.y = main.append("g")
.attr("class", CLASS[axis] + ' ' + CLASS[axisY]) .attr("class", CLASS[_axis] + ' ' + CLASS[_axisY])
.attr("clip-path", $$.clipPathForYAxis) .attr("clip-path", $$.clipPathForYAxis)
.attr("transform", $$.translate.y) .attr("transform", $$.translate.y)
.style("visibility", config[__axis_y_show] ? 'visible' : 'hidden'); .style("visibility", config[__axis_y_show] ? 'visible' : 'hidden');
$$.axes.y.append("text") $$.axes.y.append("text")
.attr("class", CLASS[axisYLabel]) .attr("class", CLASS[_axisYLabel])
.attr("transform", config[__axis_rotated] ? "" : "rotate(-90)") .attr("transform", config[__axis_rotated] ? "" : "rotate(-90)")
.style("text-anchor", generateCall($$.textAnchorForYAxisLabel, $$)); .style("text-anchor", generateCall($$.textAnchorForYAxisLabel, $$));
$$.axes.y2 = main.append("g") $$.axes.y2 = main.append("g")
.attr("class", CLASS[axis] + ' ' + CLASS[axisY2]) .attr("class", CLASS[_axis] + ' ' + CLASS[_axisY2])
// clip-path? // clip-path?
.attr("transform", $$.translate.y2) .attr("transform", $$.translate.y2)
.style("visibility", config[__axis_y2_show] ? 'visible' : 'hidden'); .style("visibility", config[__axis_y2_show] ? 'visible' : 'hidden');
$$.axes.y2.append("text") $$.axes.y2.append("text")
.attr("class", CLASS[axisY2Label]) .attr("class", CLASS[_axisY2Label])
.attr("transform", config[__axis_rotated] ? "" : "rotate(-90)") .attr("transform", config[__axis_rotated] ? "" : "rotate(-90)")
.style("text-anchor", generateCall($$.textAnchorForY2AxisLabel, $$)); .style("text-anchor", generateCall($$.textAnchorForY2AxisLabel, $$));
...@@ -913,7 +913,7 @@ ...@@ -913,7 +913,7 @@
/*-- Main --*/ /*-- Main --*/
//-- Text --// //-- Text --//
mainTextUpdate = main.select('.' + CLASS[chartTexts]).selectAll('.' + CLASS[chartText]) mainTextUpdate = main.select('.' + CLASS[_chartTexts]).selectAll('.' + CLASS[_chartText])
.data(targets) .data(targets)
.attr('class', generateCall($$.classChartText, $$)); .attr('class', generateCall($$.classChartText, $$));
mainTextEnter = mainTextUpdate.enter().append('g') mainTextEnter = mainTextUpdate.enter().append('g')
...@@ -924,7 +924,7 @@ ...@@ -924,7 +924,7 @@
.attr('class', generateCall($$.classTexts, $$)); .attr('class', generateCall($$.classTexts, $$));
//-- Bar --// //-- Bar --//
mainBarUpdate = main.select('.' + CLASS[chartBars]).selectAll('.' + CLASS[chartBar]) mainBarUpdate = main.select('.' + CLASS[_chartBars]).selectAll('.' + CLASS[_chartBar])
.data(targets) .data(targets)
.attr('class', generateCall($$.classChartBar, $$)); .attr('class', generateCall($$.classChartBar, $$));
mainBarEnter = mainBarUpdate.enter().append('g') mainBarEnter = mainBarUpdate.enter().append('g')
...@@ -937,7 +937,7 @@ ...@@ -937,7 +937,7 @@
.style("cursor", function (d) { return config[__data_selection_isselectable](d) ? "pointer" : null; }); .style("cursor", function (d) { return config[__data_selection_isselectable](d) ? "pointer" : null; });
//-- Line --// //-- Line --//
mainLineUpdate = main.select('.' + CLASS[chartLines]).selectAll('.' + CLASS[chartLine]) mainLineUpdate = main.select('.' + CLASS[_chartLines]).selectAll('.' + CLASS[_chartLine])
.data(targets) .data(targets)
.attr('class', generateCall($$.classChartLine, $$)); .attr('class', generateCall($$.classChartLine, $$));
mainLineEnter = mainLineUpdate.enter().append('g') mainLineEnter = mainLineUpdate.enter().append('g')
...@@ -952,13 +952,13 @@ ...@@ -952,13 +952,13 @@
.attr('class', generateCall($$.classAreas, $$)); .attr('class', generateCall($$.classAreas, $$));
// Circles for each data point on lines // Circles for each data point on lines
mainLineEnter.append('g') 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') mainLineEnter.append('g')
.attr("class", generateCall($$.classCircles, $$)) .attr("class", generateCall($$.classCircles, $$))
.style("cursor", function (d) { return config[__data_selection_isselectable](d) ? "pointer" : null; }); .style("cursor", function (d) { return config[__data_selection_isselectable](d) ? "pointer" : null; });
// Update date for selected circles // Update date for selected circles
targets.forEach(function (t) { 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; d.value = t.values[d.index].value;
}); });
}); });
...@@ -975,7 +975,7 @@ ...@@ -975,7 +975,7 @@
/*-- Show --*/ /*-- Show --*/
// Fade-in each chart // 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]) .transition().duration(config[__transition_duration])
.style("opacity", 1); .style("opacity", 1);
}; };
...@@ -1059,14 +1059,14 @@ ...@@ -1059,14 +1059,14 @@
break; break;
} }
} }
$$.svg.selectAll('.' + CLASS[axisX] + ' .tick text').each(function (e) { $$.svg.selectAll('.' + CLASS[_axisX] + ' .tick text').each(function (e) {
var index = tickValues.indexOf(e); var index = tickValues.indexOf(e);
if (index >= 0) { if (index >= 0) {
d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block'); d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block');
} }
}); });
} else { } else {
$$.svg.selectAll('.' + CLASS[axisX] + ' .tick text').style('display', 'block'); $$.svg.selectAll('.' + CLASS[_axisX] + ' .tick text').style('display', 'block');
} }
} }
...@@ -1093,7 +1093,7 @@ ...@@ -1093,7 +1093,7 @@
$$.updateXgridFocus(); $$.updateXgridFocus();
// Data empty label positioning and text. // 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("x", $$.width / 2)
.attr("y", $$.height / 2) .attr("y", $$.height / 2)
.text(config[__data_empty_label_text]) .text(config[__data_empty_label_text])
...@@ -1101,7 +1101,7 @@ ...@@ -1101,7 +1101,7 @@
.style('opacity', targetsToShow.length ? 0 : 1); .style('opacity', targetsToShow.length ? 0 : 1);
// grid // grid
main.select('line.' + CLASS[xgridFocus]).style("visibility", "hidden"); main.select('line.' + CLASS[_xgridFocus]).style("visibility", "hidden");
if (config[__grid_x_show]) { if (config[__grid_x_show]) {
xgridAttr = config[__axis_rotated] ? { xgridAttr = config[__axis_rotated] ? {
'x1': 0, 'x1': 0,
...@@ -1118,9 +1118,9 @@ ...@@ -1118,9 +1118,9 @@
flushXGrid = function (withoutUpdate) { flushXGrid = function (withoutUpdate) {
xgridData = $$.generateGridData(config[__grid_x_type], $$.x); xgridData = $$.generateGridData(config[__grid_x_type], $$.x);
tickOffset = $$.isCategorized ? $$.xAxis.tickOffset() : 0; tickOffset = $$.isCategorized ? $$.xAxis.tickOffset() : 0;
xgrid = main.select('.' + CLASS[xgrids]).selectAll('.' + CLASS[xgrid]) xgrid = main.select('.' + CLASS[_xgrids]).selectAll('.' + CLASS[_xgrid])
.data(xgridData); .data(xgridData);
xgrid.enter().append('line').attr("class", CLASS[xgrid]); xgrid.enter().append('line').attr("class", CLASS[_xgrid]);
if (!withoutUpdate) { if (!withoutUpdate) {
xgrid.attr(xgridAttr) xgrid.attr(xgridAttr)
.style("opacity", function () { return +d3.select(this).attr(config[__axis_rotated] ? 'y1' : 'x1') === (config[__axis_rotated] ? $$.height : 0) ? 0 : 1; }); .style("opacity", function () { return +d3.select(this).attr(config[__axis_rotated] ? 'y1' : 'x1') === (config[__axis_rotated] ? $$.height : 0) ? 0 : 1; });
...@@ -1129,11 +1129,11 @@ ...@@ -1129,11 +1129,11 @@
}; };
flushXGrid(); flushXGrid();
} }
xgridLines = main.select('.' + CLASS[xgridLines]).selectAll('.' + CLASS[xgridLine]) xgridLines = main.select('.' + CLASS[_xgridLines]).selectAll('.' + CLASS[_xgridLine])
.data(config[__grid_x_lines]); .data(config[__grid_x_lines]);
// enter // enter
xgridLine = xgridLines.enter().append('g') 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') xgridLine.append('line')
.style("opacity", 0); .style("opacity", 0);
xgridLine.append('text') xgridLine.append('text')
...@@ -1150,10 +1150,10 @@ ...@@ -1150,10 +1150,10 @@
.remove(); .remove();
// Y-Grid // Y-Grid
if (withY && config[__grid_y_show]) { if (withY && config[__grid_y_show]) {
ygrid = main.select('.' + CLASS[ygrids]).selectAll('.' + CLASS[ygrid]) ygrid = main.select('.' + CLASS[_ygrids]).selectAll('.' + CLASS[_ygrid])
.data($$.y.ticks(config[__grid_y_ticks])); .data($$.y.ticks(config[__grid_y_ticks]));
ygrid.enter().append('line') ygrid.enter().append('line')
.attr('class', CLASS[ygrid]); .attr('class', CLASS[_ygrid]);
ygrid.attr("x1", config[__axis_rotated] ? $$.y : 0) ygrid.attr("x1", config[__axis_rotated] ? $$.y : 0)
.attr("x2", config[__axis_rotated] ? $$.y : $$.width) .attr("x2", config[__axis_rotated] ? $$.y : $$.width)
.attr("y1", config[__axis_rotated] ? 0 : $$.y) .attr("y1", config[__axis_rotated] ? 0 : $$.y)
...@@ -1162,11 +1162,11 @@ ...@@ -1162,11 +1162,11 @@
$$.smoothLines(ygrid, 'grid'); $$.smoothLines(ygrid, 'grid');
} }
if (withY) { if (withY) {
ygridLines = main.select('.' + CLASS[ygridLines]).selectAll('.' + CLASS[ygridLine]) ygridLines = main.select('.' + CLASS[_ygridLines]).selectAll('.' + CLASS[_ygridLine])
.data(config[__grid_y_lines]); .data(config[__grid_y_lines]);
// enter // enter
ygridLine = ygridLines.enter().append('g') 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') ygridLine.append('line')
.style("opacity", 0); .style("opacity", 0);
ygridLine.append('text') ygridLine.append('text')
...@@ -1197,7 +1197,7 @@ ...@@ -1197,7 +1197,7 @@
} }
// rect for regions // rect for regions
mainRegion = main.select('.' + CLASS[regions]).selectAll('.' + CLASS[region]) mainRegion = main.select('.' + CLASS[_regions]).selectAll('.' + CLASS[_region])
.data(config[__regions]); .data(config[__regions]);
mainRegion.enter().append('g') mainRegion.enter().append('g')
.attr('class', generateCall($$.classRegion, $$)) .attr('class', generateCall($$.classRegion, $$))
...@@ -1208,7 +1208,7 @@ ...@@ -1208,7 +1208,7 @@
.remove(); .remove();
// bars // bars
mainBar = main.selectAll('.' + CLASS[bars]).selectAll('.' + CLASS[bar]) mainBar = main.selectAll('.' + CLASS[_bars]).selectAll('.' + CLASS[_bar])
.data(generateCall($$.barData, $$)); .data(generateCall($$.barData, $$));
mainBar.enter().append('path') mainBar.enter().append('path')
.attr("class", generateCall($$.classBar, $$)) .attr("class", generateCall($$.classBar, $$))
...@@ -1221,7 +1221,7 @@ ...@@ -1221,7 +1221,7 @@
.remove(); .remove();
// lines, areas and cricles // lines, areas and cricles
mainLine = main.selectAll('.' + CLASS[lines]).selectAll('.' + CLASS[line]) mainLine = main.selectAll('.' + CLASS[_lines]).selectAll('.' + CLASS[_line])
.data(generateCall($$.lineData, $$)); .data(generateCall($$.lineData, $$));
mainLine.enter().append('path') mainLine.enter().append('path')
.attr('class', generateCall($$.classLine, $$)) .attr('class', generateCall($$.classLine, $$))
...@@ -1233,7 +1233,7 @@ ...@@ -1233,7 +1233,7 @@
.style('opacity', 0) .style('opacity', 0)
.remove(); .remove();
mainArea = main.selectAll('.' + CLASS[areas]).selectAll('.' + CLASS[area]) mainArea = main.selectAll('.' + CLASS[_areas]).selectAll('.' + CLASS[_area])
.data(generateCall($$.lineData, $$)); .data(generateCall($$.lineData, $$));
mainArea.enter().append('path') mainArea.enter().append('path')
.attr("class", generateCall($$.classArea, $$)) .attr("class", generateCall($$.classArea, $$))
...@@ -1246,7 +1246,7 @@ ...@@ -1246,7 +1246,7 @@
.remove(); .remove();
if (config[__point_show]) { if (config[__point_show]) {
mainCircle = main.selectAll('.' + CLASS[circles]).selectAll('.' + CLASS[circle]) mainCircle = main.selectAll('.' + CLASS[_circles]).selectAll('.' + CLASS[_circle])
.data(generateCall($$.lineOrScatterData, $$)); .data(generateCall($$.lineOrScatterData, $$));
mainCircle.enter().append("circle") mainCircle.enter().append("circle")
.attr("class", generateCall($$.classCircle, $$)) .attr("class", generateCall($$.classCircle, $$))
...@@ -1258,7 +1258,7 @@ ...@@ -1258,7 +1258,7 @@
} }
if ($$.hasDataLabel()) { if ($$.hasDataLabel()) {
mainText = main.selectAll('.' + CLASS[texts]).selectAll('.' + CLASS[text]) mainText = main.selectAll('.' + CLASS[_texts]).selectAll('.' + CLASS[_text])
.data(generateCall($$.barOrLineData, $$)); .data(generateCall($$.barOrLineData, $$));
mainText.enter().append('text') mainText.enter().append('text')
.attr("class", generateCall($$.classText, $$)) .attr("class", generateCall($$.classText, $$))
...@@ -1285,23 +1285,23 @@ ...@@ -1285,23 +1285,23 @@
} }
// circles for select // circles for select
main.selectAll('.' + CLASS[selectedCircles]) main.selectAll('.' + CLASS[_selectedCircles])
.filter(generateCall($$.isBarType, $$)) .filter(generateCall($$.isBarType, $$))
.selectAll('circle') .selectAll('circle')
.remove(); .remove();
if (config[__interaction_enabled]) { if (config[__interaction_enabled]) {
// rect for mouseover // rect for mouseover
eventRect = main.select('.' + CLASS[eventRects]) eventRect = main.select('.' + CLASS[_eventRects])
.style('cursor', config[__zoom_enabled] ? config[__axis_rotated] ? 'ns-resize' : 'ew-resize' : null); .style('cursor', config[__zoom_enabled] ? config[__axis_rotated] ? 'ns-resize' : 'ew-resize' : null);
if (notEmpty(config[__data_xs]) && !$$.isSingleX(config[__data_xs])) { if (notEmpty(config[__data_xs]) && !$$.isSingleX(config[__data_xs])) {
if (!eventRect.classed(CLASS[eventRectsMultiple])) { if (!eventRect.classed(CLASS[_eventRectsMultiple])) {
eventRect.classed(CLASS[eventRectsMultiple], true).classed(CLASS[eventRectsSingle], false) eventRect.classed(CLASS[_eventRectsMultiple], true).classed(CLASS[_eventRectsSingle], false)
.selectAll('.' + CLASS[eventRect]).remove(); .selectAll('.' + CLASS[_eventRect]).remove();
} }
eventRectUpdate = main.select('.' + CLASS[eventRects]).selectAll('.' + CLASS[eventRect]) eventRectUpdate = main.select('.' + CLASS[_eventRects]).selectAll('.' + CLASS[_eventRect])
.data([0]); .data([0]);
// enter : only one rect will be added // enter : only one rect will be added
$$.generateEventRectsForMultipleXs(eventRectUpdate.enter()); $$.generateEventRectsForMultipleXs(eventRectUpdate.enter());
...@@ -1314,9 +1314,9 @@ ...@@ -1314,9 +1314,9 @@
// exit : not needed because always only one rect exists // exit : not needed because always only one rect exists
} else { } else {
if (!eventRect.classed(CLASS[eventRectsSingle])) { if (!eventRect.classed(CLASS[_eventRectsSingle])) {
eventRect.classed(CLASS[eventRectsMultiple], false).classed(CLASS[eventRectsSingle], true) eventRect.classed(CLASS[_eventRectsMultiple], false).classed(CLASS[_eventRectsSingle], true)
.selectAll('.' + CLASS[eventRect]).remove(); .selectAll('.' + CLASS[_eventRect]).remove();
} }
if (($$.isCustomX() || $$.isTimeSeries) && !$$.isCategorized) { if (($$.isCustomX() || $$.isTimeSeries) && !$$.isCategorized) {
...@@ -1337,10 +1337,10 @@ ...@@ -1337,10 +1337,10 @@
} }
// Set data // Set data
maxDataCountTarget = $$.getMaxDataCountTarget($$.data.targets); maxDataCountTarget = $$.getMaxDataCountTarget($$.data.targets);
main.select('.' + CLASS[eventRects]) main.select('.' + CLASS[_eventRects])
.datum(maxDataCountTarget ? maxDataCountTarget.values : []); .datum(maxDataCountTarget ? maxDataCountTarget.values : []);
// Update rects // Update rects
eventRectUpdate = main.select('.' + CLASS[eventRects]).selectAll('.' + CLASS[eventRect]) eventRectUpdate = main.select('.' + CLASS[_eventRects]).selectAll('.' + CLASS[_eventRect])
.data(function (d) { return d; }); .data(function (d) { return d; });
// enter // enter
$$.generateEventRectsForSingleX(eventRectUpdate.enter()); $$.generateEventRectsForSingleX(eventRectUpdate.enter());
...@@ -1381,7 +1381,7 @@ ...@@ -1381,7 +1381,7 @@
.style("fill", $$.color) .style("fill", $$.color)
.attr("cx", cx) .attr("cx", cx)
.attr("cy", cy)); .attr("cy", cy));
transitions.push(main.selectAll('.' + CLASS[selectedCircle]).transition() transitions.push(main.selectAll('.' + CLASS[_selectedCircle]).transition()
.attr("cx", cx) .attr("cx", cx)
.attr("cy", cy)); .attr("cy", cy));
transitions.push(mainText.transition() transitions.push(mainText.transition()
...@@ -1477,14 +1477,14 @@ ...@@ -1477,14 +1477,14 @@
// remove flowed elements // remove flowed elements
if (flowLength) { if (flowLength) {
for (i = 0; i < flowLength; i++) { for (i = 0; i < flowLength; i++) {
shapes.push('.' + CLASS[shape] + '-' + (flowIndex + i)); shapes.push('.' + CLASS[_shape] + '-' + (flowIndex + i));
texts.push('.' + CLASS[text] + '-' + (flowIndex + i)); texts.push('.' + CLASS[_text] + '-' + (flowIndex + i));
eventRects.push('.' + CLASS[eventRect] + '-' + (flowIndex + i)); eventRects.push('.' + CLASS[_eventRect] + '-' + (flowIndex + i));
} }
$$.svg.selectAll('.' + CLASS[shapes]).selectAll(shapes).remove(); $$.svg.selectAll('.' + CLASS[_shapes]).selectAll(shapes).remove();
$$.svg.selectAll('.' + CLASS[texts]).selectAll(texts).remove(); $$.svg.selectAll('.' + CLASS[_texts]).selectAll(texts).remove();
$$.svg.selectAll('.' + CLASS[eventRects]).selectAll(eventRects).remove(); $$.svg.selectAll('.' + CLASS[_eventRects]).selectAll(eventRects).remove();
$$.svg.select('.' + CLASS[xgrid]).remove(); $$.svg.select('.' + CLASS[_xgrid]).remove();
} }
// draw again for removing flowed elements and reverting attr // draw again for removing flowed elements and reverting attr
...@@ -1626,7 +1626,7 @@ ...@@ -1626,7 +1626,7 @@
$$.expandBars(index); $$.expandBars(index);
// Call event handler // Call event handler
$$.main.selectAll('.' + CLASS[shape] + '-' + index).each(function (d) { $$.main.selectAll('.' + CLASS[_shape] + '-' + index).each(function (d) {
config[__data_onmouseover].call(c3, d); config[__data_onmouseover].call(c3, d);
}); });
}) })
...@@ -1639,13 +1639,13 @@ ...@@ -1639,13 +1639,13 @@
$$.unexpandCircles(index); $$.unexpandCircles(index);
$$.unexpandBars(); $$.unexpandBars();
// Call event handler // Call event handler
$$.main.selectAll('.' + CLASS[shape] + '-' + index).each(function (d) { $$.main.selectAll('.' + CLASS[_shape] + '-' + index).each(function (d) {
config[__data_onmouseout].call($$, d); config[__data_onmouseout].call($$, d);
}); });
}) })
.on('mousemove', function (d) { .on('mousemove', function (d) {
var selectedData, index = d.index, 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 ($$.dragging) { return; } // do nothing when dragging
if ($$.hasArcType()) { return; } if ($$.hasArcType()) { return; }
...@@ -1664,9 +1664,9 @@ ...@@ -1664,9 +1664,9 @@
return; return;
} }
$$.main.selectAll('.' + CLASS[shape] + '-' + index) $$.main.selectAll('.' + CLASS[_shape] + '-' + index)
.each(function () { .each(function () {
d3.select(this).classed(CLASS[EXPANDED], true); d3.select(this).classed(CLASS[_EXPANDED], true);
if (config[__data_selection_enabled]) { if (config[__data_selection_enabled]) {
eventRect.style('cursor', config[__data_selection_grouped] ? 'pointer' : null); eventRect.style('cursor', config[__data_selection_grouped] ? 'pointer' : null);
} }
...@@ -1706,7 +1706,7 @@ ...@@ -1706,7 +1706,7 @@
$$.cancelClick = false; $$.cancelClick = false;
return; return;
} }
$$.main.selectAll('.' + CLASS[shape] + '-' + index).each(function (d) { $$.toggleShape(this, d, index); }); $$.main.selectAll('.' + CLASS[_shape] + '-' + index).each(function (d) { $$.toggleShape(this, d, index); });
}) })
.call( .call(
d3.behavior.drag().origin(Object) d3.behavior.drag().origin(Object)
...@@ -1724,7 +1724,7 @@ ...@@ -1724,7 +1724,7 @@
.attr('y', 0) .attr('y', 0)
.attr('width', $$.width) .attr('width', $$.width)
.attr('height', $$.height) .attr('height', $$.height)
.attr('class', CLASS[eventRect]) .attr('class', CLASS[_eventRect])
.on('mouseout', function () { .on('mouseout', function () {
if ($$.hasArcType()) { return; } if ($$.hasArcType()) { return; }
$$.hideXGridFocus(); $$.hideXGridFocus();
...@@ -1766,13 +1766,13 @@ ...@@ -1766,13 +1766,13 @@
// Show cursor as pointer if point is close to mouse position // Show cursor as pointer if point is close to mouse position
if ($$.dist(closest, mouse) < 100) { if ($$.dist(closest, mouse) < 100) {
$$.svg.select('.' + CLASS[eventRect]).style('cursor', 'pointer'); $$.svg.select('.' + CLASS[_eventRect]).style('cursor', 'pointer');
if (!$$.mouseover) { if (!$$.mouseover) {
config[__data_onmouseover].call($$, closest); config[__data_onmouseover].call($$, closest);
$$.mouseover = true; $$.mouseover = true;
} }
} else if ($$.mouseover) { } else if ($$.mouseover) {
$$.svg.select('.' + CLASS[eventRect]).style('cursor', null); $$.svg.select('.' + CLASS[_eventRect]).style('cursor', null);
config[__data_onmouseout].call($$, closest); config[__data_onmouseout].call($$, closest);
$$.mouseover = false; $$.mouseover = false;
} }
...@@ -1790,7 +1790,7 @@ ...@@ -1790,7 +1790,7 @@
// select if selection enabled // select if selection enabled
if ($$.dist(closest, mouse) < 100) { if ($$.dist(closest, mouse) < 100) {
$$.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); $$.toggleShape(this, closest, closest.index);
}); });
} }
...@@ -1845,26 +1845,26 @@ ...@@ -1845,26 +1845,26 @@
if (transitions && transitions.axisX) { if (transitions && transitions.axisX) {
xAxis = transitions.axisX; xAxis = transitions.axisX;
} else { } else {
xAxis = $$.main.select('.' + CLASS[axisX]); xAxis = $$.main.select('.' + CLASS[_axisX]);
if (withTransition) { xAxis = xAxis.transition(); } if (withTransition) { xAxis = xAxis.transition(); }
} }
if (transitions && transitions.axisY) { if (transitions && transitions.axisY) {
yAxis = transitions.axisY; yAxis = transitions.axisY;
} else { } else {
yAxis = $$.main.select('.' + CLASS[axisY]); yAxis = $$.main.select('.' + CLASS[_axisY]);
if (withTransition) { yAxis = yAxis.transition(); } if (withTransition) { yAxis = yAxis.transition(); }
} }
if (transitions && transitions.axisY2) { if (transitions && transitions.axisY2) {
y2Axis = transitions.axisY2; y2Axis = transitions.axisY2;
} else { } else {
y2Axis = $$.main.select('.' + CLASS[axisY2]); y2Axis = $$.main.select('.' + CLASS[_axisY2]);
if (withTransition) { y2Axis = y2Axis.transition(); } if (withTransition) { y2Axis = y2Axis.transition(); }
} }
(withTransition ? $$.main.transition() : $$.main).attr("transform", $$.translate.main); (withTransition ? $$.main.transition() : $$.main).attr("transform", $$.translate.main);
xAxis.attr("transform", $$.translate.x); xAxis.attr("transform", $$.translate.x);
yAxis.attr("transform", $$.translate.y); yAxis.attr("transform", $$.translate.y);
y2Axis.attr("transform", $$.translate.y2); y2Axis.attr("transform", $$.translate.y2);
$$.main.select('.' + CLASS[chartArcs]).attr("transform", $$.translate.arc); $$.main.select('.' + CLASS[_chartArcs]).attr("transform", $$.translate.arc);
}; };
c3_chart_internal_fn.transformLegend = function (withTransition) { c3_chart_internal_fn.transformLegend = function (withTransition) {
var $$ = this; var $$ = this;
...@@ -1894,7 +1894,7 @@ ...@@ -1894,7 +1894,7 @@
.attr('y', generateCall($$.getYAxisClipY, $$)) .attr('y', generateCall($$.getYAxisClipY, $$))
.attr('width', generateCall($$.getYAxisClipWidth, $$)) .attr('width', generateCall($$.getYAxisClipWidth, $$))
.attr('height', generateCall($$.getYAxisClipHeight, $$)); .attr('height', generateCall($$.getYAxisClipHeight, $$));
$$.svg.select('.' + CLASS[zoomRect]) $$.svg.select('.' + CLASS[_zoomRect])
.attr('width', $$.width) .attr('width', $$.width)
.attr('height', $$.height); .attr('height', $$.height);
// MEMO: parent div's height will be bigger than svg when <!DOCTYPE html> // MEMO: parent div's height will be bigger than svg when <!DOCTYPE html>
...@@ -2022,7 +2022,7 @@ ...@@ -2022,7 +2022,7 @@
c3_chart_internal_fn.getSvgLeft = function () { c3_chart_internal_fn.getSvgLeft = function () {
var $$ = this, config = $$.config, 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(), leftAxis = $$.main.select('.' + leftAxisClass).node(),
svgRect = leftAxis ? leftAxis.getBoundingClientRect() : {right: 0}, svgRect = leftAxis ? leftAxis.getBoundingClientRect() : {right: 0},
chartRect = $$.selectChart.node().getBoundingClientRect(), chartRect = $$.selectChart.node().getBoundingClientRect(),
...@@ -2124,7 +2124,7 @@ ...@@ -2124,7 +2124,7 @@
if (! config[__tooltip_show]) { return; } if (! config[__tooltip_show]) { return; }
// Hide when scatter plot exists // Hide when scatter plot exists
if ($$.hasType('scatter') || $$.hasArcType()) { return; } if ($$.hasType('scatter') || $$.hasArcType()) { return; }
var focusEl = $$.main.selectAll('line.' + CLASS[xgridFocus]); var focusEl = $$.main.selectAll('line.' + CLASS[_xgridFocus]);
focusEl focusEl
.style("visibility", "visible") .style("visibility", "visible")
.data([dataToShow[0]]) .data([dataToShow[0]])
...@@ -2133,11 +2133,11 @@ ...@@ -2133,11 +2133,11 @@
$$.smoothLines(focusEl, 'grid'); $$.smoothLines(focusEl, 'grid');
}; };
c3_chart_internal_fn.hideXGridFocus = function () { 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 () { c3_chart_internal_fn.updateXgridFocus = function () {
var $$ = this, config = $$.config; var $$ = this, config = $$.config;
$$.main.select('line.' + CLASS[xgridFocus]) $$.main.select('line.' + CLASS[_xgridFocus])
.attr("x1", config[__axis_rotated] ? 0 : -10) .attr("x1", config[__axis_rotated] ? 0 : -10)
.attr("x2", config[__axis_rotated] ? $$.width : -10) .attr("x2", config[__axis_rotated] ? $$.width : -10)
.attr("y1", config[__axis_rotated] ? -10 : 0) .attr("y1", config[__axis_rotated] ? -10 : 0)
...@@ -2146,7 +2146,7 @@ ...@@ -2146,7 +2146,7 @@
c3_chart_internal_fn.generateGridData = function (type, scale) { c3_chart_internal_fn.generateGridData = function (type, scale) {
var $$ = this, var $$ = this,
gridData = [], xDomain, firstYear, lastYear, i, gridData = [], xDomain, firstYear, lastYear, i,
tickNum = $$.main.select("." + CLASS[axisX]).selectAll('.tick').size(); tickNum = $$.main.select("." + CLASS[_axisX]).selectAll('.tick').size();
if (type === 'year') { if (type === 'year') {
xDomain = $$.getXDomain(); xDomain = $$.getXDomain();
firstYear = xDomain[0].getFullYear(); firstYear = xDomain[0].getFullYear();
...@@ -2177,8 +2177,8 @@ ...@@ -2177,8 +2177,8 @@
var $$ = this, config = $$.config, var $$ = this, config = $$.config,
toRemove = $$.getGridFilterToRemove(params), toRemove = $$.getGridFilterToRemove(params),
toShow = function (line) { return !toRemove(line); }, toShow = function (line) { return !toRemove(line); },
classLines = forX ? CLASS[xgridLines] : CLASS[ygridLines], classLines = forX ? CLASS[_xgridLines] : CLASS[_ygridLines],
classLine = forX ? CLASS[xgridLine] : CLASS.ygridLine; classLine = forX ? CLASS[_xgridLine] : CLASS.ygridLine;
$$.main.select('.' + classLines).selectAll('.' + classLine).filter(toRemove) $$.main.select('.' + classLines).selectAll('.' + classLine).filter(toRemove)
.transition().duration(config[__transition_duration]) .transition().duration(config[__transition_duration])
.style('opacity', 0).remove(); .style('opacity', 0).remove();
...@@ -2221,15 +2221,15 @@ ...@@ -2221,15 +2221,15 @@
}; };
c3_chart_internal_fn.opacityForLegend = function (legendItem) { c3_chart_internal_fn.opacityForLegend = function (legendItem) {
var $$ = this; var $$ = this;
return legendItem.classed(CLASS[legendItemHidden]) ? $$.legendOpacityForHidden : 1; return legendItem.classed(CLASS[_legendItemHidden]) ? $$.legendOpacityForHidden : 1;
}; };
c3_chart_internal_fn.opacityForUnfocusedLegend = function (legendItem) { c3_chart_internal_fn.opacityForUnfocusedLegend = function (legendItem) {
var $$ = this; 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) { c3_chart_internal_fn.toggleFocusLegend = function (id, focus) {
var $$ = this; var $$ = this;
$$.legend.selectAll('.' + CLASS[legendItem]) $$.legend.selectAll('.' + CLASS[_legendItem])
.transition().duration(100) .transition().duration(100)
.style('opacity', function (_id) { .style('opacity', function (_id) {
var This = $$.d3.select(this); var This = $$.d3.select(this);
...@@ -2242,7 +2242,7 @@ ...@@ -2242,7 +2242,7 @@
}; };
c3_chart_internal_fn.revertLegend = function () { c3_chart_internal_fn.revertLegend = function () {
var $$ = this, d3 = $$.d3; var $$ = this, d3 = $$.d3;
$$.legend.selectAll('.' + CLASS[legendItem]) $$.legend.selectAll('.' + CLASS[_legendItem])
.transition().duration(100) .transition().duration(100)
.style('opacity', function () { return $$.opacityForLegend(d3.select(this)); }); .style('opacity', function () { return $$.opacityForLegend(d3.select(this)); });
}; };
...@@ -2275,7 +2275,7 @@ ...@@ -2275,7 +2275,7 @@
var paddingTop = 4, paddingRight = 36, maxWidth = 0, maxHeight = 0, posMin = 10; var paddingTop = 4, paddingRight = 36, maxWidth = 0, maxHeight = 0, posMin = 10;
var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0; var l, totalLength = 0, offsets = {}, widths = {}, heights = {}, margins = [0], steps = {}, step = 0;
var withTransition, withTransitionForTransform; var withTransition, withTransitionForTransform;
var hasFocused = $$.legend.selectAll('.' + CLASS[legendItemFocused]).size(); var hasFocused = $$.legend.selectAll('.' + CLASS[_legendItemFocused]).size();
var texts, rects, tiles; var texts, rects, tiles;
options = options || {}; options = options || {};
...@@ -2283,7 +2283,7 @@ ...@@ -2283,7 +2283,7 @@
withTransitionForTransform = getOption(options, "withTransitionForTransform", true); withTransitionForTransform = getOption(options, "withTransitionForTransform", true);
function updatePositions(textElement, id, reset) { 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, itemWidth = Math.ceil((box.width + paddingRight) / 10) * 10,
itemHeight = Math.ceil((box.height + paddingTop) / 10) * 10, itemHeight = Math.ceil((box.height + paddingTop) / 10) * 10,
itemLength = $$.isLegendRight || $$.isLegendInset ? itemHeight : itemWidth, itemLength = $$.isLegendRight || $$.isLegendInset ? itemHeight : itemWidth,
...@@ -2358,17 +2358,17 @@ ...@@ -2358,17 +2358,17 @@
yForLegendRect = function (id, i) { return yForLegend(id, i) - 7; }; yForLegendRect = function (id, i) { return yForLegend(id, i) - 7; };
// Define g for legend area // Define g for legend area
l = $$.legend.selectAll('.' + CLASS[legendItem]) l = $$.legend.selectAll('.' + CLASS[_legendItem])
.data(targetIds) .data(targetIds)
.enter().append('g') .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('visibility', function (id) { return $$.isLegendToShow(id) ? 'visible' : 'hidden'; })
.style('cursor', 'pointer') .style('cursor', 'pointer')
.on('click', function (id) { .on('click', function (id) {
isFunction(config[__legend_item_onclick]) ? config[__legend_item_onclick].call(c3, id) : $$.api.toggle(id); isFunction(config[__legend_item_onclick]) ? config[__legend_item_onclick].call(c3, id) : $$.api.toggle(id);
}) })
.on('mouseover', function (id) { .on('mouseover', function (id) {
$$.d3.select(this).classed(CLASS[legendItemFocused], true); $$.d3.select(this).classed(CLASS[_legendItemFocused], true);
if (!$$.transiting) { if (!$$.transiting) {
$$.api.focus(id); $$.api.focus(id);
} }
...@@ -2377,7 +2377,7 @@ ...@@ -2377,7 +2377,7 @@
} }
}) })
.on('mouseout', function (id) { .on('mouseout', function (id) {
$$.d3.select(this).classed(CLASS[legendItemFocused], false); $$.d3.select(this).classed(CLASS[_legendItemFocused], false);
if (!$$.transiting) { if (!$$.transiting) {
$$.api.revert(); $$.api.revert();
} }
...@@ -2392,12 +2392,12 @@ ...@@ -2392,12 +2392,12 @@
.attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendText : -200) .attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendText : -200)
.attr('y', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendText); .attr('y', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendText);
l.append('rect') l.append('rect')
.attr("class", CLASS[legendItemEvent]) .attr("class", CLASS[_legendItemEvent])
.style('fill-opacity', 0) .style('fill-opacity', 0)
.attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendRect : -200) .attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendRect : -200)
.attr('y', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendRect); .attr('y', $$.isLegendRight || $$.isLegendInset ? -200 : yForLegendRect);
l.append('rect') l.append('rect')
.attr("class", CLASS[legendItemTile]) .attr("class", CLASS[_legendItemTile])
.style("pointer-events", "none") .style("pointer-events", "none")
.style('fill', $$.color) .style('fill', $$.color)
.attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendText : -200) .attr('x', $$.isLegendRight || $$.isLegendInset ? xForLegendText : -200)
...@@ -2406,8 +2406,8 @@ ...@@ -2406,8 +2406,8 @@
.attr('height', 10); .attr('height', 10);
// Set background for inset legend // Set background for inset legend
if ($$.isLegendInset && maxWidth !== 0) { if ($$.isLegendInset && maxWidth !== 0) {
$$.legend.insert('g', '.' + CLASS[legendItem]) $$.legend.insert('g', '.' + CLASS[_legendItem])
.attr("class", CLASS[legendBackground]) .attr("class", CLASS[_legendBackground])
.append('rect') .append('rect')
.attr('height', $$.getLegendHeight() - 10) .attr('height', $$.getLegendHeight() - 10)
.attr('width', maxWidth * (step + 1) + 10); .attr('width', maxWidth * (step + 1) + 10);
...@@ -2421,7 +2421,7 @@ ...@@ -2421,7 +2421,7 @@
.attr('x', xForLegendText) .attr('x', xForLegendText)
.attr('y', yForLegendText); .attr('y', yForLegendText);
rects = $$.legend.selectAll('rect.' + CLASS[legendItemEvent]) rects = $$.legend.selectAll('rect.' + CLASS[_legendItemEvent])
.data(targetIds); .data(targetIds);
(withTransition ? rects.transition() : rects) (withTransition ? rects.transition() : rects)
.attr('width', function (id) { return widths[id]; }) .attr('width', function (id) { return widths[id]; })
...@@ -2429,7 +2429,7 @@ ...@@ -2429,7 +2429,7 @@
.attr('x', xForLegendRect) .attr('x', xForLegendRect)
.attr('y', yForLegendRect); .attr('y', yForLegendRect);
tiles = $$.legend.selectAll('rect.' + CLASS[legendItemTile]) tiles = $$.legend.selectAll('rect.' + CLASS[_legendItemTile])
.data(targetIds); .data(targetIds);
(withTransition ? tiles.transition() : tiles) (withTransition ? tiles.transition() : tiles)
.style('fill', $$.color) .style('fill', $$.color)
...@@ -2437,13 +2437,13 @@ ...@@ -2437,13 +2437,13 @@
.attr('y', yForLegend); .attr('y', yForLegend);
// toggle legend state // toggle legend state
$$.legend.selectAll('.' + CLASS[legendItem]) $$.legend.selectAll('.' + CLASS[_legendItem])
.classed(CLASS[legendItemHidden], function (id) { return !$$.isTargetToShow(id); }) .classed(CLASS[_legendItemHidden], function (id) { return !$$.isTargetToShow(id); })
.transition() .transition()
.style('opacity', function (id) { .style('opacity', function (id) {
var This = $$.d3.select(this); var This = $$.d3.select(this);
if ($$.isTargetToShow(id)) { if ($$.isTargetToShow(id)) {
return !hasFocused || This.classed(CLASS[legendItemFocused]) ? $$.opacityForLegend(This) : $$.opacityForUnfocusedLegend(This); return !hasFocused || This.classed(CLASS[_legendItemFocused]) ? $$.opacityForLegend(This) : $$.opacityForUnfocusedLegend(This);
} else { } else {
return $$.legendOpacityForHidden; return $$.legendOpacityForHidden;
} }
...@@ -3041,7 +3041,7 @@ ...@@ -3041,7 +3041,7 @@
// Reset fadein for future load // Reset fadein for future load
$$.withoutFadeIn[id] = false; $$.withoutFadeIn[id] = false;
// Remove target's elements // Remove target's elements
$$.legend.selectAll('.' + CLASS[legendItem] + $$.getTargetSelectorSuffix(id)).remove(); $$.legend.selectAll('.' + CLASS[_legendItem] + $$.getTargetSelectorSuffix(id)).remove();
// Remove target // Remove target
$$.data.targets = $$.data.targets.filter(function (t) { $$.data.targets = $$.data.targets.filter(function (t) {
return t.id !== id; return t.id !== id;
...@@ -3127,19 +3127,19 @@ ...@@ -3127,19 +3127,19 @@
}; };
c3_chart_internal_fn.getCircles = function (i, id) { c3_chart_internal_fn.getCircles = function (i, id) {
var $$ = this; 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) { c3_chart_internal_fn.expandCircles = function (i, id) {
var $$ = this; var $$ = this;
$$.getCircles(i, id) $$.getCircles(i, id)
.classed(CLASS[EXPANDED], true) .classed(CLASS[_EXPANDED], true)
.attr('r', generateCall($$.pointExpandedR, $$)); .attr('r', generateCall($$.pointExpandedR, $$));
}; };
c3_chart_internal_fn.unexpandCircles = function (i) { c3_chart_internal_fn.unexpandCircles = function (i) {
var $$ = this; var $$ = this;
$$.getCircles(i) $$.getCircles(i)
.filter(function () { return $$.d3.select(this).classed(CLASS[EXPANDED]); }) .filter(function () { return $$.d3.select(this).classed(CLASS[_EXPANDED]); })
.classed(CLASS[EXPANDED], false) .classed(CLASS[_EXPANDED], false)
.attr('r', generateCall($$.pointR, $$)); .attr('r', generateCall($$.pointR, $$));
}; };
c3_chart_internal_fn.pointR = function (d) { c3_chart_internal_fn.pointR = function (d) {
...@@ -3164,15 +3164,15 @@ ...@@ -3164,15 +3164,15 @@
}; };
c3_chart_internal_fn.getBars = function (i) { c3_chart_internal_fn.getBars = function (i) {
var $$ = this; 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) { c3_chart_internal_fn.expandBars = function (i) {
var $$ = this; var $$ = this;
$$.getBars(i).classed(CLASS[EXPANDED], true); $$.getBars(i).classed(CLASS[_EXPANDED], true);
}; };
c3_chart_internal_fn.unexpandBars = function (i) { c3_chart_internal_fn.unexpandBars = function (i) {
var $$ = this; var $$ = this;
$$.getBars(i).classed(CLASS[EXPANDED], false); $$.getBars(i).classed(CLASS[_EXPANDED], false);
}; };
c3_chart_internal_fn.generateDrawBar = function (barIndices, isSub) { c3_chart_internal_fn.generateDrawBar = function (barIndices, isSub) {
var $$ = this, config = $$.config, var $$ = this, config = $$.config,
...@@ -4199,9 +4199,9 @@ ...@@ -4199,9 +4199,9 @@
c3_chart_internal_fn.updateAxisLabels = function (withTransition) { c3_chart_internal_fn.updateAxisLabels = function (withTransition) {
var $$ = this; var $$ = this;
var axisXLabel = $$.main.select('.' + CLASS[axisX] + ' .' + CLASS[axisXLabel]), var axisXLabel = $$.main.select('.' + CLASS[_axisX] + ' .' + CLASS[_axisXLabel]),
axisYLabel = $$.main.select('.' + CLASS[axisY] + ' .' + CLASS[axisYLabel]), axisYLabel = $$.main.select('.' + CLASS[_axisY] + ' .' + CLASS[_axisYLabel]),
axisY2Label = $$.main.select('.' + CLASS[axisY2] + ' .' + CLASS[axisY2Label]); axisY2Label = $$.main.select('.' + CLASS[_axisY2] + ' .' + CLASS[_axisY2Label]);
(withTransition ? axisXLabel.transition() : axisXLabel) (withTransition ? axisXLabel.transition() : axisXLabel)
.attr("x", generateCall($$.xForXAxisLabel, $$)) .attr("x", generateCall($$.xForXAxisLabel, $$))
.attr("dx", generateCall($$.dxForXAxisLabel, $$)) .attr("dx", generateCall($$.dxForXAxisLabel, $$))
...@@ -4427,8 +4427,8 @@ ...@@ -4427,8 +4427,8 @@
c3_chart_internal_fn.expandArc = function (id, withoutFadeOut) { c3_chart_internal_fn.expandArc = function (id, withoutFadeOut) {
var $$ = this, var $$ = this,
target = $$.svg.selectAll('.' + CLASS[chartArc] + $$.selectorTarget(id)), target = $$.svg.selectAll('.' + CLASS[_chartArc] + $$.selectorTarget(id)),
noneTargets = $$.svg.selectAll('.' + CLASS[arc]).filter(function (data) { return data.data.id !== id; }); noneTargets = $$.svg.selectAll('.' + CLASS[_arc]).filter(function (data) { return data.data.id !== id; });
if ($$.shouldExpand(id)) { if ($$.shouldExpand(id)) {
target.selectAll('path') target.selectAll('path')
...@@ -4449,11 +4449,11 @@ ...@@ -4449,11 +4449,11 @@
c3_chart_internal_fn.unexpandArc = function (id) { c3_chart_internal_fn.unexpandArc = function (id) {
var $$ = this, var $$ = this,
target = $$.svg.selectAll('.' + CLASS[chartArc] + $$.selectorTarget(id)); target = $$.svg.selectAll('.' + CLASS[_chartArc] + $$.selectorTarget(id));
target.selectAll('path.' + CLASS[arc]) target.selectAll('path.' + CLASS[_arc])
.transition().duration(50) .transition().duration(50)
.attr("d", $$.svgArc); .attr("d", $$.svgArc);
$$.svg.selectAll('.' + CLASS[arc]) $$.svg.selectAll('.' + CLASS[_arc])
.style("opacity", 1); .style("opacity", 1);
}; };
...@@ -4501,7 +4501,7 @@ ...@@ -4501,7 +4501,7 @@
c3_chart_internal_fn.updateTargetsForArc = function (targets) { c3_chart_internal_fn.updateTargetsForArc = function (targets) {
var $$ = this, main = $$.main, mainPieUpdate, mainPieEnter; var $$ = this, main = $$.main, mainPieUpdate, mainPieEnter;
mainPieUpdate = main.select('.' + CLASS[chartArcs]).selectAll('.' + CLASS[chartArc]) mainPieUpdate = main.select('.' + CLASS[_chartArcs]).selectAll('.' + CLASS[_chartArc])
.data($$.pie(targets)) .data($$.pie(targets))
.attr("class", generateCall($$.classChartArc, $$)); .attr("class", generateCall($$.classChartArc, $$));
mainPieEnter = mainPieUpdate.enter().append("g") mainPieEnter = mainPieUpdate.enter().append("g")
...@@ -4519,11 +4519,11 @@ ...@@ -4519,11 +4519,11 @@
c3_chart_internal_fn.initArc = function () { c3_chart_internal_fn.initArc = function () {
var $$ = this, arcs; var $$ = this, arcs;
arcs = $$.main.select('.' + CLASS[chart]).append("g") arcs = $$.main.select('.' + CLASS[_chart]).append("g")
.attr("class", CLASS[chartArcs]) .attr("class", CLASS[_chartArcs])
.attr("transform", $$.translate.arc); .attr("transform", $$.translate.arc);
arcs.append('text') arcs.append('text')
.attr('class', CLASS[chartArcsTitle]) .attr('class', CLASS[_chartArcsTitle])
.style("text-anchor", "middle") .style("text-anchor", "middle")
.text($$.getArcTitle()); .text($$.getArcTitle());
}; };
...@@ -4531,7 +4531,7 @@ ...@@ -4531,7 +4531,7 @@
c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransform) { c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransform) {
var $$ = this, d3 = $$.d3, config = $$.config, main = $$.main, var $$ = this, d3 = $$.d3, config = $$.config, main = $$.main,
mainArc; mainArc;
mainArc = main.selectAll('.' + CLASS[arcs]).selectAll('.' + CLASS[arc]) mainArc = main.selectAll('.' + CLASS[_arcs]).selectAll('.' + CLASS[_arc])
.data(generateCall($$.arcData, $$)); .data(generateCall($$.arcData, $$));
mainArc.enter().append('path') mainArc.enter().append('path')
.attr("class", generateCall($$.classArc, $$)) .attr("class", generateCall($$.classArc, $$))
...@@ -4614,14 +4614,14 @@ ...@@ -4614,14 +4614,14 @@
mainArc.exit().transition().duration(durationForExit) mainArc.exit().transition().duration(durationForExit)
.style('opacity', 0) .style('opacity', 0)
.remove(); .remove();
main.selectAll('.' + CLASS[chartArc]).select('text') main.selectAll('.' + CLASS[_chartArc]).select('text')
.style("opacity", 0) .style("opacity", 0)
.attr('class', function (d) { return $$.isGaugeType(d.data) ? CLASS[gaugeValue] : ''; }) .attr('class', function (d) { return $$.isGaugeType(d.data) ? CLASS[_gaugeValue] : ''; })
.text(generateCall($$.textForArcLabel, $$)) .text(generateCall($$.textForArcLabel, $$))
.attr("transform", generateCall($$.transformForArcLabel, $$)) .attr("transform", generateCall($$.transformForArcLabel, $$))
.transition().duration(duration) .transition().duration(duration)
.style("opacity", function (d) { return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? 1 : 0; }); .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); .style("opacity", $$.hasType('donut') || $$.hasType('gauge') ? 1 : 0);
}; };
...@@ -4632,7 +4632,7 @@ ...@@ -4632,7 +4632,7 @@
var $$ = this, config = $$.config, arcs; var $$ = this, config = $$.config, arcs;
if ($$.hasType('gauge')) { if ($$.hasType('gauge')) {
arcs.append('path') arcs.append('path')
.attr("class", CLASS[chartArcsBackground]) .attr("class", CLASS[_chartArcsBackground])
.attr("d", function () { .attr("d", function () {
var d = { var d = {
data: [{value: config[__gauge_max]}], data: [{value: config[__gauge_max]}],
...@@ -4643,21 +4643,21 @@ ...@@ -4643,21 +4643,21 @@
}); });
arcs.append("text") arcs.append("text")
.attr("dy", ".75em") .attr("dy", ".75em")
.attr("class", CLASS[chartArcsGaugeUnit]) .attr("class", CLASS[_chartArcsGaugeUnit])
.style("text-anchor", "middle") .style("text-anchor", "middle")
.style("pointer-events", "none") .style("pointer-events", "none")
.text(config[__gauge_label_show] ? config[__gauge_units] : ''); .text(config[__gauge_label_show] ? config[__gauge_units] : '');
arcs.append("text") arcs.append("text")
.attr("dx", -1 * ($$.innerRadius + (($$.radius - $$.innerRadius) / 2)) + "px") .attr("dx", -1 * ($$.innerRadius + (($$.radius - $$.innerRadius) / 2)) + "px")
.attr("dy", "1.2em") .attr("dy", "1.2em")
.attr("class", CLASS[chartArcsGaugeMin]) .attr("class", CLASS[_chartArcsGaugeMin])
.style("text-anchor", "middle") .style("text-anchor", "middle")
.style("pointer-events", "none") .style("pointer-events", "none")
.text(config[__gauge_label_show] ? config[__gauge_min] : ''); .text(config[__gauge_label_show] ? config[__gauge_min] : '');
arcs.append("text") arcs.append("text")
.attr("dx", $$.innerRadius + (($$.radius - $$.innerRadius) / 2) + "px") .attr("dx", $$.innerRadius + (($$.radius - $$.innerRadius) / 2) + "px")
.attr("dy", "1.2em") .attr("dy", "1.2em")
.attr("class", CLASS[chartArcsGaugeMax]) .attr("class", CLASS[_chartArcsGaugeMax])
.style("text-anchor", "middle") .style("text-anchor", "middle")
.style("pointer-events", "none") .style("pointer-events", "none")
.text(config[__gauge_label_show] ? config[__gauge_max] : ''); .text(config[__gauge_label_show] ? config[__gauge_max] : '');
...@@ -4691,7 +4691,7 @@ ...@@ -4691,7 +4691,7 @@
var $$ = this, d3 = $$.d3; var $$ = this, d3 = $$.d3;
$$.brush = d3.svg.brush().on("brush", function () { $$.redrawForBrush(); }); $$.brush = d3.svg.brush().on("brush", function () { $$.redrawForBrush(); });
$$.brush.update = function () { $$.brush.update = function () {
if ($$.context) { $$.context.select('.' + $$.CLASS[brush]).call(this); } if ($$.context) { $$.context.select('.' + $$.CLASS[_brush]).call(this); }
return this; return this;
}; };
$$.brush.scale = function (scale) { $$.brush.scale = function (scale) {
...@@ -4709,20 +4709,20 @@ ...@@ -4709,20 +4709,20 @@
// Define g for chart area // Define g for chart area
context.append('g') context.append('g')
.attr("clip-path", $$.clipPath) .attr("clip-path", $$.clipPath)
.attr('class', CLASS[chart]); .attr('class', CLASS[_chart]);
// Define g for bar chart area // Define g for bar chart area
context.select('.' + CLASS[chart]).append("g") context.select('.' + CLASS[_chart]).append("g")
.attr("class", CLASS[chartBars]); .attr("class", CLASS[_chartBars]);
// Define g for line chart area // Define g for line chart area
context.select('.' + CLASS[chart]).append("g") context.select('.' + CLASS[_chart]).append("g")
.attr("class", CLASS[chartLines]); .attr("class", CLASS[_chartLines]);
// Add extent rect for Brush // Add extent rect for Brush
context.append("g") context.append("g")
.attr("clip-path", $$.clipPath) .attr("clip-path", $$.clipPath)
.attr("class", CLASS[brush]) .attr("class", CLASS[_brush])
.call($$.brush) .call($$.brush)
.selectAll("rect") .selectAll("rect")
.attr(config[__axis_rotated] ? "width" : "height", config[__axis_rotated] ? $$.width2 : $$.height2); .attr(config[__axis_rotated] ? "width" : "height", config[__axis_rotated] ? $$.width2 : $$.height2);
...@@ -4730,7 +4730,7 @@ ...@@ -4730,7 +4730,7 @@
// ATTENTION: This must be called AFTER chart added // ATTENTION: This must be called AFTER chart added
// Add Axis // Add Axis
$$.axes.subx = context.append("g") $$.axes.subx = context.append("g")
.attr("class", CLASS[axisX]) .attr("class", CLASS[_axisX])
.attr("transform", $$.translate.subx) .attr("transform", $$.translate.subx)
.attr("clip-path", config[__axis_rotated] ? "" : $$.clipPathForXAxis); .attr("clip-path", config[__axis_rotated] ? "" : $$.clipPathForXAxis);
}; };
...@@ -4740,7 +4740,7 @@ ...@@ -4740,7 +4740,7 @@
if (config[__subchart_show]) { if (config[__subchart_show]) {
contextBarUpdate = context.select('.' + CLASS[chartBars]).selectAll('.' + CLASS[chartBar]) contextBarUpdate = context.select('.' + CLASS[_chartBars]).selectAll('.' + CLASS[_chartBar])
.data(targets) .data(targets)
.attr('class', generateCall($$.classChartBar, $$)); .attr('class', generateCall($$.classChartBar, $$));
contextBarEnter = contextBarUpdate.enter().append('g') contextBarEnter = contextBarUpdate.enter().append('g')
...@@ -4751,7 +4751,7 @@ ...@@ -4751,7 +4751,7 @@
.attr("class", generateCall($$.classBars, $$)); .attr("class", generateCall($$.classBars, $$));
//-- Line --// //-- Line --//
contextLineUpdate = context.select('.' + CLASS[chartLines]).selectAll('.' + CLASS[chartLine]) contextLineUpdate = context.select('.' + CLASS[_chartLines]).selectAll('.' + CLASS[_chartLine])
.data(targets) .data(targets)
.attr('class', generateCall($$.classChartLine, $$)); .attr('class', generateCall($$.classChartLine, $$));
contextLineEnter = contextLineUpdate.enter().append('g') contextLineEnter = contextLineUpdate.enter().append('g')
...@@ -4792,7 +4792,7 @@ ...@@ -4792,7 +4792,7 @@
drawBarOnSub = $$.generateDrawBar(barIndices, true); drawBarOnSub = $$.generateDrawBar(barIndices, true);
drawLineOnSub = $$.generateDrawLine(lineIndices, true); drawLineOnSub = $$.generateDrawLine(lineIndices, true);
// bars // bars
contextBar = context.selectAll('.' + CLASS[bars]).selectAll('.' + CLASS[bar]) contextBar = context.selectAll('.' + CLASS[_bars]).selectAll('.' + CLASS[_bar])
.data(generateCall($$.barData, $$)); .data(generateCall($$.barData, $$));
contextBar.enter().append('path') contextBar.enter().append('path')
.attr("class", generateCall($$.classBar, $$)) .attr("class", generateCall($$.classBar, $$))
...@@ -4807,7 +4807,7 @@ ...@@ -4807,7 +4807,7 @@
.style('opacity', 0) .style('opacity', 0)
.remove(); .remove();
// lines // lines
contextLine = context.selectAll('.' + CLASS[lines]).selectAll('.' + CLASS[line]) contextLine = context.selectAll('.' + CLASS[_lines]).selectAll('.' + CLASS[_line])
.data(generateCall($$.lineData, $$)); .data(generateCall($$.lineData, $$));
contextLine.enter().append('path') contextLine.enter().append('path')
.attr('class', generateCall($$.classLine, $$)) .attr('class', generateCall($$.classLine, $$))
...@@ -4821,7 +4821,7 @@ ...@@ -4821,7 +4821,7 @@
.style('opacity', 0) .style('opacity', 0)
.remove(); .remove();
// area // area
contextArea = context.selectAll('.' + CLASS[areas]).selectAll('.' + CLASS[area]) contextArea = context.selectAll('.' + CLASS[_areas]).selectAll('.' + CLASS[_area])
.data(generateCall($$.lineData, $$)); .data(generateCall($$.lineData, $$));
contextArea.enter().append('path') contextArea.enter().append('path')
.attr("class", generateCall($$.classArea, $$)) .attr("class", generateCall($$.classArea, $$))
...@@ -4854,7 +4854,7 @@ ...@@ -4854,7 +4854,7 @@
if (transitions && transitions.axisSubX) { if (transitions && transitions.axisSubX) {
subXAxis = transitions.axisSubX; subXAxis = transitions.axisSubX;
} else { } else {
subXAxis = $$.context.select('.' + CLASS[axisX]); subXAxis = $$.context.select('.' + CLASS[_axisX]);
if (withTransition) { subXAxis = subXAxis.transition(); } if (withTransition) { subXAxis = subXAxis.transition(); }
} }
$$.context.attr("transform", $$.translate.context); $$.context.attr("transform", $$.translate.context);
...@@ -4867,8 +4867,8 @@ ...@@ -4867,8 +4867,8 @@
*/ */
c3_chart_internal_fn.updateZoom = function () { c3_chart_internal_fn.updateZoom = function () {
var $$ = this, z = $$.config[__zoom_enabled] ? $$.zoom : function () {}; var $$ = this, z = $$.config[__zoom_enabled] ? $$.zoom : function () {};
$$.main.select('.' + $$.CLASS[zoomRect]).call(z); $$.main.select('.' + $$.CLASS[_zoomRect]).call(z);
$$.main.selectAll('.' + $$.CLASS[eventRect]).call(z); $$.main.selectAll('.' + $$.CLASS[_eventRect]).call(z);
}; };
...@@ -4947,10 +4947,10 @@ ...@@ -4947,10 +4947,10 @@
var $$ = this, config = $$.config; var $$ = this, config = $$.config;
config[__data_onselected](d, target.node()); config[__data_onselected](d, target.node());
// add selected-circle on low layer g // 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]) .data([d])
.enter().append('circle') .enter().append('circle')
.attr("class", function () { return $$.generateClass(CLASS[selectedCircle], i); }) .attr("class", function () { return $$.generateClass(CLASS[_selectedCircle], i); })
.attr("cx", config[__axis_rotated] ? $$.circleY : $$.circleX) .attr("cx", config[__axis_rotated] ? $$.circleY : $$.circleX)
.attr("cy", config[__axis_rotated] ? $$.circleX : $$.circleY) .attr("cy", config[__axis_rotated] ? $$.circleX : $$.circleY)
.attr("stroke", function () { return $$.color(d); }) .attr("stroke", function () { return $$.color(d); })
...@@ -4962,7 +4962,7 @@ ...@@ -4962,7 +4962,7 @@
var $$ = this; var $$ = this;
$$.config[__data_onunselected](d, target.node()); $$.config[__data_onunselected](d, target.node());
// remove selected-circle from low layer g // 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) .transition().duration(100).attr('r', 0)
.remove(); .remove();
}; };
...@@ -4990,17 +4990,17 @@ ...@@ -4990,17 +4990,17 @@
c3_chart_internal_fn.getToggle = function (that) { c3_chart_internal_fn.getToggle = function (that) {
var $$ = this; var $$ = this;
// path selection not supported yet // 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) { c3_chart_internal_fn.toggleShape = function (that, d, i) {
var $$ = this, d3 = $$.d3, config = $$.config, 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') { if (that.nodeName === 'circle') {
isWithin = $$.isWithinCircle(that, $$.pointSelectR(d) * 1.5); isWithin = $$.isWithinCircle(that, $$.pointSelectR(d) * 1.5);
toggle = $$.togglePoint; toggle = $$.togglePoint;
} }
else if (that.nodeName === 'path') { else if (that.nodeName === 'path') {
if (shape.classed(CLASS[bar])) { if (shape.classed(CLASS[_bar])) {
isWithin = $$.isWithinBar(that); isWithin = $$.isWithinBar(that);
toggle = $$.toggleBar; toggle = $$.toggleBar;
} else { // would be arc } else { // would be arc
...@@ -5011,12 +5011,12 @@ ...@@ -5011,12 +5011,12 @@
if (config[__data_selection_grouped] || isWithin) { if (config[__data_selection_grouped] || isWithin) {
if (config[__data_selection_enabled] && config[__data_selection_isselectable](d)) { if (config[__data_selection_enabled] && config[__data_selection_isselectable](d)) {
if (!config[__data_selection_multiple]) { 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); var shape = d3.select(this);
if (shape.classed(CLASS[SELECTED])) { toggle(false, shape.classed(CLASS[SELECTED], false), d, i); } if (shape.classed(CLASS[_SELECTED])) { toggle(false, shape.classed(CLASS[_SELECTED], false), d, i); }
}); });
} }
shape.classed(CLASS[SELECTED], !isSelected); shape.classed(CLASS[_SELECTED], !isSelected);
toggle(!isSelected, shape, d, i); toggle(!isSelected, shape, d, i);
} }
$$.config[__data_onclick](d, that); $$.config[__data_onclick](d, that);
...@@ -5090,234 +5090,234 @@ ...@@ -5090,234 +5090,234 @@
/** /**
* c3.class.js * c3.class.js
*/ */
var target = 'target', var _target = 'target',
chart = 'chart ', _chart = 'chart ',
chartLine = 'chartLine', _chartLine = 'chartLine',
chartLines = 'chartLines', _chartLines = 'chartLines',
chartBar = 'chartBar', _chartBar = 'chartBar',
chartBars = 'chartBars', _chartBars = 'chartBars',
chartText = 'chartText', _chartText = 'chartText',
chartTexts = 'chartTexts', _chartTexts = 'chartTexts',
chartArc = 'chartArc', _chartArc = 'chartArc',
chartArcs = 'chartArcs', _chartArcs = 'chartArcs',
chartArcsTitle = 'chartArcsTitle', _chartArcsTitle = 'chartArcsTitle',
chartArcsBackground = 'chartArcsBackground', _chartArcsBackground = 'chartArcsBackground',
chartArcsGaugeUnit = 'chartArcsGaugeUnit', _chartArcsGaugeUnit = 'chartArcsGaugeUnit',
chartArcsGaugeMax = 'chartArcsGaugeMax', _chartArcsGaugeMax = 'chartArcsGaugeMax',
chartArcsGaugeMin = 'chartArcsGaugeMin', _chartArcsGaugeMin = 'chartArcsGaugeMin',
selectedCircle = 'selectedCircle', _selectedCircle = 'selectedCircle',
selectedCircles = 'selectedCircles', _selectedCircles = 'selectedCircles',
eventRect = 'eventRect', _eventRect = 'eventRect',
eventRects = 'eventRects', _eventRects = 'eventRects',
eventRectsSingle = 'eventRectsSingle', _eventRectsSingle = 'eventRectsSingle',
eventRectsMultiple = 'eventRectsMultiple', _eventRectsMultiple = 'eventRectsMultiple',
zoomRect = 'zoomRect', _zoomRect = 'zoomRect',
brush = 'brush', _brush = 'brush',
focused = 'focused', _focused = 'focused',
region = 'region', _region = 'region',
regions = 'regions', _regions = 'regions',
tooltip = 'tooltip', _tooltip = 'tooltip',
tooltipName = 'tooltipName', _tooltipName = 'tooltipName',
shape = 'shape', _shape = 'shape',
shapes = 'shapes', _shapes = 'shapes',
line = 'line', _line = 'line',
lines = 'lines', _lines = 'lines',
bar = 'bar', _bar = 'bar',
bars = 'bars', _bars = 'bars',
circle = 'circle', _circle = 'circle',
circles = 'circles', _circles = 'circles',
arc = 'arc', _arc = 'arc',
arcs = 'arcs', _arcs = 'arcs',
area = 'area', _area = 'area',
areas = 'areas', _areas = 'areas',
empty = 'empty', _empty = 'empty',
text = 'text', _text = 'text',
texts = 'texts', _texts = 'texts',
gaugeValue = 'gaugeValue', _gaugeValue = 'gaugeValue',
grid = 'grid', _grid = 'grid',
xgrid = 'xgrid', _xgrid = 'xgrid',
xgrids = 'xgrids', _xgrids = 'xgrids',
xgridLine = 'xgridLine', _xgridLine = 'xgridLine',
xgridLines = 'xgridLines', _xgridLines = 'xgridLines',
xgridFocus = 'xgridFocus', _xgridFocus = 'xgridFocus',
ygrid = 'ygrid', _ygrid = 'ygrid',
ygrids = 'ygrids', _ygrids = 'ygrids',
ygridLine = 'ygridLine', _ygridLine = 'ygridLine',
ygridLines = 'ygridLines', _ygridLines = 'ygridLines',
axis = 'axis', _axis = 'axis',
axisX = 'axisX', _axisX = 'axisX',
axisXLabel = 'axisXLabel', _axisXLabel = 'axisXLabel',
axisY = 'axisY', _axisY = 'axisY',
axisYLabel = 'axisYLabel', _axisYLabel = 'axisYLabel',
axisY2 = 'axisY2', _axisY2 = 'axisY2',
axisY2Label = 'axisY2Label', _axisY2Label = 'axisY2Label',
legendBackground = 'legendBackground', _legendBackground = 'legendBackground',
legendItem = 'legendItem', _legendItem = 'legendItem',
legendItemEvent = 'legendItemEvent', _legendItemEvent = 'legendItemEvent',
legendItemTile = 'legendItemTile', _legendItemTile = 'legendItemTile',
legendItemHidden = 'legendItemHidden', _legendItemHidden = 'legendItemHidden',
legendItemFocused = 'legendItemFocused', _legendItemFocused = 'legendItemFocused',
dragarea = 'dragarea', _dragarea = 'dragarea',
EXPANDED = 'EXPANDED', _EXPANDED = 'EXPANDED',
SELECTED = 'SELECTED', _SELECTED = 'SELECTED',
INCLUDED = 'INCLUDED'; _INCLUDED = 'INCLUDED';
var CLASS = c3_chart_internal_fn.CLASS = {}; var CLASS = c3_chart_internal_fn.CLASS = {};
CLASS[target] = 'c3-target'; CLASS[_target] = 'c3-target';
CLASS[chart] = 'c3-chart'; CLASS[_chart] = 'c3-chart';
CLASS[chartLine] = 'c3-chart-line'; CLASS[_chartLine] = 'c3-chart-line';
CLASS[chartLines] = 'c3-chart-lines'; CLASS[_chartLines] = 'c3-chart-lines';
CLASS[chartBar] = 'c3-chart-bar'; CLASS[_chartBar] = 'c3-chart-bar';
CLASS[chartBars] = 'c3-chart-bars'; CLASS[_chartBars] = 'c3-chart-bars';
CLASS[chartText] = 'c3-chart-text'; CLASS[_chartText] = 'c3-chart-text';
CLASS[chartTexts] = 'c3-chart-texts'; CLASS[_chartTexts] = 'c3-chart-texts';
CLASS[chartArc] = 'c3-chart-arc'; CLASS[_chartArc] = 'c3-chart-arc';
CLASS[chartArcs] = 'c3-chart-arcs'; CLASS[_chartArcs] = 'c3-chart-arcs';
CLASS[chartArcsTitle] = 'c3-chart-arcs-title'; CLASS[_chartArcsTitle] = 'c3-chart-arcs-title';
CLASS[chartArcsBackground] = 'c3-chart-arcs-background'; CLASS[_chartArcsBackground] = 'c3-chart-arcs-background';
CLASS[chartArcsGaugeUnit] = 'c3-chart-arcs-gauge-unit'; CLASS[_chartArcsGaugeUnit] = 'c3-chart-arcs-gauge-unit';
CLASS[chartArcsGaugeMax] = 'c3-chart-arcs-gauge-max'; CLASS[_chartArcsGaugeMax] = 'c3-chart-arcs-gauge-max';
CLASS[chartArcsGaugeMin] = 'c3-chart-arcs-gauge-min'; CLASS[_chartArcsGaugeMin] = 'c3-chart-arcs-gauge-min';
CLASS[selectedCircle] = 'c3-selected-circle'; CLASS[_selectedCircle] = 'c3-selected-circle';
CLASS[selectedCircles] = 'c3-selected-circles'; CLASS[_selectedCircles] = 'c3-selected-circles';
CLASS[eventRect] = 'c3-event-rect'; CLASS[_eventRect] = 'c3-event-rect';
CLASS[eventRects] = 'c3-event-rects'; CLASS[_eventRects] = 'c3-event-rects';
CLASS[eventRectsSingle] = 'c3-event-rects-single'; CLASS[_eventRectsSingle] = 'c3-event-rects-single';
CLASS[eventRectsMultiple] = 'c3-event-rects-multiple'; CLASS[_eventRectsMultiple] = 'c3-event-rects-multiple';
CLASS[zoomRect] = 'c3-zoom-rect'; CLASS[_zoomRect] = 'c3-zoom-rect';
CLASS[brush] = 'c3-brush'; CLASS[_brush] = 'c3-brush';
CLASS[focused] = 'c3-focused'; CLASS[_focused] = 'c3-focused';
CLASS[region] = 'c3-region'; CLASS[_region] = 'c3-region';
CLASS[regions] = 'c3-regions'; CLASS[_regions] = 'c3-regions';
CLASS[tooltip] = 'c3-tooltip'; CLASS[_tooltip] = 'c3-tooltip';
CLASS[tooltipName] = 'c3-tooltip-name'; CLASS[_tooltipName] = 'c3-tooltip-name';
CLASS[shape] = 'c3-shape'; CLASS[_shape] = 'c3-shape';
CLASS[shapes] = 'c3-shapes'; CLASS[_shapes] = 'c3-shapes';
CLASS[line] = 'c3-line'; CLASS[_line] = 'c3-line';
CLASS[lines] = 'c3-lines'; CLASS[_lines] = 'c3-lines';
CLASS[bar] = 'c3-bar'; CLASS[_bar] = 'c3-bar';
CLASS[bars] = 'c3-bars'; CLASS[_bars] = 'c3-bars';
CLASS[circle] = 'c3-circle'; CLASS[_circle] = 'c3-circle';
CLASS[circles] = 'c3-circles'; CLASS[_circles] = 'c3-circles';
CLASS[arc] = 'c3-arc'; CLASS[_arc] = 'c3-arc';
CLASS[arcs] = 'c3-arcs'; CLASS[_arcs] = 'c3-arcs';
CLASS[area] = 'c3-area'; CLASS[_area] = 'c3-area';
CLASS[areas] = 'c3-areas'; CLASS[_areas] = 'c3-areas';
CLASS[empty] = 'c3-empty'; CLASS[_empty] = 'c3-empty';
CLASS[text] = 'c3-text'; CLASS[_text] = 'c3-text';
CLASS[texts] = 'c3-texts'; CLASS[_texts] = 'c3-texts';
CLASS[gaugeValue] = 'c3-gauge-value'; CLASS[_gaugeValue] = 'c3-gauge-value';
CLASS[grid] = 'c3-grid'; CLASS[_grid] = 'c3-grid';
CLASS[xgrid] = 'c3-xgrid'; CLASS[_xgrid] = 'c3-xgrid';
CLASS[xgrids] = 'c3-xgrids'; CLASS[_xgrids] = 'c3-xgrids';
CLASS[xgridLine] = 'c3-xgrid-line'; CLASS[_xgridLine] = 'c3-xgrid-line';
CLASS[xgridLines] = 'c3-xgrid-lines'; CLASS[_xgridLines] = 'c3-xgrid-lines';
CLASS[xgridFocus] = 'c3-xgrid-focus'; CLASS[_xgridFocus] = 'c3-xgrid-focus';
CLASS[ygrid] = 'c3-ygrid'; CLASS[_ygrid] = 'c3-ygrid';
CLASS[ygrids] = 'c3-ygrids'; CLASS[_ygrids] = 'c3-ygrids';
CLASS[ygridLine] = 'c3-ygrid-line'; CLASS[_ygridLine] = 'c3-ygrid-line';
CLASS[ygridLines] = 'c3-ygrid-lines'; CLASS[_ygridLines] = 'c3-ygrid-lines';
CLASS[axis] = 'c3-axis'; CLASS[_axis] = 'c3-axis';
CLASS[axisX] = 'c3-axis-x'; CLASS[_axisX] = 'c3-axis-x';
CLASS[axisXLabel] = 'c3-axis-x-label'; CLASS[_axisXLabel] = 'c3-axis-x-label';
CLASS[axisY] = 'c3-axis-y'; CLASS[_axisY] = 'c3-axis-y';
CLASS[axisYLabel] = 'c3-axis-y-label'; CLASS[_axisYLabel] = 'c3-axis-y-label';
CLASS[axisY2] = 'c3-axis-y2'; CLASS[_axisY2] = 'c3-axis-y2';
CLASS[axisY2Label] = 'c3-axis-y2-label'; CLASS[_axisY2Label] = 'c3-axis-y2-label';
CLASS[legendBackground] = 'c3-legend-background'; CLASS[_legendBackground] = 'c3-legend-background';
CLASS[legendItem] = 'c3-legend-item'; CLASS[_legendItem] = 'c3-legend-item';
CLASS[legendItemEvent] = 'c3-legend-item-event'; CLASS[_legendItemEvent] = 'c3-legend-item-event';
CLASS[legendItemTile] = 'c3-legend-item-tile'; CLASS[_legendItemTile] = 'c3-legend-item-tile';
CLASS[legendItemHidden] = 'c3-legend-item-hidden'; CLASS[_legendItemHidden] = 'c3-legend-item-hidden';
CLASS[legendItemFocused] = 'c3-legend-item-focused'; CLASS[_legendItemFocused] = 'c3-legend-item-focused';
CLASS[dragarea] = 'c3-dragarea'; CLASS[_dragarea] = 'c3-dragarea';
CLASS[EXPANDED] = '_expanded_'; CLASS[_EXPANDED] = '_expanded_';
CLASS[SELECTED] = '_selected_'; CLASS[_SELECTED] = '_selected_';
CLASS[INCLUDED] = '_included_'; CLASS[_INCLUDED] = '_included_';
c3_chart_internal_fn.generateClass = function (prefix, targetId) { c3_chart_internal_fn.generateClass = function (prefix, targetId) {
return " " + prefix + " " + prefix + this.getTargetSelectorSuffix(targetId); return " " + prefix + " " + prefix + this.getTargetSelectorSuffix(targetId);
}; };
c3_chart_internal_fn.classText = function (d) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { c3_chart_internal_fn.classTarget = function (id) {
var $$ = this; var $$ = this;
var additionalClassSuffix = $$.config[__data_classes][id], additionalClass = ''; var additionalClassSuffix = $$.config[__data_classes][id], additionalClass = '';
if (additionalClassSuffix) { 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) { 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) { 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) { 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) { 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) { c3_chart_internal_fn.getTargetSelectorSuffix = function (targetId) {
return targetId || targetId === 0 ? '-' + (targetId.replace ? targetId.replace(/([^a-zA-Z0-9-_])/g, '-') : targetId) : ''; return targetId || targetId === 0 ? '-' + (targetId.replace ? targetId.replace(/([^a-zA-Z0-9-_])/g, '-') : targetId) : '';
}; };
c3_chart_internal_fn.selectorTarget = function (id) { 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) { c3_chart_internal_fn.selectorTargets = function (ids) {
var $$ = this; var $$ = this;
return ids.length ? ids.map(function (id) { return $$.selectorTarget(id); }) : null; return ids.length ? ids.map(function (id) { return $$.selectorTarget(id); }) : null;
}; };
c3_chart_internal_fn.selectorLegend = function (id) { 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) { c3_chart_internal_fn.selectorLegends = function (ids) {
var $$ = this; var $$ = this;
...@@ -5391,26 +5391,26 @@ ...@@ -5391,26 +5391,26 @@
minY = (config[__data_selection_grouped]) ? $$.margin.top : Math.min(sy, my); minY = (config[__data_selection_grouped]) ? $$.margin.top : Math.min(sy, my);
maxY = (config[__data_selection_grouped]) ? $$.height : Math.max(sy, my); maxY = (config[__data_selection_grouped]) ? $$.height : Math.max(sy, my);
main.select('.' + CLASS[dragarea]) main.select('.' + CLASS[_dragarea])
.attr('x', minX) .attr('x', minX)
.attr('y', minY) .attr('y', minY)
.attr('width', maxX - minX) .attr('width', maxX - minX)
.attr('height', maxY - minY); .attr('height', maxY - minY);
// TODO: binary search when multiple xs // 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); }) .filter(function (d) { return config[__data_selection_isselectable](d); })
.each(function (d, i) { .each(function (d, i) {
var shape = d3.select(this), var shape = d3.select(this),
isSelected = shape.classed(CLASS[SELECTED]), isSelected = shape.classed(CLASS[_SELECTED]),
isIncluded = shape.classed(CLASS[INCLUDED]), isIncluded = shape.classed(CLASS[_INCLUDED]),
_x, _y, _w, _h, toggle, isWithin = false, box; _x, _y, _w, _h, toggle, isWithin = false, box;
if (shape.classed(CLASS[circle])) { if (shape.classed(CLASS[_circle])) {
_x = shape.attr("cx") * 1; _x = shape.attr("cx") * 1;
_y = shape.attr("cy") * 1; _y = shape.attr("cy") * 1;
toggle = $$.togglePoint; toggle = $$.togglePoint;
isWithin = minX < _x && _x < maxX && minY < _y && _y < maxY; isWithin = minX < _x && _x < maxX && minY < _y && _y < maxY;
} }
else if (shape.classed(CLASS[bar])) { else if (shape.classed(CLASS[_bar])) {
box = getPathBox(this); box = getPathBox(this);
_x = box.x; _x = box.x;
_y = box.y; _y = box.y;
...@@ -5423,9 +5423,9 @@ ...@@ -5423,9 +5423,9 @@
return; return;
} }
if (isWithin ^ isIncluded) { if (isWithin ^ isIncluded) {
shape.classed(CLASS[INCLUDED], !isIncluded); shape.classed(CLASS[_INCLUDED], !isIncluded);
// TODO: included/unincluded callback here // TODO: included/unincluded callback here
shape.classed(CLASS[SELECTED], !isSelected); shape.classed(CLASS[_SELECTED], !isSelected);
$$.toggle(!isSelected, shape, d, i); $$.toggle(!isSelected, shape, d, i);
} }
}); });
...@@ -5436,8 +5436,8 @@ ...@@ -5436,8 +5436,8 @@
if ($$.hasArcType()) { return; } if ($$.hasArcType()) { return; }
if (! config[__data_selection_enabled]) { return; } // do nothing if not selectable if (! config[__data_selection_enabled]) { return; } // do nothing if not selectable
$$.dragStart = mouse; $$.dragStart = mouse;
$$.main.select('.' + CLASS[chart]).append('rect') $$.main.select('.' + CLASS[_chart]).append('rect')
.attr('class', CLASS[dragarea]) .attr('class', CLASS[_dragarea])
.style('opacity', 0.1); .style('opacity', 0.1);
$$.dragging = true; $$.dragging = true;
$$.config[__data_ondragstart](); $$.config[__data_ondragstart]();
...@@ -5447,12 +5447,12 @@ ...@@ -5447,12 +5447,12 @@
var $$ = this, config = $$.config; var $$ = this, config = $$.config;
if ($$.hasArcType()) { return; } if ($$.hasArcType()) { return; }
if (! config[__data_selection_enabled]) { return; } // do nothing if not selectable if (! config[__data_selection_enabled]) { return; } // do nothing if not selectable
$$.main.select('.' + CLASS[dragarea]) $$.main.select('.' + CLASS[_dragarea])
.transition().duration(100) .transition().duration(100)
.style('opacity', 0) .style('opacity', 0)
.remove(); .remove();
$$.main.selectAll('.' + CLASS[shape]) $$.main.selectAll('.' + CLASS[_shape])
.classed(CLASS[INCLUDED], false); .classed(CLASS[_INCLUDED], false);
$$.dragging = false; $$.dragging = false;
$$.config[__data_ondragend](); $$.config[__data_ondragend]();
}; };
...@@ -5474,7 +5474,7 @@ ...@@ -5474,7 +5474,7 @@
} }
this.revert(); this.revert();
this.defocus(); this.defocus();
focus(candidatesForNoneArc.classed(CLASS[focused], true)); focus(candidatesForNoneArc.classed(CLASS[_focused], true));
focus(candidatesForArc); focus(candidatesForArc);
if ($$.hasArcType()) { if ($$.hasArcType()) {
$$.expandArc(targetId, true); $$.expandArc(targetId, true);
...@@ -5491,7 +5491,7 @@ ...@@ -5491,7 +5491,7 @@
$$.filterTargetsToShow(targets).transition().duration(100).style('opacity', 0.3); $$.filterTargetsToShow(targets).transition().duration(100).style('opacity', 0.3);
} }
this.revert(); this.revert();
defocus(candidatesForNoneArc.classed(CLASS[focused], false)); defocus(candidatesForNoneArc.classed(CLASS[_focused], false));
defocus(candidatesForArc); defocus(candidatesForArc);
if ($$.hasArcType()) { if ($$.hasArcType()) {
$$.unexpandArc(targetId); $$.unexpandArc(targetId);
...@@ -5507,7 +5507,7 @@ ...@@ -5507,7 +5507,7 @@
function revert(targets) { function revert(targets) {
$$.filterTargetsToShow(targets).transition().duration(100).style('opacity', 1); $$.filterTargetsToShow(targets).transition().duration(100).style('opacity', 1);
} }
revert(candidatesForNoneArc.classed(CLASS[focused], false)); revert(candidatesForNoneArc.classed(CLASS[_focused], false));
revert(candidatesForArc); revert(candidatesForArc);
if ($$.hasArcType()) { if ($$.hasArcType()) {
$$.unexpandArc(targetId); $$.unexpandArc(targetId);
...@@ -5754,30 +5754,30 @@ ...@@ -5754,30 +5754,30 @@
c3_chart_fn.selected = function (targetId) { c3_chart_fn.selected = function (targetId) {
var $$ = this.internal, d3 = $$.d3; var $$ = this.internal, d3 = $$.d3;
return d3.merge( return d3.merge(
$$.main.selectAll('.' + CLASS[shapes] + $$.getTargetSelectorSuffix(targetId)).selectAll('.' + CLASS[shape]) $$.main.selectAll('.' + CLASS[_shapes] + $$.getTargetSelectorSuffix(targetId)).selectAll('.' + CLASS[_shape])
.filter(function () { return d3.select(this).classed(CLASS[SELECTED]); }) .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; }); }) .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) { c3_chart_fn.select = function (ids, indices, resetOther) {
var $$ = this.internal, d3 = $$.d3, config = $$.config; var $$ = this.internal, d3 = $$.d3, config = $$.config;
if (! config[__data_selection_enabled]) { return; } 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), 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, isTargetId = config[__data_selection_grouped] || !ids || ids.indexOf(id) >= 0,
isTargetIndex = !indices || indices.indexOf(i) >= 0, isTargetIndex = !indices || indices.indexOf(i) >= 0,
isSelected = shape.classed(CLASS[SELECTED]); isSelected = shape.classed(CLASS[_SELECTED]);
// line/area selection not supported yet // 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; return;
} }
if (isTargetId && isTargetIndex) { if (isTargetId && isTargetIndex) {
if (config[__data_selection_isselectable](d) && !isSelected) { 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) { } else if (isDefined(resetOther) && resetOther) {
if (isSelected) { if (isSelected) {
toggle(false, shape.classed(CLASS[SELECTED], false), d, i); toggle(false, shape.classed(CLASS[_SELECTED], false), d, i);
} }
} }
}); });
...@@ -5785,19 +5785,19 @@ ...@@ -5785,19 +5785,19 @@
c3_chart_fn.unselect = function (ids, indices) { c3_chart_fn.unselect = function (ids, indices) {
var $$ = this.internal, d3 = $$.d3, config = $$.config; var $$ = this.internal, d3 = $$.d3, config = $$.config;
if (! config[__data_selection_enabled]) { return; } 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), 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, isTargetId = config[__data_selection_grouped] || !ids || ids.indexOf(id) >= 0,
isTargetIndex = !indices || indices.indexOf(i) >= 0, isTargetIndex = !indices || indices.indexOf(i) >= 0,
isSelected = shape.classed(CLASS[SELECTED]); isSelected = shape.classed(CLASS[_SELECTED]);
// line/area selection not supported yet // 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; return;
} }
if (isTargetId && isTargetIndex) { if (isTargetId && isTargetIndex) {
if (config[__data_selection_isselectable](d)) { if (config[__data_selection_isselectable](d)) {
if (isSelected) { if (isSelected) {
toggle(false, shape.classed(CLASS[SELECTED], false), d, i); toggle(false, shape.classed(CLASS[_SELECTED], false), d, i);
} }
} }
} }
...@@ -5870,9 +5870,9 @@ ...@@ -5870,9 +5870,9 @@
options = options || {}; options = options || {};
duration = $$.getOption(options, "duration", config[__transition_duration]); 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) (duration ? regions.transition().duration(duration) : regions)
.style('opacity', 0) .style('opacity', 0)
.remove(); .remove();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment