style: linting fixes
This commit is contained in:
parent
ce67836445
commit
999d5acc74
@ -1,13 +1,12 @@
|
|||||||
import AggregationChart from './AggregationChart';
|
import AggregationChart from './AggregationChart';
|
||||||
import { getOffset } from '../utils/dom';
|
import { getOffset } from '../utils/dom';
|
||||||
import { getComponent } from '../objects/ChartComponents';
|
import { getComponent } from '../objects/ChartComponents';
|
||||||
import { getEndpointsForTrapezoid } from '../utils/draw-utils'
|
import { getEndpointsForTrapezoid } from '../utils/draw-utils';
|
||||||
|
|
||||||
export default class FunnelChart extends AggregationChart {
|
export default class FunnelChart extends AggregationChart {
|
||||||
constructor(parent, args) {
|
constructor(parent, args) {
|
||||||
super(parent, args);
|
super(parent, args);
|
||||||
this.type = 'funnel';
|
this.type = 'funnel';
|
||||||
funnel = this;
|
|
||||||
this.setup();
|
this.setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,20 +19,20 @@ export default class FunnelChart extends AggregationChart {
|
|||||||
const baseWidth = (2 * totalheight) / Math.sqrt(3);
|
const baseWidth = (2 * totalheight) / Math.sqrt(3);
|
||||||
|
|
||||||
|
|
||||||
const reducer = (accumulator, currentValue, index) => accumulator + currentValue;
|
const reducer = (accumulator, currentValue) => accumulator + currentValue;
|
||||||
const weightage = s.sliceTotals.reduce(reducer, 0.0);
|
const weightage = s.sliceTotals.reduce(reducer, 0.0);
|
||||||
|
|
||||||
const center_x_offset = this.center.x - baseWidth / 2;
|
const center_x_offset = this.center.x - baseWidth / 2;
|
||||||
const center_y_offset = this.center.y - totalheight / 2;
|
const center_y_offset = this.center.y - totalheight / 2;
|
||||||
|
|
||||||
let slicePoints = [];
|
let slicePoints = [];
|
||||||
let startPoint = [[center_x_offset, center_y_offset], [center_x_offset + baseWidth, center_y_offset]]
|
let startPoint = [[center_x_offset, center_y_offset], [center_x_offset + baseWidth, center_y_offset]];
|
||||||
s.sliceTotals.forEach((d, i) => {
|
s.sliceTotals.forEach(d => {
|
||||||
let height = totalheight * d / weightage;
|
let height = totalheight * d / weightage;
|
||||||
let endPoint = getEndpointsForTrapezoid(startPoint, height);
|
let endPoint = getEndpointsForTrapezoid(startPoint, height);
|
||||||
slicePoints.push([startPoint, endPoint]);
|
slicePoints.push([startPoint, endPoint]);
|
||||||
startPoint = endPoint;
|
startPoint = endPoint;
|
||||||
})
|
});
|
||||||
s.slicePoints = slicePoints;
|
s.slicePoints = slicePoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,15 +59,12 @@ export default class FunnelChart extends AggregationChart {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
makeDataByIndex() { }
|
|
||||||
|
|
||||||
bindTooltip() {
|
bindTooltip() {
|
||||||
function getPolygonWidth(slice) {
|
function getPolygonWidth(slice) {
|
||||||
const points = slice.points;
|
const points = slice.points;
|
||||||
return points[1].x - points[0].x
|
return points[1].x - points[0].x;
|
||||||
}
|
}
|
||||||
|
|
||||||
let s = this.state;
|
|
||||||
this.container.addEventListener('mousemove', (e) => {
|
this.container.addEventListener('mousemove', (e) => {
|
||||||
let slices = this.components.get('funnelSlices').store;
|
let slices = this.components.get('funnelSlices').store;
|
||||||
let slice = e.target;
|
let slice = e.target;
|
||||||
|
|||||||
@ -191,13 +191,13 @@ export function percentageBar(x, y, width, height,
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function funnelSlice(className, start, end, fill='none') {
|
export function funnelSlice(className, start, end, fill='none') {
|
||||||
const points = `${start[0].join()} ${start[1].join()} ${end[1].join()} ${end[0].join()}`
|
const points = `${start[0].join()} ${start[1].join()} ${end[1].join()} ${end[0].join()}`;
|
||||||
let args = {
|
let args = {
|
||||||
className: 'funnel-slice',
|
className: 'funnel-slice',
|
||||||
points: points,
|
points: points,
|
||||||
fill: fill
|
fill: fill
|
||||||
}
|
};
|
||||||
return createSVG("polygon", args)
|
return createSVG("polygon", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function heatSquare(className, x, y, size, fill='none', data={}) {
|
export function heatSquare(className, x, y, size, fill='none', data={}) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user