diff --git a/Gruntfile.coffee b/Gruntfile.coffee
index 5591182..f6dc622 100644
--- a/Gruntfile.coffee
+++ b/Gruntfile.coffee
@@ -83,6 +83,7 @@ module.exports = (grunt) ->
c3: 'c3.js'
spec: 'spec/*.js'
options:
+ reporter: require('jshint-stylish')
jshintrc: '.jshintrc'
karma:
diff --git a/c3.css b/c3.css
index 5de1edf..fda4242 100644
--- a/c3.css
+++ b/c3.css
@@ -1,7 +1,7 @@
/*-- Chart --*/
.c3 svg {
font: 10px sans-serif;
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0); }
+ -webkit-tap-highlight-color: transparent; }
.c3 path, .c3 line {
fill: none;
@@ -12,7 +12,11 @@
-moz-user-select: none;
user-select: none; }
-.c3-legend-item-tile, .c3-xgrid-focus, .c3-ygrid, .c3-event-rect, .c3-bars path {
+.c3-legend-item-tile,
+.c3-xgrid-focus,
+.c3-ygrid,
+.c3-event-rect,
+.c3-bars path {
shape-rendering: crispEdges; }
.c3-chart-arc path {
@@ -71,11 +75,11 @@
/*-- Region --*/
.c3-region {
fill: steelblue;
- fill-opacity: 0.1; }
+ fill-opacity: .1; }
/*-- Brush --*/
.c3-brush .extent {
- fill-opacity: 0.1; }
+ fill-opacity: .1; }
/*-- Select - Drag --*/
/*-- Legend --*/
diff --git a/c3.js b/c3.js
index 050e1a1..cd80b57 100644
--- a/c3.js
+++ b/c3.js
@@ -424,7 +424,7 @@
// for arc
$$.arcWidth = $$.width - ($$.isLegendRight ? legendWidth + 10 : 0);
$$.arcHeight = $$.height - ($$.isLegendRight ? 0 : 10);
- if ($$.hasType('gauge')) {
+ if ($$.hasType('gauge') && !config.gauge_fullCircle) {
$$.arcHeight += $$.height - $$.getGaugeLabelHeight();
}
if ($$.updateRadius) { $$.updateRadius(); }
@@ -1085,6 +1085,7 @@
zoom_onzoomend: function () {},
zoom_x_min: undefined,
zoom_x_max: undefined,
+ interaction_brighten: true,
interaction_enabled: true,
onmouseover: function () {},
onmouseout: function () {},
@@ -1235,17 +1236,21 @@
bar_zerobased: true,
// area
area_zerobased: true,
+ area_above: false,
// pie
pie_label_show: true,
pie_label_format: undefined,
pie_label_threshold: 0.05,
+ pie_label_ratio: undefined,
pie_expand: {},
pie_expand_duration: 50,
// gauge
+ gauge_fullCircle: false,
gauge_label_show: true,
gauge_label_format: undefined,
gauge_min: 0,
gauge_max: 100,
+ gauge_startingAngle: -1 * Math.PI/2,
gauge_units: undefined,
gauge_width: undefined,
gauge_expand: {},
@@ -1254,6 +1259,7 @@
donut_label_show: true,
donut_label_format: undefined,
donut_label_threshold: 0.05,
+ donut_label_ratio: undefined,
donut_width: undefined,
donut_title: "",
donut_expand: {},
@@ -2076,7 +2082,10 @@
var new_row = [];
targetKeys.forEach(function (key) {
// convert undefined to null because undefined data will be removed in convertDataToTargets()
- var v = isUndefined(o[key]) ? null : o[key];
+ var v = $$.findValueInJson(o, key);
+ if (isUndefined(v)) {
+ v = null;
+ }
new_row.push(v);
});
new_rows.push(new_row);
@@ -2090,6 +2099,20 @@
}
return data;
};
+ c3_chart_internal_fn.findValueInJson = function (object, path) {
+ path = path.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties (replace [] with .)
+ path = path.replace(/^\./, ''); // strip a leading dot
+ var pathArray = path.split('.');
+ for (var i = 0; i < pathArray.length; ++i) {
+ var k = pathArray[i];
+ if (k in object) {
+ object = object[k];
+ } else {
+ return;
+ }
+ }
+ return object;
+ };
c3_chart_internal_fn.convertRowsToData = function (rows) {
var keys = rows[0], new_row = {}, new_rows = [], i, j;
for (i = 1; i < rows.length; i++) {
@@ -2168,12 +2191,20 @@
id: convertedId,
id_org: id,
values: data.map(function (d, i) {
- var xKey = $$.getXKey(id), rawX = d[xKey], x = $$.generateTargetX(rawX, id, i),
- value = d[id] !== null && !isNaN(d[id]) ? +d[id] : null;
+ var xKey = $$.getXKey(id), rawX = d[xKey],
+ value = d[id] !== null && !isNaN(d[id]) ? +d[id] : null, x;
// use x as categories if custom x and categorized
- if ($$.isCustomX() && $$.isCategorized() && index === 0 && rawX) {
- if (i === 0) { config.axis_x_categories = []; }
- config.axis_x_categories.push(rawX);
+ if ($$.isCustomX() && $$.isCategorized() && index === 0 && !isUndefined(rawX)) {
+ if (index === 0 && i === 0) {
+ config.axis_x_categories = [];
+ }
+ x = config.axis_x_categories.indexOf(rawX);
+ if (x === -1) {
+ x = config.axis_x_categories.length;
+ config.axis_x_categories.push(rawX);
+ }
+ } else {
+ x = $$.generateTargetX(rawX, id, i);
}
// mark as x = undefined if value is undefined and filter to remove after mapped
if (isUndefined(d[id]) || $$.data.xs[id].length <= i) {
@@ -2663,7 +2694,7 @@
c3_chart_internal_fn.getCurrentHeight = function () {
var $$ = this, config = $$.config,
h = config.size_height ? config.size_height : $$.getParentHeight();
- return h > 0 ? h : 320 / ($$.hasType('gauge') ? 2 : 1);
+ return h > 0 ? h : 320 / ($$.hasType('gauge') && !config.gauge_fullCircle ? 2 : 1);
};
c3_chart_internal_fn.getCurrentPaddingTop = function () {
var $$ = this,
@@ -3107,7 +3138,7 @@
return config.data_groups.length > 0 ? getPoints(d, i)[1][1] : yScaleGetter.call($$, d.id)(d.value);
};
- area = config.axis_rotated ? area.x0(value0).x1(value1).y(xValue) : area.x(xValue).y0(value0).y1(value1);
+ area = config.axis_rotated ? area.x0(value0).x1(value1).y(xValue) : area.x(xValue).y0(config.area_above ? 0 : value0).y1(value1);
if (!config.line_connectNull) {
area = area.defined(function (d) { return d.value !== null; });
}
@@ -3229,7 +3260,7 @@
};
c3_chart_internal_fn.pointSelectR = function (d) {
var $$ = this, config = $$.config;
- return config.point_select_r ? config.point_select_r : $$.pointR(d) * 4;
+ return isFunction(config.point_select_r) ? config.point_select_r(d) : ((config.point_select_r) ? config.point_select_r : $$.pointR(d) * 4);
};
c3_chart_internal_fn.isWithinCircle = function (that, r) {
var d3 = this.d3,
@@ -3884,7 +3915,7 @@
text = "