Commit 27effbc3 authored by Evgeny's avatar Evgeny

Move turning angle

parent 0b7694eb
......@@ -57,3 +57,25 @@ c3_chart_fn.bgcolor = function(value) {
svg.style.backgroundColor = value;
}
};
c3.chart.fn.turn = function(options){
var $$ = this.internal;
var turnAngle;
if(!options){
return;
}
if(options.radians){
turnAngle = options.radians;
} else {
turnAngle = toRadians(options.degrees);
}
if(options.relative){
$$.config.turnAngle += turnAngle;
} else {
$$.config.turnAngle = turnAngle;
}
};
......@@ -45,6 +45,12 @@ c3_chart_internal_fn.updateAngle = function (d) {
d.startAngle = -1 * (Math.PI / 2);
d.endAngle = d.startAngle + gTic * gValue;
}
if(config.turnAngle){
d.endAngle += config.turnAngle;
d.startAngle += config.turnAngle;
}
return found ? d : null;
};
......
......@@ -43,4 +43,11 @@ var isValue = c3_chart_internal_fn.isValue = function (v) {
items = [path.pathSegList.getItem(0), path.pathSegList.getItem(1)],
minX = items[0].x, minY = Math.min(items[0].y, items[1].y);
return {x: minX, y: minY, width: box.width, height: box.height};
},
toRadians = function(degrees){
return degrees * (Math.PI / 180);
},
toDegrees = function(radians){
return radians * (180 / Math.PI);
};
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