Browse Source

Fix option for additional grid lines

pull/104/head
Masayuki Tanaka 11 years ago
parent
commit
9a6c3b3eee
  1. 12
      c3.js
  2. 4
      c3.min.js

12
c3.js

@ -184,11 +184,11 @@
// grid // grid
var __grid_x_show = getConfig(['grid', 'x', 'show'], false), var __grid_x_show = getConfig(['grid', 'x', 'show'], false),
__grid_x_type = getConfig(['grid', 'x', 'type'], 'tick'), __grid_x_type = getConfig(['grid', 'x', 'type'], 'tick'),
__grid_x_lines = getConfig(['grid', 'x', 'lines']), __grid_x_lines = getConfig(['grid', 'x', 'lines'], []),
__grid_y_show = getConfig(['grid', 'y', 'show'], false), __grid_y_show = getConfig(['grid', 'y', 'show'], false),
// not used // not used
// __grid_y_type = getConfig(['grid', 'y', 'type'], 'tick'), // __grid_y_type = getConfig(['grid', 'y', 'type'], 'tick'),
__grid_y_lines = getConfig(['grid', 'y', 'lines']), __grid_y_lines = getConfig(['grid', 'y', 'lines'], []),
__grid_y_ticks = getConfig(['grid', 'y', 'ticks'], 10); __grid_y_ticks = getConfig(['grid', 'y', 'ticks'], 10);
// point - point of each data // point - point of each data
@ -2285,7 +2285,7 @@
if (__grid_x_show) { if (__grid_x_show) {
grid.append("g").attr("class", CLASS.xgrids); grid.append("g").attr("class", CLASS.xgrids);
} }
if (__grid_x_lines) { if (!isEmpty(__grid_x_lines)) {
grid.append('g').attr("class", CLASS.xgridLines); grid.append('g').attr("class", CLASS.xgridLines);
} }
if (__point_focus_line_enabled) { if (__point_focus_line_enabled) {
@ -2303,7 +2303,7 @@
if (__grid_y_show) { if (__grid_y_show) {
grid.append('g').attr('class', CLASS.ygrids); grid.append('g').attr('class', CLASS.ygrids);
} }
if (__grid_y_lines) { if (!isEmpty(__grid_y_lines)) {
grid.append('g').attr('class', CLASS.ygridLines); grid.append('g').attr('class', CLASS.ygridLines);
} }
@ -2788,7 +2788,7 @@
.style("opacity", function () { return +d3.select(this).attr(__axis_rotated ? 'y1' : 'x1') === (__axis_rotated ? height : 0) ? 0 : 1; }); .style("opacity", function () { return +d3.select(this).attr(__axis_rotated ? 'y1' : 'x1') === (__axis_rotated ? height : 0) ? 0 : 1; });
xgrid.exit().remove(); xgrid.exit().remove();
} }
if (__grid_x_lines) { if (!isEmpty(__grid_x_lines)) {
xgridLines = main.select('.' + CLASS.xgridLines).selectAll('.' + CLASS.xgridLine) xgridLines = main.select('.' + CLASS.xgridLines).selectAll('.' + CLASS.xgridLine)
.data(__grid_x_lines); .data(__grid_x_lines);
// enter // enter
@ -2833,7 +2833,7 @@
.attr("y2", __axis_rotated ? height : y); .attr("y2", __axis_rotated ? height : y);
ygrid.exit().remove(); ygrid.exit().remove();
} }
if (withY && __grid_y_lines) { if (withY && !isEmpty(__grid_y_lines)) {
ygridLines = main.select('.' + CLASS.ygridLines).selectAll('.' + CLASS.ygridLine) ygridLines = main.select('.' + CLASS.ygridLines).selectAll('.' + CLASS.ygridLine)
.data(__grid_y_lines); .data(__grid_y_lines);
// enter // enter

4
c3.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save