@tetacom/svg-charts 1.0.2 → 1.1.3
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/{dist/chart → chart}/base/series-base.component.d.ts +4 -1
- package/{dist/chart → chart}/chart/chart.component.d.ts +12 -9
- package/chart/chart-container/chart-container.component.d.ts +37 -0
- package/chart/chart-container/gridlines/gridlines.component.d.ts +14 -0
- package/{dist/chart/chart-container/plotband/plotband.component.d.ts → chart/chart-container/plotband/plot-band.component.d.ts} +11 -10
- package/{dist/chart → chart}/chart-container/plotline/plotline.component.d.ts +5 -5
- package/{dist/chart → chart}/chart-container/series/bar/bar-series.component.d.ts +0 -0
- package/{dist/chart → chart}/chart-container/series/line/line-series.component.d.ts +2 -2
- package/chart/chart-container/series/scatter-series/scatter-series.component.d.ts +28 -0
- package/{dist/chart → chart}/chart-container/series-host/series-host.component.d.ts +4 -1
- package/{dist/chart → chart}/chart-container/tooltip/tooltip.component.d.ts +6 -3
- package/chart/chart-container/x-axis/x-axis.component.d.ts +19 -0
- package/chart/chart-container/y-axis/y-axis.component.d.ts +20 -0
- package/{dist/chart → chart}/chart.module.d.ts +4 -3
- package/{dist/chart → chart}/core/axis/axis.d.ts +8 -3
- package/{dist/chart → chart}/core/axis/builders/axis-size-builder.d.ts +0 -0
- package/{dist/chart → chart}/core/axis/builders/extremes-builder.d.ts +0 -0
- package/{dist/chart → chart}/core/axis/builders/public-api.d.ts +0 -0
- package/{dist/chart → chart}/core/utils/generate-ticks.d.ts +0 -0
- package/{dist/chart → chart}/core/utils/get-text-width.d.ts +0 -0
- package/{dist/chart → chart}/core/utils/public-api.d.ts +0 -0
- package/chart/default/default-axis-config.d.ts +2 -0
- package/chart/default/default-chart-config.d.ts +2 -0
- package/chart/default/default-series-config.d.ts +3 -0
- package/{dist/chart → chart}/directives/brushable.directive.d.ts +2 -1
- package/{dist/chart → chart}/directives/zoomable.directive.d.ts +1 -3
- package/{dist/chart → chart}/legend/legend.component.d.ts +1 -3
- package/chart/model/axis-options.d.ts +19 -0
- package/{dist/chart → chart}/model/base-point.d.ts +1 -1
- package/{dist/chart → chart}/model/chart-bounds.d.ts +0 -0
- package/{dist/chart → chart}/model/enum/axis-orientation.d.ts +0 -0
- package/{dist/chart → chart}/model/enum/brush-type.d.ts +0 -0
- package/{dist/chart → chart}/model/enum/drag-point-type.d.ts +0 -0
- package/{dist/chart → chart}/model/enum/public-api.d.ts +1 -1
- package/chart/model/enum/scale-type.d.ts +8 -0
- package/{dist/chart → chart}/model/enum/series-type.d.ts +2 -1
- package/{dist/chart → chart}/model/enum/tooltip-tracking.d.ts +0 -0
- package/{dist/chart → chart}/model/enum/zoom-type.d.ts +0 -0
- package/chart/model/i-broadcast-message.d.ts +17 -0
- package/{dist/chart → chart}/model/i-builder.d.ts +0 -0
- package/{dist/chart → chart}/model/i-chart-config.d.ts +1 -0
- package/{dist/chart → chart}/model/i-chart-event.d.ts +0 -0
- package/{dist/chart → chart}/model/i-display-tooltip.d.ts +0 -0
- package/{dist/chart → chart}/model/i-point-move.d.ts +0 -0
- package/{dist/chart → chart}/model/marker-options.d.ts +0 -0
- package/{dist/chart/model/plotband.d.ts → chart/model/plot-band.d.ts} +7 -5
- package/{dist/chart/model/plotline.d.ts → chart/model/plot-line.d.ts} +3 -1
- package/{dist/chart → chart}/model/public-api.d.ts +2 -2
- package/{dist/chart → chart}/model/series.d.ts +0 -0
- package/{dist/chart → chart}/model/svg-attributes.d.ts +0 -0
- package/{dist/chart → chart}/model/tooltip-options.d.ts +0 -0
- package/{dist/chart → chart}/service/broadcast.service.d.ts +0 -0
- package/{dist/chart → chart}/service/brush.service.d.ts +2 -5
- package/{dist/chart → chart}/service/chart.service.d.ts +16 -17
- package/chart/service/scale.service.d.ts +19 -0
- package/{dist/chart → chart}/service/zoom.service.d.ts +6 -14
- package/esm2020/chart/base/series-base.component.mjs +32 -0
- package/esm2020/chart/chart/chart.component.mjs +71 -0
- package/esm2020/chart/chart-container/chart-container.component.mjs +133 -0
- package/esm2020/chart/chart-container/gridlines/gridlines.component.mjs +29 -0
- package/esm2020/chart/chart-container/plotband/plot-band.component.mjs +150 -0
- package/esm2020/chart/chart-container/plotline/plotline.component.mjs +76 -0
- package/esm2020/chart/chart-container/series/bar/bar-series.component.mjs +48 -0
- package/esm2020/chart/chart-container/series/line/line-series.component.mjs +152 -0
- package/esm2020/chart/chart-container/series/scatter-series/scatter-series.component.mjs +174 -0
- package/esm2020/chart/chart-container/series-host/series-host.component.mjs +68 -0
- package/esm2020/chart/chart-container/tooltip/tooltip.component.mjs +83 -0
- package/esm2020/chart/chart-container/x-axis/x-axis.component.mjs +53 -0
- package/esm2020/chart/chart-container/y-axis/y-axis.component.mjs +58 -0
- package/{dist/esm2020 → esm2020}/chart/chart.module.mjs +8 -5
- package/esm2020/chart/core/axis/axis.mjs +105 -0
- package/{dist/esm2020 → esm2020}/chart/core/axis/builders/axis-size-builder.mjs +0 -0
- package/esm2020/chart/core/axis/builders/extremes-builder.mjs +31 -0
- package/{dist/esm2020 → esm2020}/chart/core/axis/builders/public-api.mjs +0 -0
- package/{dist/esm2020 → esm2020}/chart/core/utils/generate-ticks.mjs +0 -0
- package/{dist/esm2020 → esm2020}/chart/core/utils/get-text-width.mjs +0 -0
- package/{dist/esm2020 → esm2020}/chart/core/utils/public-api.mjs +0 -0
- package/esm2020/chart/default/default-axis-config.mjs +9 -0
- package/esm2020/chart/default/default-chart-config.mjs +23 -0
- package/esm2020/chart/default/default-series-config.mjs +8 -0
- package/{dist/esm2020 → esm2020}/chart/directives/brushable.directive.mjs +5 -3
- package/esm2020/chart/directives/zoomable.directive.mjs +36 -0
- package/esm2020/chart/legend/legend.component.mjs +27 -0
- package/esm2020/chart/model/axis-options.mjs +2 -0
- package/{dist/esm2020 → esm2020}/chart/model/base-point.mjs +1 -1
- package/{dist/esm2020 → esm2020}/chart/model/chart-bounds.mjs +0 -0
- package/{dist/esm2020 → esm2020}/chart/model/enum/axis-orientation.mjs +0 -0
- package/{dist/esm2020 → esm2020}/chart/model/enum/brush-type.mjs +0 -0
- package/{dist/esm2020 → esm2020}/chart/model/enum/drag-point-type.mjs +0 -0
- package/{dist/esm2020 → esm2020}/chart/model/enum/public-api.mjs +2 -2
- package/esm2020/chart/model/enum/scale-type.mjs +10 -0
- package/{dist/esm2020 → esm2020}/chart/model/enum/series-type.mjs +2 -1
- package/{dist/esm2020 → esm2020}/chart/model/enum/tooltip-tracking.mjs +0 -0
- package/{dist/esm2020 → esm2020}/chart/model/enum/zoom-type.mjs +0 -0
- package/esm2020/chart/model/i-broadcast-message.mjs +2 -0
- package/{dist/esm2020 → esm2020}/chart/model/i-builder.mjs +0 -0
- package/{dist/esm2020 → esm2020}/chart/model/i-chart-config.mjs +1 -1
- package/{dist/esm2020 → esm2020}/chart/model/i-chart-event.mjs +0 -0
- package/{dist/esm2020 → esm2020}/chart/model/i-display-tooltip.mjs +0 -0
- package/{dist/esm2020 → esm2020}/chart/model/i-point-move.mjs +0 -0
- package/{dist/esm2020 → esm2020}/chart/model/marker-options.mjs +0 -0
- package/esm2020/chart/model/plot-band.mjs +17 -0
- package/esm2020/chart/model/plot-line.mjs +13 -0
- package/{dist/esm2020 → esm2020}/chart/model/public-api.mjs +3 -3
- package/{dist/esm2020 → esm2020}/chart/model/series.mjs +0 -0
- package/{dist/esm2020 → esm2020}/chart/model/svg-attributes.mjs +0 -0
- package/{dist/esm2020 → esm2020}/chart/model/tooltip-options.mjs +0 -0
- package/esm2020/chart/service/broadcast.service.mjs +23 -0
- package/esm2020/chart/service/brush.service.mjs +70 -0
- package/esm2020/chart/service/chart.service.mjs +95 -0
- package/esm2020/chart/service/scale.service.mjs +152 -0
- package/esm2020/chart/service/zoom.service.mjs +114 -0
- package/esm2020/public-api.mjs +9 -0
- package/{dist/esm2020 → esm2020}/tetacom-svg-charts.mjs +0 -0
- package/fesm2015/tetacom-svg-charts.mjs +1912 -0
- package/fesm2015/tetacom-svg-charts.mjs.map +1 -0
- package/fesm2020/tetacom-svg-charts.mjs +1887 -0
- package/fesm2020/tetacom-svg-charts.mjs.map +1 -0
- package/package.json +22 -2
- package/{dist/public-api.d.ts → public-api.d.ts} +0 -0
- package/{dist/tetacom-svg-charts.d.ts → tetacom-svg-charts.d.ts} +0 -0
- package/dist/README.md +0 -24
- package/dist/chart/chart-container/chart-container.component.d.ts +0 -42
- package/dist/chart/chart-container/gridlines/gridlines.component.d.ts +0 -23
- package/dist/chart/chart-container/x-axis/x-axis.component.d.ts +0 -23
- package/dist/chart/chart-container/y-axis/y-axis.component.d.ts +0 -24
- package/dist/chart/model/axis-options.d.ts +0 -17
- package/dist/chart/model/enum/axis-type.d.ts +0 -7
- package/dist/chart/model/i-broadcast-message.d.ts +0 -5
- package/dist/chart/service/axes.service.d.ts +0 -11
- package/dist/chart/service/scale.service.d.ts +0 -14
- package/dist/esm2020/chart/base/series-base.component.mjs +0 -34
- package/dist/esm2020/chart/chart/chart.component.mjs +0 -73
- package/dist/esm2020/chart/chart-container/chart-container.component.mjs +0 -151
- package/dist/esm2020/chart/chart-container/gridlines/gridlines.component.mjs +0 -41
- package/dist/esm2020/chart/chart-container/plotband/plotband.component.mjs +0 -139
- package/dist/esm2020/chart/chart-container/plotline/plotline.component.mjs +0 -79
- package/dist/esm2020/chart/chart-container/series/bar/bar-series.component.mjs +0 -48
- package/dist/esm2020/chart/chart-container/series/line/line-series.component.mjs +0 -148
- package/dist/esm2020/chart/chart-container/series-host/series-host.component.mjs +0 -59
- package/dist/esm2020/chart/chart-container/tooltip/tooltip.component.mjs +0 -81
- package/dist/esm2020/chart/chart-container/x-axis/x-axis.component.mjs +0 -56
- package/dist/esm2020/chart/chart-container/y-axis/y-axis.component.mjs +0 -63
- package/dist/esm2020/chart/core/axis/axis.mjs +0 -96
- package/dist/esm2020/chart/core/axis/builders/extremes-builder.mjs +0 -32
- package/dist/esm2020/chart/directives/zoomable.directive.mjs +0 -37
- package/dist/esm2020/chart/legend/legend.component.mjs +0 -30
- package/dist/esm2020/chart/model/axis-options.mjs +0 -2
- package/dist/esm2020/chart/model/enum/axis-type.mjs +0 -9
- package/dist/esm2020/chart/model/i-broadcast-message.mjs +0 -2
- package/dist/esm2020/chart/model/plotband.mjs +0 -16
- package/dist/esm2020/chart/model/plotline.mjs +0 -12
- package/dist/esm2020/chart/service/axes.service.mjs +0 -29
- package/dist/esm2020/chart/service/broadcast.service.mjs +0 -25
- package/dist/esm2020/chart/service/brush.service.mjs +0 -67
- package/dist/esm2020/chart/service/chart.service.mjs +0 -76
- package/dist/esm2020/chart/service/scale.service.mjs +0 -64
- package/dist/esm2020/chart/service/zoom.service.mjs +0 -117
- package/dist/esm2020/public-api.mjs +0 -8
- package/dist/fesm2015/tetacom-svg-charts.mjs +0 -1617
- package/dist/fesm2015/tetacom-svg-charts.mjs.map +0 -1
- package/dist/fesm2020/tetacom-svg-charts.mjs +0 -1603
- package/dist/fesm2020/tetacom-svg-charts.mjs.map +0 -1
- package/dist/package.json +0 -35
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -7
- package/src/chart/Chart.stories.ts +0 -397
- package/src/chart/base/series-base.component.ts +0 -41
- package/src/chart/chart/chart.component.html +0 -5
- package/src/chart/chart/chart.component.scss +0 -6
- package/src/chart/chart/chart.component.spec.ts +0 -25
- package/src/chart/chart/chart.component.ts +0 -97
- package/src/chart/chart-container/chart-container.component.html +0 -78
- package/src/chart/chart-container/chart-container.component.scss +0 -15
- package/src/chart/chart-container/chart-container.component.spec.ts +0 -25
- package/src/chart/chart-container/chart-container.component.ts +0 -242
- package/src/chart/chart-container/gridlines/gridlines.component.html +0 -7
- package/src/chart/chart-container/gridlines/gridlines.component.scss +0 -8
- package/src/chart/chart-container/gridlines/gridlines.component.spec.ts +0 -25
- package/src/chart/chart-container/gridlines/gridlines.component.ts +0 -55
- package/src/chart/chart-container/plotband/plotband.component.html +0 -58
- package/src/chart/chart-container/plotband/plotband.component.scss +0 -13
- package/src/chart/chart-container/plotband/plotband.component.spec.ts +0 -25
- package/src/chart/chart-container/plotband/plotband.component.ts +0 -206
- package/src/chart/chart-container/plotline/plotline.component.html +0 -22
- package/src/chart/chart-container/plotline/plotline.component.scss +0 -6
- package/src/chart/chart-container/plotline/plotline.component.spec.ts +0 -25
- package/src/chart/chart-container/plotline/plotline.component.ts +0 -113
- package/src/chart/chart-container/series/bar/bar-series.component.html +0 -3
- package/src/chart/chart-container/series/bar/bar-series.component.scss +0 -0
- package/src/chart/chart-container/series/bar/bar-series.component.ts +0 -71
- package/src/chart/chart-container/series/line/line-series.component.html +0 -38
- package/src/chart/chart-container/series/line/line-series.component.scss +0 -9
- package/src/chart/chart-container/series/line/line-series.component.spec.ts +0 -25
- package/src/chart/chart-container/series/line/line-series.component.ts +0 -245
- package/src/chart/chart-container/series-host/series-host.component.ts +0 -80
- package/src/chart/chart-container/tooltip/tooltip.component.html +0 -14
- package/src/chart/chart-container/tooltip/tooltip.component.scss +0 -7
- package/src/chart/chart-container/tooltip/tooltip.component.spec.ts +0 -25
- package/src/chart/chart-container/tooltip/tooltip.component.ts +0 -134
- package/src/chart/chart-container/x-axis/x-axis.component.html +0 -1
- package/src/chart/chart-container/x-axis/x-axis.component.scss +0 -3
- package/src/chart/chart-container/x-axis/x-axis.component.spec.ts +0 -25
- package/src/chart/chart-container/x-axis/x-axis.component.ts +0 -80
- package/src/chart/chart-container/y-axis/y-axis.component.html +0 -4
- package/src/chart/chart-container/y-axis/y-axis.component.scss +0 -13
- package/src/chart/chart-container/y-axis/y-axis.component.spec.ts +0 -25
- package/src/chart/chart-container/y-axis/y-axis.component.ts +0 -90
- package/src/chart/chart.module.ts +0 -40
- package/src/chart/core/axis/axis.ts +0 -132
- package/src/chart/core/axis/builders/axis-size-builder.ts +0 -37
- package/src/chart/core/axis/builders/extremes-builder.ts +0 -45
- package/src/chart/core/axis/builders/public-api.ts +0 -2
- package/src/chart/core/utils/generate-ticks.ts +0 -14
- package/src/chart/core/utils/get-text-width.ts +0 -10
- package/src/chart/core/utils/public-api.ts +0 -2
- package/src/chart/default/default-chart-config.ts +0 -12
- package/src/chart/directives/brushable.directive.ts +0 -30
- package/src/chart/directives/zoomable.directive.ts +0 -31
- package/src/chart/legend/legend.component.html +0 -6
- package/src/chart/legend/legend.component.scss +0 -20
- package/src/chart/legend/legend.component.spec.ts +0 -25
- package/src/chart/legend/legend.component.ts +0 -35
- package/src/chart/model/axis-options.ts +0 -18
- package/src/chart/model/base-point.ts +0 -10
- package/src/chart/model/chart-bounds.ts +0 -18
- package/src/chart/model/enum/axis-orientation.ts +0 -4
- package/src/chart/model/enum/axis-type.ts +0 -7
- package/src/chart/model/enum/brush-type.ts +0 -5
- package/src/chart/model/enum/drag-point-type.ts +0 -5
- package/src/chart/model/enum/public-api.ts +0 -7
- package/src/chart/model/enum/series-type.ts +0 -4
- package/src/chart/model/enum/tooltip-tracking.ts +0 -4
- package/src/chart/model/enum/zoom-type.ts +0 -5
- package/src/chart/model/i-broadcast-message.ts +0 -5
- package/src/chart/model/i-builder.ts +0 -3
- package/src/chart/model/i-chart-config.ts +0 -33
- package/src/chart/model/i-chart-event.ts +0 -4
- package/src/chart/model/i-display-tooltip.ts +0 -7
- package/src/chart/model/i-drag-event.ts +0 -5
- package/src/chart/model/i-point-move.ts +0 -7
- package/src/chart/model/marker-options.ts +0 -8
- package/src/chart/model/plotband.ts +0 -45
- package/src/chart/model/plotline.ts +0 -29
- package/src/chart/model/public-api.ts +0 -14
- package/src/chart/model/series.ts +0 -18
- package/src/chart/model/svg-attributes.ts +0 -14
- package/src/chart/model/tooltip-options.ts +0 -37
- package/src/chart/service/axes.service.spec.ts +0 -16
- package/src/chart/service/axes.service.ts +0 -27
- package/src/chart/service/broadcast.service.spec.ts +0 -16
- package/src/chart/service/broadcast.service.ts +0 -24
- package/src/chart/service/brush.service.spec.ts +0 -16
- package/src/chart/service/brush.service.ts +0 -87
- package/src/chart/service/chart.service.spec.ts +0 -16
- package/src/chart/service/chart.service.ts +0 -100
- package/src/chart/service/scale.service.spec.ts +0 -16
- package/src/chart/service/scale.service.ts +0 -74
- package/src/chart/service/zoom.service.spec.ts +0 -16
- package/src/chart/service/zoom.service.ts +0 -153
- package/src/public-api.ts +0 -8
- package/src/test.ts +0 -27
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AfterViewInit,
|
|
3
|
-
Directive,
|
|
4
|
-
ElementRef,
|
|
5
|
-
Input,
|
|
6
|
-
OnInit,
|
|
7
|
-
} from '@angular/core';
|
|
8
|
-
import { IChartConfig } from '../model/i-chart-config';
|
|
9
|
-
import { BrushService } from '../service/brush.service';
|
|
10
|
-
import { ChartService } from '../service/chart.service';
|
|
11
|
-
|
|
12
|
-
@Directive({
|
|
13
|
-
selector: 'svg:svg[tetaBrushable]',
|
|
14
|
-
})
|
|
15
|
-
export class BrushableDirective implements OnInit, AfterViewInit {
|
|
16
|
-
@Input() config?: IChartConfig;
|
|
17
|
-
@Input() size?: DOMRect;
|
|
18
|
-
|
|
19
|
-
constructor(
|
|
20
|
-
private brushService: BrushService,
|
|
21
|
-
private chartService: ChartService,
|
|
22
|
-
private element: ElementRef
|
|
23
|
-
) {}
|
|
24
|
-
|
|
25
|
-
ngOnInit() {}
|
|
26
|
-
|
|
27
|
-
ngAfterViewInit() {
|
|
28
|
-
this.brushService.applyBrush(this.element, this.config, this.size);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Directive, ElementRef, HostBinding, Input } from '@angular/core';
|
|
2
|
-
import { ZoomService } from '../service/zoom.service';
|
|
3
|
-
import { ChartService } from '../service/chart.service';
|
|
4
|
-
import { IChartConfig } from '../model/i-chart-config';
|
|
5
|
-
import { Axis } from '../core/axis/axis';
|
|
6
|
-
|
|
7
|
-
@Directive({
|
|
8
|
-
selector: '[tetaZoomable]',
|
|
9
|
-
})
|
|
10
|
-
export class ZoomableDirective {
|
|
11
|
-
@Input() config?: IChartConfig;
|
|
12
|
-
@Input() axis?: Axis;
|
|
13
|
-
@Input() size?: DOMRect;
|
|
14
|
-
|
|
15
|
-
@HostBinding('class.zoomable') private zoomable = false;
|
|
16
|
-
|
|
17
|
-
constructor(
|
|
18
|
-
private element: ElementRef,
|
|
19
|
-
private svc: ZoomService,
|
|
20
|
-
private chartService: ChartService
|
|
21
|
-
) {}
|
|
22
|
-
|
|
23
|
-
ngOnInit() {
|
|
24
|
-
if (this.config?.zoom?.enable || this.axis?.options?.zoom) {
|
|
25
|
-
this.zoomable = true;
|
|
26
|
-
|
|
27
|
-
this.svc.applyZoom(this.element, this.chartService.config, this.size);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
ngAfterViewInit() {}
|
|
31
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
display: flex;
|
|
3
|
-
grid-gap: 8px;
|
|
4
|
-
flex-wrap: wrap;
|
|
5
|
-
align-items: center;
|
|
6
|
-
justify-content: space-evenly;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
:host .legend-item {
|
|
10
|
-
display: flex;
|
|
11
|
-
align-items: center;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
:host .legend-icon-form {
|
|
15
|
-
width: 12px;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
:host .legend-label {
|
|
19
|
-
margin-left: 5px;
|
|
20
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { LegendComponent } from './legend.component';
|
|
4
|
-
|
|
5
|
-
describe('LegendComponent', () => {
|
|
6
|
-
let component: LegendComponent;
|
|
7
|
-
let fixture: ComponentFixture<LegendComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [ LegendComponent ]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(LegendComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
HostBinding,
|
|
5
|
-
Input,
|
|
6
|
-
OnInit,
|
|
7
|
-
} from '@angular/core';
|
|
8
|
-
import { Series } from '../model/series';
|
|
9
|
-
import { BasePoint } from '../model/base-point';
|
|
10
|
-
import { SeriesType } from '../model/enum/series-type';
|
|
11
|
-
|
|
12
|
-
@Component({
|
|
13
|
-
selector: 'teta-legend',
|
|
14
|
-
templateUrl: './legend.component.html',
|
|
15
|
-
styleUrls: ['./legend.component.scss'],
|
|
16
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
17
|
-
})
|
|
18
|
-
export class LegendComponent implements OnInit {
|
|
19
|
-
private sizeMapping = new Map<SeriesType, number>()
|
|
20
|
-
.set(SeriesType.line, 2)
|
|
21
|
-
.set(SeriesType.bar, 12);
|
|
22
|
-
|
|
23
|
-
@Input() series: Array<Series<BasePoint>>;
|
|
24
|
-
@HostBinding('class.padding-bottom-4') classLegend = true;
|
|
25
|
-
|
|
26
|
-
constructor() {}
|
|
27
|
-
|
|
28
|
-
ngOnInit(): void {
|
|
29
|
-
this.series = this.series?.filter((_) => _.showInLegend !== false);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
getHeight(serie: Series<BasePoint>) {
|
|
33
|
-
return this.sizeMapping.get(serie.type);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AxisType } from './enum/axis-type';
|
|
2
|
-
import { Plotband } from './plotband';
|
|
3
|
-
import { PlotLine } from './plotline';
|
|
4
|
-
|
|
5
|
-
export interface AxisOptions {
|
|
6
|
-
title?: string;
|
|
7
|
-
min?: number;
|
|
8
|
-
max?: number;
|
|
9
|
-
visible?: boolean;
|
|
10
|
-
tickFormat?: (d: any) => string;
|
|
11
|
-
type?: AxisType;
|
|
12
|
-
zoom?: boolean;
|
|
13
|
-
inverted?: boolean;
|
|
14
|
-
negative?: boolean;
|
|
15
|
-
opposite?: boolean;
|
|
16
|
-
plotbands?: Plotband[];
|
|
17
|
-
plotlines?: PlotLine[];
|
|
18
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export class ChartBounds {
|
|
2
|
-
top = 0;
|
|
3
|
-
right = 30;
|
|
4
|
-
bottom = 0;
|
|
5
|
-
left = 0;
|
|
6
|
-
|
|
7
|
-
constructor(options?: {
|
|
8
|
-
top?: number;
|
|
9
|
-
right?: number;
|
|
10
|
-
bottom?: number;
|
|
11
|
-
left: number;
|
|
12
|
-
}) {
|
|
13
|
-
this.top = options?.top || this.top;
|
|
14
|
-
this.right = options?.right || this.right;
|
|
15
|
-
this.bottom = options?.bottom || this.bottom;
|
|
16
|
-
this.left = options?.left || this.left;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Series } from './series';
|
|
2
|
-
import { BasePoint } from './base-point';
|
|
3
|
-
import { AxisOptions } from './axis-options';
|
|
4
|
-
import { ZoomType } from './enum/zoom-type';
|
|
5
|
-
import { TooltipOptions } from './tooltip-options';
|
|
6
|
-
import { ChartBounds } from './chart-bounds';
|
|
7
|
-
import { BrushType } from './enum/brush-type';
|
|
8
|
-
|
|
9
|
-
export interface IChartConfig {
|
|
10
|
-
name?: string;
|
|
11
|
-
series?: Series<BasePoint>[];
|
|
12
|
-
zoom?: {
|
|
13
|
-
enable: boolean;
|
|
14
|
-
type: ZoomType;
|
|
15
|
-
syncChannel?: string;
|
|
16
|
-
};
|
|
17
|
-
brush?: {
|
|
18
|
-
enable: boolean;
|
|
19
|
-
type: BrushType;
|
|
20
|
-
axisIndex?: number;
|
|
21
|
-
};
|
|
22
|
-
legend?: {
|
|
23
|
-
enable?: boolean;
|
|
24
|
-
};
|
|
25
|
-
bounds?: ChartBounds;
|
|
26
|
-
inverted?: boolean;
|
|
27
|
-
tooltip?: TooltipOptions;
|
|
28
|
-
xAxis: AxisOptions[];
|
|
29
|
-
yAxis: AxisOptions[];
|
|
30
|
-
gridLines?: boolean;
|
|
31
|
-
width?: number;
|
|
32
|
-
height?: number;
|
|
33
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { SvgAttributes } from './svg-attributes';
|
|
2
|
-
|
|
3
|
-
export class Plotband {
|
|
4
|
-
id: number | string;
|
|
5
|
-
from: number;
|
|
6
|
-
to: number;
|
|
7
|
-
label?: string;
|
|
8
|
-
showGrabbers?: boolean;
|
|
9
|
-
draggable?: boolean;
|
|
10
|
-
resizable?: boolean;
|
|
11
|
-
min?: number;
|
|
12
|
-
max?: number;
|
|
13
|
-
style?: {
|
|
14
|
-
plotband?: SvgAttributes;
|
|
15
|
-
grabbers?: SvgAttributes;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
constructor(options?: {
|
|
19
|
-
id: any;
|
|
20
|
-
from: number;
|
|
21
|
-
to: number;
|
|
22
|
-
label?: string;
|
|
23
|
-
showGrabbers?: boolean;
|
|
24
|
-
draggable?: boolean;
|
|
25
|
-
resizable?: boolean;
|
|
26
|
-
min?: number;
|
|
27
|
-
max?: number;
|
|
28
|
-
style?: {
|
|
29
|
-
plotband?: SvgAttributes;
|
|
30
|
-
grabbers?: SvgAttributes;
|
|
31
|
-
};
|
|
32
|
-
}) {
|
|
33
|
-
this.id = options?.id;
|
|
34
|
-
this.from = options?.from;
|
|
35
|
-
this.to = options?.to;
|
|
36
|
-
this.label = options?.label;
|
|
37
|
-
this.showGrabbers =
|
|
38
|
-
options?.showGrabbers != null ? options.showGrabbers : true;
|
|
39
|
-
this.draggable = options?.draggable != null ? options?.draggable : false;
|
|
40
|
-
this.resizable = options?.resizable != null ? options?.resizable : true;
|
|
41
|
-
this.min = options?.min;
|
|
42
|
-
this.max = options?.max;
|
|
43
|
-
this.style = options?.style;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { SvgAttributes } from './svg-attributes';
|
|
2
|
-
|
|
3
|
-
export class PlotLine {
|
|
4
|
-
id?: number | string;
|
|
5
|
-
value: number;
|
|
6
|
-
label?: string;
|
|
7
|
-
min?: number;
|
|
8
|
-
max?: number;
|
|
9
|
-
draggable?: boolean;
|
|
10
|
-
style?: SvgAttributes;
|
|
11
|
-
|
|
12
|
-
constructor(options?: {
|
|
13
|
-
id?: number;
|
|
14
|
-
value: number;
|
|
15
|
-
label?: string;
|
|
16
|
-
min?: number;
|
|
17
|
-
max?: number;
|
|
18
|
-
draggable?: boolean;
|
|
19
|
-
style?: SvgAttributes;
|
|
20
|
-
}) {
|
|
21
|
-
this.id = options?.id;
|
|
22
|
-
this.value = options?.value;
|
|
23
|
-
this.label = options?.label;
|
|
24
|
-
this.min = options?.min;
|
|
25
|
-
this.max = options?.max;
|
|
26
|
-
this.draggable = options?.draggable;
|
|
27
|
-
this.style = options?.style;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export * from './enum/public-api';
|
|
2
|
-
|
|
3
|
-
export * from './axis-options';
|
|
4
|
-
export * from './base-point';
|
|
5
|
-
export * from './chart-bounds';
|
|
6
|
-
export * from './i-broadcast-message';
|
|
7
|
-
export * from './i-chart-config';
|
|
8
|
-
export * from './i-chart-event';
|
|
9
|
-
export * from './i-point-move';
|
|
10
|
-
export * from './marker-options';
|
|
11
|
-
export * from './plotband';
|
|
12
|
-
export * from './plotline';
|
|
13
|
-
export * from './series';
|
|
14
|
-
export * from './svg-attributes';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { BasePoint } from './base-point';
|
|
2
|
-
import { SeriesType } from './enum/series-type';
|
|
3
|
-
import { SeriesBaseComponent } from '../base/series-base.component';
|
|
4
|
-
import { SvgAttributes } from './svg-attributes';
|
|
5
|
-
|
|
6
|
-
export interface Series<T extends BasePoint> {
|
|
7
|
-
id?: number | string;
|
|
8
|
-
type: SeriesType;
|
|
9
|
-
data: T[];
|
|
10
|
-
name?: string;
|
|
11
|
-
xAxisIndex?: number;
|
|
12
|
-
yAxisIndex?: number;
|
|
13
|
-
component?: typeof SeriesBaseComponent;
|
|
14
|
-
visible?: boolean;
|
|
15
|
-
color?: string;
|
|
16
|
-
showInLegend?: boolean;
|
|
17
|
-
style?: SvgAttributes;
|
|
18
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface SvgAttributes {
|
|
2
|
-
className?: string;
|
|
3
|
-
fill?: string;
|
|
4
|
-
fillOpacity?: number;
|
|
5
|
-
opacity?: number;
|
|
6
|
-
stroke?: string;
|
|
7
|
-
strokeLinecap?: 'butt' | 'round' | 'square';
|
|
8
|
-
strokeLinejoin?: 'butt' | 'round' | 'square';
|
|
9
|
-
strokeDasharray?: string;
|
|
10
|
-
strokeOpacity?: number;
|
|
11
|
-
strokeWidth?: number;
|
|
12
|
-
patternImage?: string;
|
|
13
|
-
radius?: number;
|
|
14
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { TooltipTracking } from './enum/tooltip-tracking';
|
|
2
|
-
|
|
3
|
-
export interface TooltipOptions {
|
|
4
|
-
enable?: boolean;
|
|
5
|
-
showMarkers?: boolean;
|
|
6
|
-
showLine?: boolean;
|
|
7
|
-
tracking?: TooltipTracking;
|
|
8
|
-
format?: (data: any) => any;
|
|
9
|
-
//
|
|
10
|
-
// constructor(options?: {
|
|
11
|
-
// enable?: boolean;
|
|
12
|
-
// showMarkers?: boolean;
|
|
13
|
-
// showLine?: boolean;
|
|
14
|
-
// tracking?: TooltipTracking;
|
|
15
|
-
// format?: (data: any) => any;
|
|
16
|
-
// }) {
|
|
17
|
-
// const defaultFormatter = (tooltips) => {
|
|
18
|
-
// let html = '';
|
|
19
|
-
//
|
|
20
|
-
// // tooltips
|
|
21
|
-
// // .filter((_) => _.point)
|
|
22
|
-
// // .forEach((_) => {
|
|
23
|
-
// // html += `<div>${_.name ?? 'Без названия'} x: ${_.point?.x?.toFixed(
|
|
24
|
-
// // 2
|
|
25
|
-
// // )} y: ${_.point?.y?.toFixed(2)}</div>`;
|
|
26
|
-
// // });
|
|
27
|
-
//
|
|
28
|
-
// return html;
|
|
29
|
-
// };
|
|
30
|
-
//
|
|
31
|
-
// this.enable = options?.enable ?? true;
|
|
32
|
-
// this.showMarkers = options?.showMarkers ?? true;
|
|
33
|
-
// this.showLine = options?.showLine ?? false;
|
|
34
|
-
// this.tracking = options?.tracking ?? TooltipTracking.x;
|
|
35
|
-
// this.format = options?.format ?? defaultFormatter;
|
|
36
|
-
// }
|
|
37
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { AxesService } from './axes.service';
|
|
4
|
-
|
|
5
|
-
describe('AxesService', () => {
|
|
6
|
-
let service: AxesService;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
TestBed.configureTestingModule({});
|
|
10
|
-
service = TestBed.inject(AxesService);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should be created', () => {
|
|
14
|
-
expect(service).toBeTruthy();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { IChartConfig } from '../model/i-chart-config';
|
|
3
|
-
import { AxisOrientation } from '../model/enum/axis-orientation';
|
|
4
|
-
import { Axis } from '../core/axis/axis';
|
|
5
|
-
|
|
6
|
-
@Injectable({
|
|
7
|
-
providedIn: 'root',
|
|
8
|
-
})
|
|
9
|
-
export class AxesService {
|
|
10
|
-
public yAxis: Map<number, Axis> = new Map<number, Axis>();
|
|
11
|
-
public xAxis: Map<number, Axis> = new Map<number, Axis>();
|
|
12
|
-
|
|
13
|
-
constructor() {}
|
|
14
|
-
|
|
15
|
-
init(config: IChartConfig) {
|
|
16
|
-
config?.yAxis.forEach((_, index) => {
|
|
17
|
-
const axis = Axis.createAxis(AxisOrientation.y, config, index);
|
|
18
|
-
|
|
19
|
-
this.yAxis.set(index, axis);
|
|
20
|
-
});
|
|
21
|
-
config?.xAxis.forEach((_, index) => {
|
|
22
|
-
const axis = Axis.createAxis(AxisOrientation.x, config, index);
|
|
23
|
-
|
|
24
|
-
this.xAxis.set(index, axis);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { BroadcastService } from './broadcast.service';
|
|
4
|
-
|
|
5
|
-
describe('BroadcastService', () => {
|
|
6
|
-
let service: BroadcastService;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
TestBed.configureTestingModule({});
|
|
10
|
-
service = TestBed.inject(BroadcastService);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should be created', () => {
|
|
14
|
-
expect(service).toBeTruthy();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { IBroadcastMessage } from '../model/i-broadcast-message';
|
|
3
|
-
import { filter, Observable, Subject } from 'rxjs';
|
|
4
|
-
|
|
5
|
-
@Injectable({
|
|
6
|
-
providedIn: 'root',
|
|
7
|
-
})
|
|
8
|
-
export class BroadcastService {
|
|
9
|
-
private emitter: Subject<IBroadcastMessage>;
|
|
10
|
-
|
|
11
|
-
constructor() {
|
|
12
|
-
this.emitter = new Subject<IBroadcastMessage>();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
broadcast(value: IBroadcastMessage) {
|
|
16
|
-
this.emitter.next(value);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
subscribeToChannel(channel: string): Observable<IBroadcastMessage> {
|
|
20
|
-
return this.emitter
|
|
21
|
-
.asObservable()
|
|
22
|
-
.pipe(filter((msg) => channel && msg.channel === channel));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { BrushService } from './brush.service';
|
|
4
|
-
|
|
5
|
-
describe('BrushService', () => {
|
|
6
|
-
let service: BrushService;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
TestBed.configureTestingModule({});
|
|
10
|
-
service = TestBed.inject(BrushService);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should be created', () => {
|
|
14
|
-
expect(service).toBeTruthy();
|
|
15
|
-
});
|
|
16
|
-
});
|