Update c3.js and c3.min.js

parent 8f937523
...@@ -3454,25 +3454,57 @@ ...@@ -3454,25 +3454,57 @@
} }
function buildPath(points){ function buildPath(points){
var path = ''; var path = create('path');
var d = '';
for(var i = 0; i<points.length; i++){ for(var i = 0; i<points.length; i++){
path += (points[i].action || 'L') + pt(points[i]); d += (points[i].action || 'L') + pt(points[i]);
} }
path.attr('d', d);
return path; return path;
} }
var serifThickness = 3;
return { return {
asterisk: function(size, color){
size /= 2;
return buildPath([
{ action: 'M', x: size, y: size },
{ action: 'L', x: -size, y: -size },
{ action: 'M', x: size, y: -size },
{ action: 'L', x: -size, y: size },
{ action: 'M', x: 0, y: -size },
{ action: 'L', x: 0, y: size }
]).style('stroke', color);
},
circle: function(size){ circle: function(size){
return create('circle').attr('r', size/2); return create('circle').attr('r', size/2);
}, },
cross: function(size, color){
size /= 2;
return buildPath([
{ action: 'M', x: size, y: size },
{ action: 'L', x: -size, y: -size },
{ action: 'M', x: size, y: -size },
{ action: 'L', x: -size, y: size }
]).style('stroke', color);
},
plus: function(size, color){
size /= 2;
return buildPath([
{ action: 'M', x: 0, y: size },
{ action: 'L', x: 0, y: -size },
{ action: 'M', x: size, y: 0 },
{ action: 'L', x: -size, y: 0 }
]).style('stroke', color);
},
rhombus: function(size){ rhombus: function(size){
var marker = create('path');
// height/width ratio // height/width ratio
var ratio = 1; var ratio = 1;
size /= 2; size /= 2;
var path = buildPath([ var marker = buildPath([
{ action: 'M', x: 0, y: size }, { action: 'M', x: 0, y: size },
{ action: 'L', x: size/ratio, y: 0 }, { action: 'L', x: size/ratio, y: 0 },
{ action: 'L', x: 0, y: -size }, { action: 'L', x: 0, y: -size },
...@@ -3480,19 +3512,46 @@ ...@@ -3480,19 +3512,46 @@
{ action: 'Z' } { action: 'Z' }
]); ]);
marker.attr('d', path) marker.style('stroke', 'none');
.style('stroke', 'none');
return marker; return marker;
}, },
serif: function(size){
var marker = create('rect');
marker.attr('width', size)
.attr('height', serifThickness)
.attr('x', -size/2)
.attr('y', -serifThickness/2)
.style('shape-rendering', 'crispEdges');
return marker;
},
serifRight: function(size){
var marker = create('rect');
marker.attr('width', size/2)
.attr('height', serifThickness)
.attr('x', 0)
.attr('y', -serifThickness/2)
.style('shape-rendering', 'crispEdges');
return marker;
},
square: function(size){ square: function(size){
var marker = create('rect'); var marker = create('rect');
marker.attr('width', size) marker.attr('width', size)
.attr('height', size) .attr('height', size)
.attr('x', -size/2) .attr('x', -size/2)
.attr('y', -size/2); .attr('y', -size/2)
.style('shape-rendering', 'crispEdges');
return marker; return marker;
},
triangle: function(size){
size /= 2;
return buildPath([
{ action: 'M', x: 0, y: -size },
{ action: 'L', x: size, y: size },
{ action: 'L', x: -size, y: size },
{ action: 'Z' }
]).style('stroke', 'none');
} }
}; };
})(); })();
...@@ -3504,9 +3563,10 @@ ...@@ -3504,9 +3563,10 @@
return marker_fn.circle($$.pointR(d, i)).node(); return marker_fn.circle($$.pointR(d, i)).node();
} }
return marker_fn[$$.config.marker_types[d.id]]($$.pointR(d, i), $$.color(d, i)).node(); var func = marker_fn[$$.config.marker_types[d.id]];
return func($$.pointR(d, i), $$.color(d, i)).node();
}; };
c3_chart_internal_fn.initBar = function () { c3_chart_internal_fn.initBar = function () {
var $$ = this; var $$ = this;
$$.main.select('.' + CLASS.chart).append("g") $$.main.select('.' + CLASS.chart).append("g")
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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