| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
- var Util = require('../../util/common');
- var Abstract = require('./abstract');
- var Line =
- /*#__PURE__*/
- function (_Abstract) {
- _inheritsLoose(Line, _Abstract);
- function Line() {
- return _Abstract.apply(this, arguments) || this;
- }
- var _proto = Line.prototype;
- _proto._initDefaultCfg = function _initDefaultCfg() {
- _Abstract.prototype._initDefaultCfg.call(this);
- this.start = null;
- this.end = null;
- };
- _proto.getOffsetPoint = function getOffsetPoint(value) {
- var start = this.start,
- end = this.end;
- return {
- x: start.x + (end.x - start.x) * value,
- y: start.y + (end.y - start.y) * value
- };
- };
- _proto.getAxisVector = function getAxisVector() {
- var start = this.start,
- end = this.end;
- return [end.x - start.x, end.y - start.y];
- };
- _proto.drawLine = function drawLine(lineCfg) {
- var container = this.getContainer(lineCfg.top);
- var start = this.start,
- end = this.end;
- container.addShape('line', {
- className: 'axis-line',
- attrs: Util.mix({
- x1: start.x,
- y1: start.y,
- x2: end.x,
- y2: end.y
- }, lineCfg)
- });
- };
- return Line;
- }(Abstract);
- Abstract.Line = Line;
- module.exports = Line;
|