fix pie chart hover effect

This commit is contained in:
洛丹 2017-11-04 00:01:09 +08:00 committed by pratu16x7
parent 8712e99951
commit 154e4c7bdc
6 changed files with 8 additions and 15 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@ export default class PieChart extends BaseChart {
this.isAnimate = false; this.isAnimate = false;
this.colors = args.colors; this.colors = args.colors;
this.startAngle = args.startAngle || 0; this.startAngle = args.startAngle || 0;
this.clockWise = args.clockWise || true; this.clockWise = args.clockWise || false;
if(!this.colors || this.colors.length < this.data.labels.length) { if(!this.colors || this.colors.length < this.data.labels.length) {
this.colors = ['#7cd6fd', '#5e64ff', '#743ee2', '#ff5858', '#ffa00a', this.colors = ['#7cd6fd', '#5e64ff', '#743ee2', '#ff5858', '#ffa00a',
'#FEEF72', '#28a745', '#98d85b', '#b554ff', '#ffa3ef']; '#FEEF72', '#28a745', '#98d85b', '#b554ff', '#ffa3ef'];
@ -86,8 +86,9 @@ export default class PieChart extends BaseChart {
let curAngle = 180 - this.startAngle; let curAngle = 180 - this.startAngle;
this.slice_totals.map((total, i) => { this.slice_totals.map((total, i) => {
const startAngle = curAngle; const startAngle = curAngle;
const diffAngle = (total / this.grand_total) * FULL_ANGLE; const originDiffAngle = (total / this.grand_total) * FULL_ANGLE;
const endAngle = curAngle = clockWise ? curAngle - diffAngle : curAngle + diffAngle; const diffAngle = clockWise ? -originDiffAngle : originDiffAngle;
const endAngle = curAngle = curAngle + diffAngle;
const startPosition = PieChart.getPositionByAngle(startAngle,radius); const startPosition = PieChart.getPositionByAngle(startAngle,radius);
const endPosition = PieChart.getPositionByAngle(endAngle,radius); const endPosition = PieChart.getPositionByAngle(endAngle,radius);
const prevProperty = init && prevSlicesProperties[i]; const prevProperty = init && prevSlicesProperties[i];

View File

@ -124,14 +124,6 @@ $.transform = (element, style)=>{
element.style.oTransform = style; element.style.oTransform = style;
}; };
$.animateSVG = (element, props, dur, easing_type="linear", type=undefined, old_values={}) => { $.animateSVG = (element, props, dur, easing_type="linear", type=undefined, old_values={}) => {
let easing = {
ease: "0.25 0.1 0.25 1",
linear: "0 0 1 1",
// easein: "0.42 0 1 1",
easein: "0.1 0.8 0.2 1",
easeout: "0 0 0.58 1",
easeinout: "0.42 0 0.58 1"
};
let anim_element = element.cloneNode(true); let anim_element = element.cloneNode(true);
let new_element = element.cloneNode(true); let new_element = element.cloneNode(true);