@data-ui/xy-chart
Version:
A package of charts with standard x- and y- axes. https://williaster.github.io/data-ui
55 lines (54 loc) • 1.74 kB
JavaScript
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
/* eslint react/default-props-match-prop-types: 'off' */
import React from 'react';
import { GlyphDot } from '@vx/glyph';
import { pointComponentPropTypes } from '../utils/propShapes';
var defaultPropTypes = {
onMouseMove: null,
onMouseLeave: null,
strokeDasharray: null
};
export default function GlyphDotComponent(_ref) {
var x = _ref.x,
y = _ref.y,
size = _ref.size,
fill = _ref.fill,
fillOpacity = _ref.fillOpacity,
stroke = _ref.stroke,
strokeWidth = _ref.strokeWidth,
strokeDasharray = _ref.strokeDasharray,
onClick = _ref.onClick,
onMouseMove = _ref.onMouseMove,
onMouseLeave = _ref.onMouseLeave,
data = _ref.data,
datum = _ref.datum;
return React.createElement(GlyphDot, {
cx: x,
cy: y,
r: size,
fill: fill,
fillOpacity: fillOpacity,
stroke: stroke,
strokeWidth: strokeWidth,
strokeDasharray: strokeDasharray,
onClick: onClick && function (event) {
onClick({
event: event,
data: data,
datum: datum,
color: fill
});
},
onMouseMove: onMouseMove && function (event) {
onMouseMove({
event: event,
data: data,
datum: datum,
color: fill
});
},
onMouseLeave: onMouseLeave
});
}
GlyphDotComponent.propTypes = _extends({}, pointComponentPropTypes);
GlyphDotComponent.defaultProps = defaultPropTypes;