bytev-charts
Version:
基于echarts和JavaScript及ES6封装的一个可以直接调用的图表组件库,内置主题设计,简单快捷,且支持用户自定义配置; npm 安装方式: npm install bytev-charts 若启动提示还需额外install插件,则运行 npm install @babel/runtime-corejs2 即可;
92 lines (83 loc) • 3.69 kB
JavaScript
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";
console.warn("THREE.LineGeometry: 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.LineGeometry = function () {
THREE.LineSegmentsGeometry.call(this);
this.type = 'LineGeometry';
};
THREE.LineGeometry.prototype = _Object$assign(_Object$create(THREE.LineSegmentsGeometry.prototype), {
constructor: THREE.LineGeometry,
isLineGeometry: true,
setPositions: function setPositions(array) {
// converts [ x1, y1, z1, x2, y2, z2, ... ] to pairs format
var length = array.length - 3;
var points = new Float32Array(2 * length);
for (var i = 0; i < length; i += 3) {
points[2 * i] = array[i];
points[2 * i + 1] = array[i + 1];
points[2 * i + 2] = array[i + 2];
points[2 * i + 3] = array[i + 3];
points[2 * i + 4] = array[i + 4];
points[2 * i + 5] = array[i + 5];
}
THREE.LineSegmentsGeometry.prototype.setPositions.call(this, points);
return this;
},
setColors: function setColors(array) {
// converts [ r1, g1, b1, r2, g2, b2, ... ] to pairs format
var length = array.length - 3;
var colors = new Float32Array(2 * length);
for (var i = 0; i < length; i += 3) {
colors[2 * i] = array[i];
colors[2 * i + 1] = array[i + 1];
colors[2 * i + 2] = array[i + 2];
colors[2 * i + 3] = array[i + 3];
colors[2 * i + 4] = array[i + 4];
colors[2 * i + 5] = array[i + 5];
}
THREE.LineSegmentsGeometry.prototype.setColors.call(this, colors);
return this;
},
fromLine: function fromLine(line) {
var geometry = line.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;
},
copy: function
/* source */
copy() {
// todo
return this;
}
});