| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- var __rest = (this && this.__rest) || function (s, e) {
- var t = {};
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
- t[p] = s[p];
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
- t[p[i]] = s[p[i]];
- }
- return t;
- };
- import { path as d3path } from 'd3-path';
- import { Path } from '@antv/g';
- import { applyStyle, getShapeTheme } from '../utils';
- import { select } from '../../utils/selection';
- /**
- * Draw density shape.
- */
- export const Density = (options) => {
- const style = __rest(options, []);
- return (points, value, coordinate, theme) => {
- const { mark, shape, defaultShape, transform } = value;
- const _a = getShapeTheme(theme, mark, shape, defaultShape), { defaultColor } = _a, shapeTheme = __rest(_a, ["defaultColor"]);
- const { color = defaultColor } = value;
- const [first, ...p] = points;
- // todo smooth, hollow
- const path = d3path();
- path.moveTo(...first);
- p.forEach(([x, y]) => {
- path.lineTo(x, y);
- });
- path.closePath();
- return select(new Path())
- .call(applyStyle, shapeTheme)
- .style('d', path.toString())
- .style('stroke', color || defaultColor) // Always has stroke color.
- .style('fill', color || defaultColor)
- .style('fillOpacity', 0.4)
- .style('transform', transform)
- .call(applyStyle, style)
- .node();
- };
- };
- Density.props = {
- defaultMarker: 'square',
- defaultEnterAnimation: 'fadeIn',
- defaultUpdateAnimation: 'morphing',
- defaultExitAnimation: 'fadeOut',
- };
- //# sourceMappingURL=density.js.map
|