UNPKG

bytev-charts-beta

Version:

基于echarts和JavaScript及ES6封装的一个可以直接调用的图表组件库,内置主题设计,简单快捷,且支持用户自定义配置; npm 安装方式: npm install bytev-charts 若启动提示还需额外install插件,则运行 npm install @babel/runtime-corejs2 即可;

186 lines (158 loc) 7.1 kB
import "core-js/modules/es.array.iterator.js"; import "core-js/modules/es.array-buffer.slice.js"; import "core-js/modules/es.object.to-string.js"; import "core-js/modules/es.typed-array.float32-array.js"; import "core-js/modules/es.typed-array.copy-within.js"; import "core-js/modules/es.typed-array.every.js"; import "core-js/modules/es.typed-array.fill.js"; import "core-js/modules/es.typed-array.filter.js"; import "core-js/modules/es.typed-array.find.js"; import "core-js/modules/es.typed-array.find-index.js"; import "core-js/modules/es.typed-array.for-each.js"; import "core-js/modules/es.typed-array.includes.js"; import "core-js/modules/es.typed-array.index-of.js"; import "core-js/modules/es.typed-array.iterator.js"; import "core-js/modules/es.typed-array.join.js"; import "core-js/modules/es.typed-array.last-index-of.js"; import "core-js/modules/es.typed-array.map.js"; import "core-js/modules/es.typed-array.reduce.js"; import "core-js/modules/es.typed-array.reduce-right.js"; import "core-js/modules/es.typed-array.reverse.js"; import "core-js/modules/es.typed-array.set.js"; import "core-js/modules/es.typed-array.slice.js"; import "core-js/modules/es.typed-array.some.js"; import "core-js/modules/es.typed-array.sort.js"; import "core-js/modules/es.typed-array.subarray.js"; import "core-js/modules/es.typed-array.to-locale-string.js"; import "core-js/modules/es.typed-array.to-string.js"; import _Object$assign from "@babel/runtime-corejs2/core-js/object/assign"; import _Object$create from "@babel/runtime-corejs2/core-js/object/create"; import _Array$isArray from "@babel/runtime-corejs2/core-js/array/is-array"; console.warn("THREE.LineSegmentsGeometry: As part of the transition to ES6 Modules, the files in 'examples/js' were deprecated in May 2020 (r117) and will be deleted in December 2020 (r124). You can find more information about developing using ES6 Modules in https://threejs.org/docs/#manual/en/introduction/Installation."); THREE.LineSegmentsGeometry = function () { THREE.InstancedBufferGeometry.call(this); this.type = 'LineSegmentsGeometry'; var positions = [-1, 2, 0, 1, 2, 0, -1, 1, 0, 1, 1, 0, -1, 0, 0, 1, 0, 0, -1, -1, 0, 1, -1, 0]; var uvs = [-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2]; var index = [0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5]; this.setIndex(index); this.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); this.setAttribute('uv', new THREE.Float32BufferAttribute(uvs, 2)); }; THREE.LineSegmentsGeometry.prototype = _Object$assign(_Object$create(THREE.InstancedBufferGeometry.prototype), { constructor: THREE.LineSegmentsGeometry, isLineSegmentsGeometry: true, applyMatrix4: function applyMatrix4(matrix) { var start = this.attributes.instanceStart; var end = this.attributes.instanceEnd; if (start !== undefined) { start.applyMatrix4(matrix); end.applyMatrix4(matrix); start.needsUpdate = true; } if (this.boundingBox !== null) { this.computeBoundingBox(); } if (this.boundingSphere !== null) { this.computeBoundingSphere(); } return this; }, setPositions: function setPositions(array) { var lineSegments; if (array instanceof Float32Array) { lineSegments = array; } else if (_Array$isArray(array)) { lineSegments = new Float32Array(array); } var instanceBuffer = new THREE.InstancedInterleavedBuffer(lineSegments, 6, 1); // xyz, xyz this.setAttribute('instanceStart', new THREE.InterleavedBufferAttribute(instanceBuffer, 3, 0)); // xyz this.setAttribute('instanceEnd', new THREE.InterleavedBufferAttribute(instanceBuffer, 3, 3)); // xyz // this.computeBoundingBox(); this.computeBoundingSphere(); return this; }, setColors: function setColors(array) { var colors; if (array instanceof Float32Array) { colors = array; } else if (_Array$isArray(array)) { colors = new Float32Array(array); } var instanceColorBuffer = new THREE.InstancedInterleavedBuffer(colors, 6, 1); // rgb, rgb this.setAttribute('instanceColorStart', new THREE.InterleavedBufferAttribute(instanceColorBuffer, 3, 0)); // rgb this.setAttribute('instanceColorEnd', new THREE.InterleavedBufferAttribute(instanceColorBuffer, 3, 3)); // rgb return this; }, fromWireframeGeometry: function fromWireframeGeometry(geometry) { this.setPositions(geometry.attributes.position.array); return this; }, fromEdgesGeometry: function fromEdgesGeometry(geometry) { this.setPositions(geometry.attributes.position.array); return this; }, fromMesh: function fromMesh(mesh) { this.fromWireframeGeometry(new THREE.WireframeGeometry(mesh.geometry)); // set colors, maybe return this; }, fromLineSegments: function fromLineSegments(lineSegments) { var geometry = lineSegments.geometry; if (geometry.isGeometry) { this.setPositions(geometry.vertices); } else if (geometry.isBufferGeometry) { this.setPositions(geometry.attributes.position.array); // assumes non-indexed } // set colors, maybe return this; }, computeBoundingBox: function () { var box = new THREE.Box3(); return function computeBoundingBox() { if (this.boundingBox === null) { this.boundingBox = new THREE.Box3(); } var start = this.attributes.instanceStart; var end = this.attributes.instanceEnd; if (start !== undefined && end !== undefined) { this.boundingBox.setFromBufferAttribute(start); box.setFromBufferAttribute(end); this.boundingBox.union(box); } }; }(), computeBoundingSphere: function () { var vector = new THREE.Vector3(); return function computeBoundingSphere() { if (this.boundingSphere === null) { this.boundingSphere = new THREE.Sphere(); } if (this.boundingBox === null) { this.computeBoundingBox(); } var start = this.attributes.instanceStart; var end = this.attributes.instanceEnd; if (start !== undefined && end !== undefined) { var center = this.boundingSphere.center; this.boundingBox.getCenter(center); var maxRadiusSq = 0; for (var i = 0, il = start.count; i < il; i++) { vector.fromBufferAttribute(start, i); maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(vector)); vector.fromBufferAttribute(end, i); maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(vector)); } this.boundingSphere.radius = Math.sqrt(maxRadiusSq); if (isNaN(this.boundingSphere.radius)) { console.error('THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.', this); } } }; }(), toJSON: function toJSON() {// todo }, applyMatrix: function applyMatrix(matrix) { console.warn('THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().'); return this.applyMatrix4(matrix); } });