jmchart 1.1.90 → 1.1.91

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.
@@ -340,7 +340,7 @@ define(['exports'], function (exports) { 'use strict';
340
340
  let isTouch = false;
341
341
  let touches = evt.changedTouches || evt.targetTouches || evt.touches;
342
342
  let target = evt.target || evt.srcElement;
343
- if(touches) {
343
+ if(touches && touches.length) {
344
344
  evt = touches[0];//兼容touch事件
345
345
  if(!evt.target) evt.target = target;
346
346
  isTouch = true;
@@ -4625,7 +4625,7 @@ define(['exports'], function (exports) { 'use strict';
4625
4625
  }
4626
4626
 
4627
4627
  option = option || {};
4628
-
4628
+ option.mode = option.mode || '2d'; // webgl | 2d
4629
4629
  option.interactive = true;
4630
4630
 
4631
4631
  super(option, 'jmGraph');
@@ -4665,8 +4665,7 @@ define(['exports'], function (exports) { 'use strict';
4665
4665
  }
4666
4666
  else {
4667
4667
  this.container = canvas.parentElement;
4668
- }
4669
-
4668
+ }
4670
4669
  this.context = canvas.getContext('2d');
4671
4670
  }
4672
4671
  this.canvas = canvas;
@@ -7967,8 +7966,7 @@ define(['exports'], function (exports) { 'use strict';
7967
7966
 
7968
7967
 
7969
7968
  longtapHandler = graph.utils.requestAnimationFrame(reqFun); //args.event.stopPropagation();
7970
-
7971
- args.event.preventDefault(); // 阻止默认行为
7969
+ //args.event.preventDefault();// 阻止默认行为
7972
7970
  } else {
7973
7971
  this.startMove(args);
7974
7972
  }
@@ -342,7 +342,7 @@ class jmUtils {
342
342
  let isTouch = false;
343
343
  let touches = evt.changedTouches || evt.targetTouches || evt.touches;
344
344
  let target = evt.target || evt.srcElement;
345
- if(touches) {
345
+ if(touches && touches.length) {
346
346
  evt = touches[0];//兼容touch事件
347
347
  if(!evt.target) evt.target = target;
348
348
  isTouch = true;
@@ -4627,7 +4627,7 @@ class jmGraph$1 extends jmControl {
4627
4627
  }
4628
4628
 
4629
4629
  option = option || {};
4630
-
4630
+ option.mode = option.mode || '2d'; // webgl | 2d
4631
4631
  option.interactive = true;
4632
4632
 
4633
4633
  super(option, 'jmGraph');
@@ -4667,8 +4667,7 @@ class jmGraph$1 extends jmControl {
4667
4667
  }
4668
4668
  else {
4669
4669
  this.container = canvas.parentElement;
4670
- }
4671
-
4670
+ }
4672
4671
  this.context = canvas.getContext('2d');
4673
4672
  }
4674
4673
  this.canvas = canvas;
@@ -7969,8 +7968,7 @@ class jmMarkLineManager {
7969
7968
 
7970
7969
 
7971
7970
  longtapHandler = graph.utils.requestAnimationFrame(reqFun); //args.event.stopPropagation();
7972
-
7973
- args.event.preventDefault(); // 阻止默认行为
7971
+ //args.event.preventDefault();// 阻止默认行为
7974
7972
  } else {
7975
7973
  this.startMove(args);
7976
7974
  }
@@ -338,7 +338,7 @@ class jmUtils {
338
338
  let isTouch = false;
339
339
  let touches = evt.changedTouches || evt.targetTouches || evt.touches;
340
340
  let target = evt.target || evt.srcElement;
341
- if(touches) {
341
+ if(touches && touches.length) {
342
342
  evt = touches[0];//兼容touch事件
343
343
  if(!evt.target) evt.target = target;
344
344
  isTouch = true;
@@ -4623,7 +4623,7 @@ class jmGraph$1 extends jmControl {
4623
4623
  }
4624
4624
 
4625
4625
  option = option || {};
4626
-
4626
+ option.mode = option.mode || '2d'; // webgl | 2d
4627
4627
  option.interactive = true;
4628
4628
 
4629
4629
  super(option, 'jmGraph');
@@ -4663,8 +4663,7 @@ class jmGraph$1 extends jmControl {
4663
4663
  }
4664
4664
  else {
4665
4665
  this.container = canvas.parentElement;
4666
- }
4667
-
4666
+ }
4668
4667
  this.context = canvas.getContext('2d');
4669
4668
  }
4670
4669
  this.canvas = canvas;
@@ -7965,8 +7964,7 @@ class jmMarkLineManager {
7965
7964
 
7966
7965
 
7967
7966
  longtapHandler = graph.utils.requestAnimationFrame(reqFun); //args.event.stopPropagation();
7968
-
7969
- args.event.preventDefault(); // 阻止默认行为
7967
+ //args.event.preventDefault();// 阻止默认行为
7970
7968
  } else {
7971
7969
  this.startMove(args);
7972
7970
  }
@@ -341,7 +341,7 @@
341
341
  let isTouch = false;
342
342
  let touches = evt.changedTouches || evt.targetTouches || evt.touches;
343
343
  let target = evt.target || evt.srcElement;
344
- if(touches) {
344
+ if(touches && touches.length) {
345
345
  evt = touches[0];//兼容touch事件
346
346
  if(!evt.target) evt.target = target;
347
347
  isTouch = true;
@@ -4626,7 +4626,7 @@
4626
4626
  }
4627
4627
 
4628
4628
  option = option || {};
4629
-
4629
+ option.mode = option.mode || '2d'; // webgl | 2d
4630
4630
  option.interactive = true;
4631
4631
 
4632
4632
  super(option, 'jmGraph');
@@ -4666,8 +4666,7 @@
4666
4666
  }
4667
4667
  else {
4668
4668
  this.container = canvas.parentElement;
4669
- }
4670
-
4669
+ }
4671
4670
  this.context = canvas.getContext('2d');
4672
4671
  }
4673
4672
  this.canvas = canvas;
@@ -7968,8 +7967,7 @@
7968
7967
 
7969
7968
 
7970
7969
  longtapHandler = graph.utils.requestAnimationFrame(reqFun); //args.event.stopPropagation();
7971
-
7972
- args.event.preventDefault(); // 阻止默认行为
7970
+ //args.event.preventDefault();// 阻止默认行为
7973
7971
  } else {
7974
7972
  this.startMove(args);
7975
7973
  }
@@ -343,7 +343,7 @@ System.register([], function (exports) {
343
343
  let isTouch = false;
344
344
  let touches = evt.changedTouches || evt.targetTouches || evt.touches;
345
345
  let target = evt.target || evt.srcElement;
346
- if(touches) {
346
+ if(touches && touches.length) {
347
347
  evt = touches[0];//兼容touch事件
348
348
  if(!evt.target) evt.target = target;
349
349
  isTouch = true;
@@ -4628,7 +4628,7 @@ System.register([], function (exports) {
4628
4628
  }
4629
4629
 
4630
4630
  option = option || {};
4631
-
4631
+ option.mode = option.mode || '2d'; // webgl | 2d
4632
4632
  option.interactive = true;
4633
4633
 
4634
4634
  super(option, 'jmGraph');
@@ -4668,8 +4668,7 @@ System.register([], function (exports) {
4668
4668
  }
4669
4669
  else {
4670
4670
  this.container = canvas.parentElement;
4671
- }
4672
-
4671
+ }
4673
4672
  this.context = canvas.getContext('2d');
4674
4673
  }
4675
4674
  this.canvas = canvas;
@@ -7970,8 +7969,7 @@ System.register([], function (exports) {
7970
7969
 
7971
7970
 
7972
7971
  longtapHandler = graph.utils.requestAnimationFrame(reqFun); //args.event.stopPropagation();
7973
-
7974
- args.event.preventDefault(); // 阻止默认行为
7972
+ //args.event.preventDefault();// 阻止默认行为
7975
7973
  } else {
7976
7974
  this.startMove(args);
7977
7975
  }
package/example/bar.html CHANGED
@@ -42,16 +42,22 @@
42
42
  xField: 'x',
43
43
  baseY: 0, // Y轴基线的值 不填就会用最 小值
44
44
  // 最大和最小X值, 这里一般不用指定,除非硬是需要
45
- minXValue : 0,
46
- maxXValue : 10,
47
- minYValue: -200,
48
- maxYValue: 300,
45
+ //minXValue : 0,
46
+ //maxXValue : 10,
47
+ //minYValue: -200,
48
+ //maxYValue: 300,
49
49
  autoRefresh: true,
50
50
  style: {
51
51
  axis: {
52
52
  x: true,
53
53
  y: true
54
- }
54
+ },
55
+ markLine: {
56
+ longtap: true
57
+ },
58
+ margin: {
59
+ bottom: 2
60
+ },
55
61
  }
56
62
  });
57
63
  chart.legend.legendPosition = 'top';
@@ -73,7 +79,7 @@
73
79
  //barWidth: 80,// 优先级最高
74
80
  label: {
75
81
  show: true,
76
- offset: 5, // 离柱偏移量
82
+ offset: 10, // 离柱偏移量
77
83
  shadow: {
78
84
  x: 0,
79
85
  y: 0,
package/example/test.html CHANGED
@@ -1,41 +1,94 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html>
3
3
  <head>
4
4
  <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
- </head>
7
- <body>
6
+ <!--<script type="text/javascript" src="../src/jmchart.debug.js" id="jmgraph" ></script>-->
8
7
 
9
- <canvas id="myCanvas" width="600" height="600" style="border:1px solid #d3d3d3;">
10
- Your browser does not support the HTML5 canvas tag.
11
- </canvas>
8
+ <style>
9
+ html,body {
10
+ margin:0;
11
+ padding:10px;
12
+ width:100%;
13
+ height:100%;
14
+ }
15
+ #mycanvas canvas, #mycanvas div{
16
+ background-color:#fff;
17
+ margin:0 auto;
18
+ }
19
+ /*div.jm-tooltip {
20
+ background-color: rgba(255,255,255,0.8);
21
+ padding:4px;
22
+ border:1px solid #000;
23
+ box-shadow: 0 0 3px #000;
24
+ border-radius: 6px;
25
+ }*/
26
+ </style>
27
+ <script type="module">
28
+ //window.devicePixelRatio = 1;
29
+ import { jmChart } from '../dist/jmchart.esm.js';
12
30
 
13
- <script>
31
+ (function load() {
32
+ var w = Math.max((window.innerWidth || window.document.body.clientWidth) * 0.9, 600);
33
+ var h = Math.max((window.innerHeight || window.document.body.clientHeight) * 0.6, 200);
34
+ inichart(w,h);
35
+ })();
36
+
14
37
 
15
- var c=document.getElementById("myCanvas");
16
- var ctx=c.getContext("2d");
38
+ function inichart(w, h) {
39
+ var chart = new jmChart('mycanvas', {
40
+ width: w,
41
+ height: h,
42
+ xField: 'date',
43
+ //baseY: 0,
44
+ enableAnimate: true,
45
+ autoRefresh: true,
46
+
47
+ style: {
48
+ margin: {
49
+ left: 50
50
+ },
51
+ legend: {
52
+ legendPosition: 'top'
53
+ }
54
+ }
55
+ });
56
+ //chart.legend.legendPosition = 'top';
57
+ chart.legend.visible = true;
17
58
 
18
- ctx.beginPath();
19
- ctx.arc(150,180,100,0,2*Math.PI);
20
- ctx.stroke();
59
+ // touch改变数据点事件
60
+ chart.on('touchPointChange', function(args) {
61
+ console.log(args);
62
+ });
21
63
 
22
- let width = c.width,height=c.height;
23
-
24
- const scale = window.devicePixelRatio > 1? window.devicePixelRatio : 3;
25
- console.log(window.devicePixelRatio)
26
- if (scale) {
27
- c.style.width = width + "px";
28
- c.style.height = height + "px";
29
- c.height = height * scale;
30
- c.width = width *scale;
31
- ctx.scale(scale, scale);
32
- }
33
-
34
- ctx.beginPath();
35
- ctx.arc(150,180,100,0,2*Math.PI);
36
- ctx.stroke();
37
-
38
- </script>
39
-
40
- </body>
64
+ var line1 = chart.createSeries('line', {
65
+ field: 'nav',
66
+ //index: 2, // 指定Y轴索引,如是档指定就会共用左边的Y轴,
67
+ // 最大值和最小值,如果不指定会自动计算,
68
+ // 如果指定了也只是指定了最大或最小边界,如果有数值超过它,依然以事实数值为准
69
+ minYValue: 0.97,
70
+ maxYValue: 1.05,
71
+ style: {
72
+ // 画圆滑的曲线
73
+ curve: true,// 填充图形
74
+ label: {
75
+ show: true
76
+ },
77
+ },
78
+ });
79
+
80
+
81
+ chart.data = [ { "since_setup_rise_rate": "0", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "-", "adjusted_nav": 1, "nav": 1, "year1_rise_rate": "-", "date": "2022-06-27", "day7_rise_rate_year": "-", "accumulative_nav": 1, "per_ten_thousands_income": 0, "day1_rise_rate": "-" }, { "since_setup_rise_rate": "0.0025", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "-", "adjusted_nav": 1.0025, "nav": 1.0025, "year1_rise_rate": "-", "date": "2022-07-01", "day7_rise_rate_year": "0", "accumulative_nav": 1.0025, "per_ten_thousands_income": 0, "day1_rise_rate": "0.0025" }, { "since_setup_rise_rate": "0.0023", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "-", "adjusted_nav": 1.0023, "nav": 1.0023, "year1_rise_rate": "-", "date": "2022-07-08", "day7_rise_rate_year": "0", "accumulative_nav": 1.0023, "per_ten_thousands_income": 0, "day1_rise_rate": "-0.0002" }, { "since_setup_rise_rate": "0.0028", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "-", "adjusted_nav": 1.0028, "nav": 1.0028, "year1_rise_rate": "-", "date": "2022-07-15", "day7_rise_rate_year": "0", "accumulative_nav": 1.0028, "per_ten_thousands_income": 0, "day1_rise_rate": "0.000499" }, { "since_setup_rise_rate": "0.0057", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "-", "adjusted_nav": 1.0057, "nav": 1.0057, "year1_rise_rate": "-", "date": "2022-07-22", "day7_rise_rate_year": "0", "accumulative_nav": 1.0057, "per_ten_thousands_income": 0, "day1_rise_rate": "0.002892" }, { "since_setup_rise_rate": "0.0079", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.0079", "adjusted_nav": 1.0079, "nav": 1.0079, "year1_rise_rate": "-", "date": "2022-07-29", "day7_rise_rate_year": "0", "accumulative_nav": 1.0079, "per_ten_thousands_income": 0, "day1_rise_rate": "0.002188" }, { "since_setup_rise_rate": "0.0094", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.006883", "adjusted_nav": 1.0094, "nav": 1.0094, "year1_rise_rate": "-", "date": "2022-08-05", "day7_rise_rate_year": "0", "accumulative_nav": 1.0094, "per_ten_thousands_income": 0, "day1_rise_rate": "0.001488" }, { "since_setup_rise_rate": "0.0103", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.007982", "adjusted_nav": 1.0103, "nav": 1.0103, "year1_rise_rate": "-", "date": "2022-08-12", "day7_rise_rate_year": "0", "accumulative_nav": 1.0103, "per_ten_thousands_income": 0, "day1_rise_rate": "0.000892" }, { "since_setup_rise_rate": "0.0164", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.013562", "adjusted_nav": 1.0164, "nav": 1.0164, "year1_rise_rate": "-", "date": "2022-08-19", "day7_rise_rate_year": "0", "accumulative_nav": 1.0164, "per_ten_thousands_income": 0, "day1_rise_rate": "0.006038" }, { "since_setup_rise_rate": "0.0155", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.009744", "adjusted_nav": 1.0155, "nav": 1.0155, "year1_rise_rate": "-", "date": "2022-08-26", "day7_rise_rate_year": "0", "accumulative_nav": 1.0155, "per_ten_thousands_income": 0, "day1_rise_rate": "-0.000885" }, { "since_setup_rise_rate": "0.0168", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.00883", "adjusted_nav": 1.0168, "nav": 1.0168, "year1_rise_rate": "-", "date": "2022-09-02", "day7_rise_rate_year": "-", "accumulative_nav": 1.0168, "per_ten_thousands_income": 0, "day1_rise_rate": "0.00128" }, { "since_setup_rise_rate": "0.0193", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.009808", "adjusted_nav": 1.0193, "nav": 1.0193, "year1_rise_rate": "-", "date": "2022-09-09", "day7_rise_rate_year": "-", "accumulative_nav": 1.0193, "per_ten_thousands_income": 0, "day1_rise_rate": "0.002459" }, { "since_setup_rise_rate": "0.0256", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.015144", "adjusted_nav": 1.0256, "nav": 1.0256, "year1_rise_rate": "-", "date": "2022-09-16", "day7_rise_rate_year": "-", "accumulative_nav": 1.0256, "per_ten_thousands_income": 0, "day1_rise_rate": "0.006181" }, { "since_setup_rise_rate": "0.0287", "month6_rise_rate": "-", "month3_rise_rate": "-", "month1_rise_rate": "0.012102", "adjusted_nav": 1.0287, "nav": 1.0287, "year1_rise_rate": "-", "date": "2022-09-23", "day7_rise_rate_year": "-", "accumulative_nav": 1.0287, "per_ten_thousands_income": 0, "day1_rise_rate": "0.003023" }, { "since_setup_rise_rate": "0.0287", "month6_rise_rate": "-", "month3_rise_rate": "0.0287", "month1_rise_rate": "0.012999", "adjusted_nav": 1.0287, "nav": 1.0287, "year1_rise_rate": "-", "date": "2022-09-30", "day7_rise_rate_year": "-", "accumulative_nav": 1.0287, "per_ten_thousands_income": 0, "day1_rise_rate": "0" }, { "since_setup_rise_rate": "0.0299", "month6_rise_rate": "-", "month3_rise_rate": "0.027537", "month1_rise_rate": "0.010399", "adjusted_nav": 1.0299, "nav": 1.0299, "year1_rise_rate": "-", "date": "2022-10-14", "day7_rise_rate_year": "-", "accumulative_nav": 1.0299, "per_ten_thousands_income": 0, "day1_rise_rate": "0.001167" }, { "since_setup_rise_rate": "0.0316", "month6_rise_rate": "-", "month3_rise_rate": "0.02872", "month1_rise_rate": "0.00585", "adjusted_nav": 1.0316, "nav": 1.0316, "year1_rise_rate": "-", "date": "2022-10-21", "day7_rise_rate_year": "-", "accumulative_nav": 1.0316, "per_ten_thousands_income": 0, "day1_rise_rate": "0.001651" }, { "since_setup_rise_rate": "0.0282", "month6_rise_rate": "-", "month3_rise_rate": "0.022372", "month1_rise_rate": "-0.000486", "adjusted_nav": 1.0282, "nav": 1.0282, "year1_rise_rate": "-", "date": "2022-10-28", "day7_rise_rate_year": "-", "accumulative_nav": 1.0282, "per_ten_thousands_income": 0, "day1_rise_rate": "-0.003296" } ];
82
+
83
+ chart.refresh();
84
+
85
+
86
+ }
87
+
88
+ </script>
89
+ </head>
90
+ <body>
91
+ <div id="mycanvas">
92
+ </div>
93
+ </body>
41
94
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmchart",
3
- "version": "1.1.90",
3
+ "version": "1.1.91",
4
4
  "description": "chart",
5
5
  "main": "./index.js",
6
6
  "directories": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/jiamao/jmchart#readme",
30
30
  "dependencies": {
31
- "jmgraph": "^3.1.89"
31
+ "jmgraph": "^3.1.90"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@babel/core": "^7.10.2",
package/server.js CHANGED
@@ -1,4 +1,6 @@
1
1
  const express = require('express');
2
+
3
+ /*
2
4
  const rollup = require('rollup');
3
5
  const rollupOptions = require('./rollup.config.js');
4
6
 
@@ -23,6 +25,7 @@ esmWatcher.on('event', event => {
23
25
  startServer();
24
26
  }
25
27
  });
28
+ */
26
29
 
27
30
  // 启动server
28
31
 
@@ -77,7 +77,7 @@ export default class jmMarkLineManager {
77
77
  longtapHandler = graph.utils.requestAnimationFrame(reqFun);
78
78
 
79
79
  //args.event.stopPropagation();
80
- args.event.preventDefault();// 阻止默认行为
80
+ //args.event.preventDefault();// 阻止默认行为
81
81
  }
82
82
  else {
83
83
  this.startMove(args);
@@ -130,8 +130,9 @@ export default class jmMarkLineManager {
130
130
  moved = true;
131
131
  }
132
132
  if(moved) {
133
- args.event.stopPropagation();
133
+ args.event.stopPropagation();
134
134
  args.event.preventDefault();// 阻止默认行为
135
+
135
136
 
136
137
  if(!args.cancel) this.chart.emit('marklinemove', args);
137
138
  }