Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 即等于求 start -> center 和 end -> center 的逆时针角度
const dAngle = vec2.angleTo(
[ coordCenter.x - start.x, coordCenter.y - start.y ],
[ coordCenter.x - end.x, coordCenter.y - end.y ],
0,
);
const largeArc = dAngle > Math.PI ? 1 : 0;
path = [
[ 'M', start.x, start.y ],
[ 'A', radius, radius, 0, largeArc, 1, end.x, end.y ],
];
}
const arcShape = group.addShape('path', {
zIndex: this.get('zIndex'),
attrs: _.assign({ path }, this.get('style')),
});
arcShape.name = 'annotation-arc'; // 用于事件以及动画识别
if (this.get('appendInfo')) {
arcShape.setSilent('appendInfo', this.get('appendInfo'));
}
this.set('el', arcShape);
}
}
function transform(dataView: View, options: Options): void {
options = assign({} as Options, DEFAULT_OPTIONS, options);
const layout = tagCloud();
['font', 'fontSize', 'padding', 'rotate', 'size', 'spiral', 'timeInterval'].forEach((key) => {
// @ts-ignore
if (options[key]) {
// @ts-ignore
layout[key](options[key]);
}
});
const fields = getFields(options);
const [text, value] = fields;
if (!isString(text) || !isString(value)) {
throw new TypeError('Invalid fields: must be an array with 2 strings (e.g. [ "text", "value" ])!');
}
const words = dataView.rows.map((row) => {
row.text = row[text];
row.value = row[value];
function transform(view: View, options: Options): void {
options = assign({} as Options, DEFAULT_OPTIONS, options);
const field = getField(options);
// @ts-ignore
let geoView = options.geoView || options.geoDataView; // alias
if (isString(geoView)) {
geoView = view.dataSet.getView(geoView);
}
if (!geoView || geoView.dataType !== 'geo') {
throw new TypeError('Invalid geoView: must be a DataView of GEO dataType!');
}
const as = options.as;
if (!isArray(as) || as.length !== 2) {
throw new TypeError('Invalid as: it must be an array with 2 strings (e.g. [ "x", "y" ])!');
}
const lonField = as[0];
const latField = as[1];
view.rows.forEach((row) => {
constructor(cfg: TextConfig) {
_.assign(this as any, cfg);
this._init();
}
constructor(cfg) {
_.assign(this, cfg);
this.init();
}
function transform(dataView: View, options: Options): void {
options = assign({} as Options, DEFAULT_OPTIONS, options);
const fields = getFields(options);
if (!isArray(fields) || fields.length !== 2) {
throw new TypeError('invalid fields: must be an array of 2 strings.');
}
const [xField, yField] = fields;
const method = options.method;
if (REGRESSION_METHODS.indexOf(method) === -1) {
throw new TypeError(`invalid method: ${method}. Must be one of ${REGRESSION_METHODS.join(', ')}`);
}
const points: any[] = dataView.rows.map((row) => [row[xField], row[yField]]);
const regressionResult = regression[method](points, options);
let extent = options.extent;
if (!isArray(extent) || extent.length !== 2) {
extent = dataView.range(xField);
}
let bandwidth = options.bandwidth;
import * as _ from '@antv/util';
import { EVENT_MAP, IEventmap, onEvent } from '../../util/event';
const SHAPE_EVENT_MAP: IEventmap = {
onProgressClick: 'interval:click',
onProgressDblclick: 'interval:dblclick',
onProgressMousemove: 'interval:mousemove',
onProgressMousedown: 'interval:mousedown',
onProgressMouseup: 'interval:mouseup',
onProgressMouseenter: 'interval:mouseenter',
onProgressMouseleave: 'interval:mouseleave',
onProgressContextmenu: 'interval:contextmenu',
};
_.assign(EVENT_MAP, SHAPE_EVENT_MAP);
export { EVENT_MAP, onEvent };
import * as _ from '@antv/util';
import { EVENT_MAP, IEventmap, onEvent } from '../../util/event';
const SHAPE_EVENT_MAP: IEventmap = {
onColumnClick: 'interval:click',
onColumnDblclick: 'interval:dblclick',
onColumnMousemove: 'interval:mousemove',
onColumnMousedown: 'interval:mousedown',
onColumnMouseup: 'interval:mouseup',
onColumnMouseenter: 'interval:mouseenter',
onColumnMouseleave: 'interval:mouseleave',
onColumnContextmenu: 'interval:contextmenu',
};
_.assign(EVENT_MAP, SHAPE_EVENT_MAP);
export { EVENT_MAP, onEvent };
constructor(cfg: ResponsiveCfg) {
_.assign(this, cfg);
this.currentConstraint = this.constraints[0];
if (this.rules) {
this.iterationTime = this.rules[this.currentConstraint.name].length;
}
this._start();
this._run();
this._end();
}
function transform(dv: View, options: Options): void {
options = assign({} as Options, DEFAULT_OPTIONS, options);
const fields = getFields(options);
if (!isArray(fields) || fields.length !== 2) {
throw new TypeError('invalid fields: must be an array of 2 strings!');
}
const [asX, asY, asZ] = options.as;
if (!isString(asX) || !isString(asY) || !isString(asZ)) {
throw new TypeError('invalid as: must be an array of 3 strings!');
}
let method: Function;
if (isString(options.method)) {
if (KERNEL_METHODS.indexOf(options.method) === -1) {
throw new TypeError(`invalid method: ${options.method}. Must be one of ${KERNEL_METHODS.join(', ')}`);
}
method = kernel[options.method];
}