@tetacom/ng-components 1.0.33 → 1.0.34
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-3d/chart3d/chart3d.component.d.ts +1 -0
- package/component/chart-3d/model/chart-3d-options.d.ts +1 -0
- package/esm2020/component/chart-3d/chart3d/chart3d.component.mjs +64 -57
- package/esm2020/component/chart-3d/model/chart-3d-options.mjs +1 -1
- package/fesm2015/tetacom-ng-components.mjs +67 -60
- package/fesm2015/tetacom-ng-components.mjs.map +1 -1
- package/fesm2020/tetacom-ng-components.mjs +63 -56
- package/fesm2020/tetacom-ng-components.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -9967,7 +9967,8 @@ class Chart3dComponent {
|
|
|
9967
9967
|
ngOnInit() {
|
|
9968
9968
|
this._themeService.theme
|
|
9969
9969
|
.pipe(takeWhile((_) => this._alive), tap((_) => {
|
|
9970
|
-
this.gridColor = _ ? '#
|
|
9970
|
+
this.gridColor = _ ? '#5d6a73' : '#bdbdc6';
|
|
9971
|
+
this.axesColor = _ ? '#8e8f9d' : '#7d8f9a';
|
|
9971
9972
|
this.init();
|
|
9972
9973
|
}))
|
|
9973
9974
|
.subscribe();
|
|
@@ -9976,6 +9977,7 @@ class Chart3dComponent {
|
|
|
9976
9977
|
this.addResizeObserver();
|
|
9977
9978
|
this.createScene();
|
|
9978
9979
|
this.startRenderingLoop();
|
|
9980
|
+
this.init();
|
|
9979
9981
|
}
|
|
9980
9982
|
ngOnDestroy() {
|
|
9981
9983
|
this._alive = false;
|
|
@@ -9989,37 +9991,51 @@ class Chart3dComponent {
|
|
|
9989
9991
|
}
|
|
9990
9992
|
const { x, y, z } = this.getScales(this._config.series);
|
|
9991
9993
|
this.config.series.forEach((data, idx) => {
|
|
9992
|
-
|
|
9994
|
+
if (!data.points?.length) {
|
|
9995
|
+
return;
|
|
9996
|
+
}
|
|
9997
|
+
const points = data.points.map((_) => new THREE.Vector3(x(_.x), y(_.y), z(_.z)));
|
|
9993
9998
|
const color = d3.scaleOrdinal(d3.schemeTableau10);
|
|
9994
9999
|
const material = new THREE.LineBasicMaterial({
|
|
9995
10000
|
color: data?.color ?? color(idx.toString()),
|
|
9996
10001
|
});
|
|
9997
|
-
const
|
|
9998
|
-
|
|
9999
|
-
|
|
10000
|
-
|
|
10002
|
+
const tubeGeometry = new THREE.TubeGeometry(new THREE.CatmullRomCurve3(points), 1024, 0.5, 20, false);
|
|
10003
|
+
let tube = new THREE.Line(tubeGeometry, material);
|
|
10004
|
+
this._scene.add(tube);
|
|
10005
|
+
});
|
|
10006
|
+
const circles = x.ticks(this.SIDE_SIZE / 10);
|
|
10007
|
+
const material = new THREE.LineBasicMaterial({ color: this.axesColor });
|
|
10008
|
+
const pointsLines = [];
|
|
10009
|
+
pointsLines.push(new THREE.Vector3(0, 0, 0));
|
|
10010
|
+
pointsLines.push(new THREE.Vector3(0, 0, z(-z.domain()[1])));
|
|
10011
|
+
pointsLines.push(new THREE.Vector3(0, 0, 0));
|
|
10012
|
+
pointsLines.push(new THREE.Vector3(x(-x.domain()[1]), 0, 0));
|
|
10013
|
+
const geometryLines = new THREE.BufferGeometry().setFromPoints(pointsLines);
|
|
10014
|
+
const line = new THREE.Line(geometryLines, material);
|
|
10015
|
+
this._scene.add(line);
|
|
10016
|
+
circles.forEach((r) => {
|
|
10017
|
+
const material = new THREE.LineDashedMaterial({
|
|
10018
|
+
color: this.gridColor,
|
|
10019
|
+
dashSize: 1,
|
|
10020
|
+
gapSize: 3
|
|
10021
|
+
});
|
|
10022
|
+
const circleGeometry = new THREE.BufferGeometry().setFromPoints(new THREE.Path().absarc(0, 0, x(r), 0, Math.PI * 2, false).getSpacedPoints(100));
|
|
10023
|
+
const circle = new THREE.LineSegments(circleGeometry, material);
|
|
10024
|
+
circle.geometry.rotateX(-Math.PI / 2);
|
|
10025
|
+
this._scene.add(circle);
|
|
10001
10026
|
});
|
|
10002
|
-
const plane = new THREE.GridHelper(this.SIDE_SIZE, this.SIDE_SIZE / 10, this.gridColor, this.gridColor);
|
|
10003
|
-
plane.position.set(this.SIDE_SIZE / 2, 0, this.SIDE_SIZE / 2);
|
|
10004
|
-
this._scene.add(plane);
|
|
10005
|
-
const gridX = new THREE.GridHelper(this.SIDE_SIZE, this.SIDE_SIZE / 10, this.gridColor, this.gridColor);
|
|
10006
|
-
gridX.geometry.rotateX(-Math.PI / 2);
|
|
10007
|
-
gridX.position.set(this.SIDE_SIZE / 2, this.SIDE_SIZE / 2, 0);
|
|
10008
|
-
this._scene.add(gridX);
|
|
10009
|
-
const gridY = new THREE.GridHelper(this.SIDE_SIZE, this.SIDE_SIZE / 10, this.gridColor, this.gridColor);
|
|
10010
|
-
gridY.geometry.rotateZ(Math.PI / 2);
|
|
10011
|
-
gridY.position.set(0, this.SIDE_SIZE / 2, this.SIDE_SIZE / 2);
|
|
10012
|
-
this._scene.add(gridY);
|
|
10013
10027
|
this.drawTicks(x, y, z);
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10028
|
+
if (!this._controls) {
|
|
10029
|
+
this._controls = new OrbitControls(this._camera, this._renderer.domElement);
|
|
10030
|
+
this._controls.enableDamping = true;
|
|
10031
|
+
this._controls.enablePan = true;
|
|
10032
|
+
this._controls.dampingFactor = 0.25;
|
|
10033
|
+
this._controls.screenSpacePanning = true;
|
|
10034
|
+
this._controls.minDistance = 0;
|
|
10035
|
+
this._controls.maxDistance = 10000;
|
|
10036
|
+
this._controls.maxPolarAngle = Math.PI / 2;
|
|
10037
|
+
this._controls.enableZoom = true;
|
|
10038
|
+
}
|
|
10023
10039
|
}
|
|
10024
10040
|
createScene() {
|
|
10025
10041
|
this._scene = new THREE.Scene();
|
|
@@ -10081,7 +10097,7 @@ class Chart3dComponent {
|
|
|
10081
10097
|
map: texture,
|
|
10082
10098
|
});
|
|
10083
10099
|
const sprite = new THREE.Sprite(spriteMaterial);
|
|
10084
|
-
sprite.scale.set(
|
|
10100
|
+
sprite.scale.set(0.4 * fontSize, 0.4 * fontSize, 0.4 * fontSize);
|
|
10085
10101
|
return sprite;
|
|
10086
10102
|
}
|
|
10087
10103
|
drawTicks(x, y, z) {
|
|
@@ -10093,24 +10109,27 @@ class Chart3dComponent {
|
|
|
10093
10109
|
generatedTicks.forEach((_) => {
|
|
10094
10110
|
const sprite = this.makeSprite(_);
|
|
10095
10111
|
if (idx === 0) {
|
|
10096
|
-
sprite.position.set(x(_),
|
|
10112
|
+
sprite.position.set(x(_), y(y.domain()[1]), 0);
|
|
10097
10113
|
}
|
|
10098
10114
|
if (idx === 1) {
|
|
10099
|
-
sprite.position.set(-
|
|
10115
|
+
sprite.position.set(-10, y(_), 0);
|
|
10100
10116
|
}
|
|
10101
10117
|
if (idx === 2) {
|
|
10102
|
-
sprite.position.set(0,
|
|
10118
|
+
sprite.position.set(0, y(y.domain()[1]), z(_));
|
|
10103
10119
|
}
|
|
10104
10120
|
ticks.add(sprite);
|
|
10105
10121
|
});
|
|
10106
10122
|
});
|
|
10107
|
-
const northLabel = this.makeSprite('
|
|
10108
|
-
const westLabel = this.makeSprite('
|
|
10123
|
+
const northLabel = this.makeSprite('X', { fontSize: 28 });
|
|
10124
|
+
const westLabel = this.makeSprite('Y', { fontSize: 28 });
|
|
10109
10125
|
const tvdLabel = this.makeSprite('TVD', { fontSize: 28 });
|
|
10110
|
-
northLabel.position.set(x(
|
|
10111
|
-
westLabel.position.set(0, 0, y(
|
|
10112
|
-
tvdLabel.position.set(0, z(
|
|
10126
|
+
northLabel.position.set(x(x.domain()[1]) + 5, 0, 0);
|
|
10127
|
+
westLabel.position.set(0, 0, y(y.domain()[0]) + 5);
|
|
10128
|
+
tvdLabel.position.set(0, z(z.domain()[1]) + 5, 0);
|
|
10113
10129
|
ticks.add(northLabel, westLabel, tvdLabel);
|
|
10130
|
+
const axesHelper = new THREE.AxesHelper(this.SIDE_SIZE);
|
|
10131
|
+
axesHelper.setColors(this.axesColor, this.axesColor, this.axesColor);
|
|
10132
|
+
this._scene.add(axesHelper);
|
|
10114
10133
|
this._scene.add(ticks);
|
|
10115
10134
|
}
|
|
10116
10135
|
getScales(series) {
|
|
@@ -10127,34 +10146,22 @@ class Chart3dComponent {
|
|
|
10127
10146
|
}, { x: [], y: [], z: [] });
|
|
10128
10147
|
const x = d3
|
|
10129
10148
|
.scaleLinear()
|
|
10130
|
-
.domain([
|
|
10131
|
-
|
|
10132
|
-
this._config?.axes?.max == null
|
|
10133
|
-
? d3.max(flattenExtrems.x)
|
|
10149
|
+
.domain([0, this._config?.axes?.max == null
|
|
10150
|
+
? parseInt(d3.max(flattenExtrems.x))
|
|
10134
10151
|
: this._config.axes.max,
|
|
10135
10152
|
])
|
|
10136
|
-
.range([0, this.SIDE_SIZE])
|
|
10137
|
-
.nice();
|
|
10153
|
+
.range([0, this.SIDE_SIZE]).nice();
|
|
10138
10154
|
const y = d3
|
|
10139
10155
|
.scaleLinear()
|
|
10140
|
-
.domain([
|
|
10141
|
-
|
|
10142
|
-
this._config?.axes?.max == null
|
|
10143
|
-
? d3.max(flattenExtrems.y)
|
|
10144
|
-
: this._config.axes.max,
|
|
10145
|
-
])
|
|
10146
|
-
.range([0, this.SIDE_SIZE])
|
|
10147
|
-
.nice();
|
|
10156
|
+
.domain([0, parseInt(d3.max(flattenExtrems.y), 10)])
|
|
10157
|
+
.range([this.SIDE_SIZE, 0]);
|
|
10148
10158
|
const z = d3
|
|
10149
10159
|
.scaleLinear()
|
|
10150
|
-
.domain([
|
|
10151
|
-
d3.min(flattenExtrems.z),
|
|
10160
|
+
.domain([0,
|
|
10152
10161
|
this._config?.axes?.max == null
|
|
10153
|
-
? d3.max(flattenExtrems.z)
|
|
10154
|
-
: this._config.axes.max
|
|
10155
|
-
|
|
10156
|
-
.range([this.SIDE_SIZE, 0])
|
|
10157
|
-
.nice();
|
|
10162
|
+
? parseInt(d3.max(flattenExtrems.z))
|
|
10163
|
+
: this._config.axes.max])
|
|
10164
|
+
.range([0, this.SIDE_SIZE]).nice();
|
|
10158
10165
|
return { x, y, z };
|
|
10159
10166
|
}
|
|
10160
10167
|
}
|