@tetacom/ng-components 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/component/chart/chart/chart.component.d.ts +2 -1
- package/component/chart/core/chart.d.ts +2 -0
- package/component/chart/model/enum/dispatch-type.d.ts +2 -1
- package/component/chart/model/point/base-point.d.ts +2 -0
- package/component/chart/model/point/marker-options.d.ts +9 -0
- package/esm2020/component/chart/chart/chart.component.mjs +11 -4
- package/esm2020/component/chart/core/chart.mjs +9 -1
- package/esm2020/component/chart/drawer/line-drawer.mjs +38 -2
- package/esm2020/component/chart/model/enum/dispatch-type.mjs +2 -1
- package/esm2020/component/chart/model/point/base-point.mjs +1 -1
- package/esm2020/component/chart/model/point/marker-options.mjs +2 -0
- package/fesm2015/tetacom-ng-components.mjs +56 -5
- package/fesm2015/tetacom-ng-components.mjs.map +1 -1
- package/fesm2020/tetacom-ng-components.mjs +56 -4
- package/fesm2020/tetacom-ng-components.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -9982,14 +9982,16 @@ class BarDrawer {
|
|
|
9982
9982
|
var DispatchType;
|
|
9983
9983
|
(function (DispatchType) {
|
|
9984
9984
|
DispatchType["moveLine"] = "moveLine";
|
|
9985
|
+
DispatchType["movePoint"] = "movePoint";
|
|
9985
9986
|
})(DispatchType || (DispatchType = {}));
|
|
9986
9987
|
|
|
9987
9988
|
class LineDrawer {
|
|
9988
9989
|
constructor() {
|
|
9989
|
-
this.dispatch = d3.dispatch(DispatchType.moveLine);
|
|
9990
|
+
this.dispatch = d3.dispatch(DispatchType.moveLine, DispatchType.movePoint);
|
|
9990
9991
|
}
|
|
9991
9992
|
draw(series, context, scaleX, scaleY, options) {
|
|
9992
9993
|
const points = series.data;
|
|
9994
|
+
const markerPoints = points.filter((_) => _.marker);
|
|
9993
9995
|
const path = d3
|
|
9994
9996
|
.line()
|
|
9995
9997
|
.curve(series.curveType)
|
|
@@ -9997,6 +9999,41 @@ class LineDrawer {
|
|
|
9997
9999
|
.x((d) => scaleX(d.x))
|
|
9998
10000
|
.y((d) => scaleY(d.y));
|
|
9999
10001
|
const seriesIndex = options.series.findIndex((_) => _.id === series.id);
|
|
10002
|
+
if (markerPoints?.length) {
|
|
10003
|
+
const emit = (event, target) => {
|
|
10004
|
+
this.dispatch.apply(DispatchType.movePoint, {
|
|
10005
|
+
target: series,
|
|
10006
|
+
point: {
|
|
10007
|
+
...target,
|
|
10008
|
+
},
|
|
10009
|
+
event,
|
|
10010
|
+
});
|
|
10011
|
+
};
|
|
10012
|
+
context
|
|
10013
|
+
.selectAll('circle')
|
|
10014
|
+
.data(markerPoints)
|
|
10015
|
+
.enter()
|
|
10016
|
+
.append('circle')
|
|
10017
|
+
.attr('class', 'draggable-marker')
|
|
10018
|
+
.attr('r', (d) => d.marker?.style?.radius || 5)
|
|
10019
|
+
.attr('cx', function (d) {
|
|
10020
|
+
return scaleX(d.x);
|
|
10021
|
+
})
|
|
10022
|
+
.attr('cy', function (d) {
|
|
10023
|
+
return scaleY(d.y);
|
|
10024
|
+
})
|
|
10025
|
+
.style('cursor', 'pointer')
|
|
10026
|
+
.style('fill', (d) => d.marker?.style?.color || 'red')
|
|
10027
|
+
.attr('stroke', (d) => d.marker?.style?.stroke || 'none')
|
|
10028
|
+
.attr('stroke-width', (d) => d.marker?.style?.strokeWidth || 0);
|
|
10029
|
+
context.selectAll('.draggable-marker').call(d3.drag().on('drag start end', function dragged(event, d) {
|
|
10030
|
+
d.x = scaleX.invert(event.sourceEvent?.offsetX);
|
|
10031
|
+
d.y = scaleY.invert(event.sourceEvent?.offsetY);
|
|
10032
|
+
d3.select(this).attr('cx', scaleX(d.x)).attr('cy', scaleY(d.y));
|
|
10033
|
+
context.select('path').attr('d', path);
|
|
10034
|
+
emit(event, d);
|
|
10035
|
+
}));
|
|
10036
|
+
}
|
|
10000
10037
|
context
|
|
10001
10038
|
.append('path')
|
|
10002
10039
|
.attr('class', (d) => series?.drag.enable ? 'draggable' : null)
|
|
@@ -10462,6 +10499,7 @@ class TetaChart {
|
|
|
10462
10499
|
this.plotLinesMove$ = new Subject();
|
|
10463
10500
|
this.plotBandsMove$ = new Subject();
|
|
10464
10501
|
this.seriesMove$ = new Subject();
|
|
10502
|
+
this.pointMove$ = new Subject();
|
|
10465
10503
|
this.zoom$ = new Subject();
|
|
10466
10504
|
this._container = null;
|
|
10467
10505
|
this._width = 0;
|
|
@@ -10483,6 +10521,7 @@ class TetaChart {
|
|
|
10483
10521
|
this.plotLinesMove = this.plotLinesMove$.asObservable();
|
|
10484
10522
|
this.plotBandsMove = this.plotBandsMove$.asObservable();
|
|
10485
10523
|
this.seriesMove = this.seriesMove$.asObservable();
|
|
10524
|
+
this.pointMove = this.pointMove$.asObservable();
|
|
10486
10525
|
this.zoom = this.zoom$.asObservable();
|
|
10487
10526
|
}
|
|
10488
10527
|
redraw(options) {
|
|
@@ -11331,9 +11370,15 @@ class TetaChart {
|
|
|
11331
11370
|
const emit = (event) => {
|
|
11332
11371
|
this.seriesMove$.next(event);
|
|
11333
11372
|
};
|
|
11373
|
+
const emitPoint = (event) => {
|
|
11374
|
+
this.pointMove$.next(event);
|
|
11375
|
+
};
|
|
11334
11376
|
drawer?.dispatch?.on(DispatchType.moveLine, function () {
|
|
11335
11377
|
emit(this);
|
|
11336
11378
|
});
|
|
11379
|
+
drawer?.dispatch?.on(DispatchType.movePoint, function () {
|
|
11380
|
+
emitPoint(this);
|
|
11381
|
+
});
|
|
11337
11382
|
});
|
|
11338
11383
|
}
|
|
11339
11384
|
createTooltip() {
|
|
@@ -11778,6 +11823,7 @@ class ChartComponent {
|
|
|
11778
11823
|
this.plotLinesMove = new EventEmitter();
|
|
11779
11824
|
this.plotBandsMove = new EventEmitter();
|
|
11780
11825
|
this.seriesMove = new EventEmitter();
|
|
11826
|
+
this.pointMove = new EventEmitter();
|
|
11781
11827
|
this.zoomChange = new EventEmitter();
|
|
11782
11828
|
this._alive = true;
|
|
11783
11829
|
this.size$ = new Subject();
|
|
@@ -11829,8 +11875,7 @@ class ChartComponent {
|
|
|
11829
11875
|
this._chart?.setZoom(this.zoom);
|
|
11830
11876
|
}
|
|
11831
11877
|
}
|
|
11832
|
-
ngOnInit() {
|
|
11833
|
-
}
|
|
11878
|
+
ngOnInit() { }
|
|
11834
11879
|
ngAfterViewInit() {
|
|
11835
11880
|
this._observer = new ResizeObserver((entries) => {
|
|
11836
11881
|
const { contentRect } = entries[0];
|
|
@@ -11876,6 +11921,11 @@ class ChartComponent {
|
|
|
11876
11921
|
this._chart.seriesMove
|
|
11877
11922
|
.pipe(takeWhile((_) => this._alive))
|
|
11878
11923
|
.subscribe((_) => this.seriesMove.emit(_));
|
|
11924
|
+
this._chart.pointMove
|
|
11925
|
+
.pipe(takeWhile((_) => this._alive))
|
|
11926
|
+
.subscribe((_) => {
|
|
11927
|
+
this.pointMove.emit(_);
|
|
11928
|
+
});
|
|
11879
11929
|
this._chart.zoom
|
|
11880
11930
|
.pipe(takeWhile((_) => this._alive), map((_) => {
|
|
11881
11931
|
this.zoomChange.emit(_);
|
|
@@ -11893,7 +11943,7 @@ class ChartComponent {
|
|
|
11893
11943
|
}
|
|
11894
11944
|
}
|
|
11895
11945
|
ChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartComponent, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
11896
|
-
ChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ChartComponent, selector: "teta-chart", inputs: { zoom: "zoom", config: "config" }, outputs: { plotLinesMove: "plotLinesMove", plotBandsMove: "plotBandsMove", seriesMove: "seriesMove", zoomChange: "zoomChange" }, host: { listeners: { "click": "click($event)" } }, viewQueries: [{ propertyName: "chart", first: true, predicate: ["chart"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div [style.display]=\"hasSeriesData ? 'contents' : 'none'\">\n <div #chart class=\"chart-container\"></div>\n <div class=\"legend-container\"></div>\n</div>\n<div [style.display]=\"!hasSeriesData ? 'block' : 'none'\" class=\"chart-placeholder text-align-center\">\n <span class=\"font-body-3 color-text-40\">\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442</span>\n</div>\n\n\n", styles: [":host{display:flex;width:100%;height:100%;flex-direction:column}.chart-container{position:relative;min-height:0;flex-grow:1;flex-basis:1px}.chart-placeholder{margin:auto;width:100%}.chart-placeholder span{text-overflow:ellipsis;overflow:hidden;display:block}.legend-container{flex-shrink:0;flex-basis:1px}::ng-deep .grid line{stroke-dasharray:1,4}::ng-deep .tooltip-chart{padding:8px 12px;border-radius:2px}::ng-deep .legend{grid-gap:8px;padding-bottom:5px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-evenly}::ng-deep .legend .item{display:flex;align-items:center;cursor:pointer}::ng-deep .legend .item .swatch{width:10px;height:10px}::ng-deep .legend .item .line{width:12px;height:2px}::ng-deep .legend .item .label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-left:5px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
11946
|
+
ChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.1", type: ChartComponent, selector: "teta-chart", inputs: { zoom: "zoom", config: "config" }, outputs: { plotLinesMove: "plotLinesMove", plotBandsMove: "plotBandsMove", seriesMove: "seriesMove", pointMove: "pointMove", zoomChange: "zoomChange" }, host: { listeners: { "click": "click($event)" } }, viewQueries: [{ propertyName: "chart", first: true, predicate: ["chart"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div [style.display]=\"hasSeriesData ? 'contents' : 'none'\">\n <div #chart class=\"chart-container\"></div>\n <div class=\"legend-container\"></div>\n</div>\n<div [style.display]=\"!hasSeriesData ? 'block' : 'none'\" class=\"chart-placeholder text-align-center\">\n <span class=\"font-body-3 color-text-40\">\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442</span>\n</div>\n\n\n", styles: [":host{display:flex;width:100%;height:100%;flex-direction:column}.chart-container{position:relative;min-height:0;flex-grow:1;flex-basis:1px}.chart-placeholder{margin:auto;width:100%}.chart-placeholder span{text-overflow:ellipsis;overflow:hidden;display:block}.legend-container{flex-shrink:0;flex-basis:1px}::ng-deep .grid line{stroke-dasharray:1,4}::ng-deep .tooltip-chart{padding:8px 12px;border-radius:2px}::ng-deep .legend{grid-gap:8px;padding-bottom:5px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-evenly}::ng-deep .legend .item{display:flex;align-items:center;cursor:pointer}::ng-deep .legend .item .swatch{width:10px;height:10px}::ng-deep .legend .item .line{width:12px;height:2px}::ng-deep .legend .item .label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-left:5px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
11897
11947
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: ChartComponent, decorators: [{
|
|
11898
11948
|
type: Component,
|
|
11899
11949
|
args: [{ selector: 'teta-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [style.display]=\"hasSeriesData ? 'contents' : 'none'\">\n <div #chart class=\"chart-container\"></div>\n <div class=\"legend-container\"></div>\n</div>\n<div [style.display]=\"!hasSeriesData ? 'block' : 'none'\" class=\"chart-placeholder text-align-center\">\n <span class=\"font-body-3 color-text-40\">\u0414\u0430\u043D\u043D\u044B\u0435 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044E\u0442</span>\n</div>\n\n\n", styles: [":host{display:flex;width:100%;height:100%;flex-direction:column}.chart-container{position:relative;min-height:0;flex-grow:1;flex-basis:1px}.chart-placeholder{margin:auto;width:100%}.chart-placeholder span{text-overflow:ellipsis;overflow:hidden;display:block}.legend-container{flex-shrink:0;flex-basis:1px}::ng-deep .grid line{stroke-dasharray:1,4}::ng-deep .tooltip-chart{padding:8px 12px;border-radius:2px}::ng-deep .legend{grid-gap:8px;padding-bottom:5px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-evenly}::ng-deep .legend .item{display:flex;align-items:center;cursor:pointer}::ng-deep .legend .item .swatch{width:10px;height:10px}::ng-deep .legend .item .line{width:12px;height:2px}::ng-deep .legend .item .label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-left:5px}\n"] }]
|
|
@@ -11907,6 +11957,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
|
|
|
11907
11957
|
type: Output
|
|
11908
11958
|
}], seriesMove: [{
|
|
11909
11959
|
type: Output
|
|
11960
|
+
}], pointMove: [{
|
|
11961
|
+
type: Output
|
|
11910
11962
|
}], zoomChange: [{
|
|
11911
11963
|
type: Output
|
|
11912
11964
|
}], chart: [{
|