File tree Expand file tree Collapse file tree 6 files changed +80
-3
lines changed
Expand file tree Collapse file tree 6 files changed +80
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import {
1010/**
1111 * mapboxgl的echars 4.0的实现
1212 * @author 基础平台/创新中心 潘卓然 ParnDeedlit
13- * @class mapboxgl.zondy .EchartsLayer
13+ * @class module:客户端可视化 .EchartsLayer
1414 * @classdesc 基于mapboxgl的Layer对象进行的拓展
1515 * @param map - {Object} 传入的mapboxgl的地图对象
1616 * @param options - {Object} echarts.options 使用 option 来描述其对图表的各种需求,包括:有什么数据、要画什么图表、图表长什么样子、含有什么组件、组件能操作什么事情等等。简而言之,option 表述了:数据、数据如何映射成图形、交互行为。
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { MapvBaseLayer } from "./mapv/MapvBaseLayer";
55/**
66 * @origin author kyle / http://nikai.us/
77 * @author 基础平台/创新中心 潘卓然 ParnDeedlit
8- * @class mapboxgl.zondy .MapvLayer
8+ * @class module:客户端可视化 .MapvLayer
99 * @classdesc 基于mapboxgl的Layer对象进行的拓展
1010 * @param map - {Object} 传入的mapboxgl的地图对象
1111 * @param dataset - {MapvDataSet} 传入的mapv的属性。 <br>
Original file line number Diff line number Diff line change 1+ /**
2+ * @module 客户端可视化
3+ */
14import { EchartsLayer } from './EchartsLayer' ;
25import { MapvLayer } from './MapvLayer' ;
36
Original file line number Diff line number Diff line change @@ -8,11 +8,34 @@ import {
88/**
99 * @origin author kyle / http://nikai.us/
1010 * @author 基础平台/创新中心 潘卓然 ParnDeedlit
11- * @class openlayers.zondy .MapvLayer
11+ * @class module:客户端可视化 .MapvLayer
1212 * @classdesc 基于mapboxgl的Layer对象进行的拓展
1313 * @param map - {Object} 传入的mapboxgl的地图对象
1414 * @param dataset - {MapvDataSet} 传入的mapv的属性。 <br>
1515 * @param mapvoption - {MapvOption} 可选参数。<br>
16+ * @see https://github.com/huiyan-fe/mapv/blob/master/API.md
17+ * @example
18+ * var options = {
19+ size: 13,
20+ gradient: {
21+ 0.25: "rgb(0,0,255)",
22+ 0.55: "rgb(0,255,0)",
23+ 0.85: "yellow",
24+ 1.0: "rgb(255,0,0)"
25+ },
26+ max: 60,
27+ animation: {
28+ type: 'time',
29+ stepsRange: {
30+ start: 0,
31+ end: 100
32+ },
33+ trails: 10,
34+ duration: 4,
35+ },
36+ draw: 'heatmap'
37+ }
38+ var mapvLayer = new L.zondy.MapvLayer(map, dataSet, options).addTo(map);
1639 */
1740export class MapvLayer /* extends Layer */ {
1841
Original file line number Diff line number Diff line change 1+ /**
2+ * @module 客户端可视化
3+ */
14/* import {
25 EchartsLayer
36} from './EchartsLayer' */
Original file line number Diff line number Diff line change 1+ /**
2+ * @author 基础平台/潘卓然
3+ * @param {* } points 已有数据坐标集合
4+ * @example
5+ * var trues = [
6+ [2011, 12131], // 当前年份的产值
7+ [2012, 13345],
8+ [2013, 14532],
9+ [2014, 15472],
10+ [2015, 16945],
11+ ];
12+
13+ f = interpolatingPolynomial(trues);
14+
15+ // 预测未来的
16+ let futures2016 = f(2016); // 预测未来的产值
17+ let futures2017 = f(2017);
18+ let futures2018 = f(2018);
19+ let futures2019 = f(2019);
20+
21+ console.log(2016, futures2016);
22+ console.log(2017, futures2017);
23+ console.log(2018, futures2018);
24+ console.log(2019, futures2019);
25+
26+ * @returns 预测的下一个未来时间点/坐标系X下的的Y值的函数
27+ * @see 请注意,返回的是个函数需要再主动传递一次X来进行求值
28+ */
29+ export function interpolateLagrange ( points ) {
30+ var n = points . length - 1 , p ;
31+
32+ p = function ( i , j , x ) {
33+ if ( i === j ) {
34+ return points [ i ] [ 1 ] ;
35+ }
36+
37+ return ( ( points [ j ] [ 0 ] - x ) * p ( i , j - 1 , x ) +
38+ ( x - points [ i ] [ 0 ] ) * p ( i + 1 , j , x ) ) /
39+ ( points [ j ] [ 0 ] - points [ i ] [ 0 ] ) ;
40+ } ;
41+
42+ return function ( x ) {
43+ if ( points . length === 0 ) {
44+ return 0 ;
45+ }
46+ return p ( 0 , n , x ) ;
47+ } ;
48+ } ;
You can’t perform that action at this time.
0 commit comments