hqchart 1.1.13520 → 1.1.13531

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.13520",
3
+ "version": "1.1.13531",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -27,6 +27,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
27
27
  this.DivElement=divElement;
28
28
  this.DivToolElement=null; //工具条
29
29
  this.JSChartContainer; //画图控件
30
+ this.ResizeListener;
30
31
 
31
32
  //h5 canvas
32
33
  this.CanvasElement=document.createElement("canvas");
@@ -1704,6 +1705,8 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
1704
1705
  this.JSChartContainer=chart;
1705
1706
  chart.DivElement=this.DivElement;
1706
1707
 
1708
+ if (option.EnableResize==true) this.CreateResizeListener();
1709
+
1707
1710
  if (option.DefaultCursor) chart.DefaultCursor=option.DefaultCursor;
1708
1711
  if (option.OnCreatedCallback) option.OnCreatedCallback(chart);
1709
1712
 
@@ -1746,6 +1749,19 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
1746
1749
  }
1747
1750
  }
1748
1751
 
1752
+ this.CreateResizeListener=function()
1753
+ {
1754
+ this.ResizeListener = new ResizeObserver((entries)=>{ this.OnDivResize(entries); });
1755
+ this.ResizeListener.observe(this.DivElement);
1756
+ }
1757
+
1758
+ this.OnDivResize=function(entries)
1759
+ {
1760
+ JSConsole.Chart.Log("[JSChart::OnDivResize] entries=", entries);
1761
+
1762
+ this.OnSize( {Type:1} );
1763
+ }
1764
+
1749
1765
  //创建工具条
1750
1766
  this.CreateToolbar=function(option)
1751
1767
  {
@@ -37981,6 +37997,7 @@ function ChartMultiText()
37981
37997
  {
37982
37998
  var border=this.ChartBorder.GetHScreenBorder();
37983
37999
  var chartright=border.BottomEx;
38000
+ var chartleft=border.TopEx;
37984
38001
  var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
37985
38002
  var left=this.ChartBorder.GetTop();
37986
38003
  var right=this.ChartBorder.GetBottom();
@@ -37992,6 +38009,7 @@ function ChartMultiText()
37992
38009
  var border=this.ChartBorder.GetBorder();
37993
38010
  var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
37994
38011
  var chartright=border.RightEx;
38012
+ var chartleft=border.LeftEx;
37995
38013
  var left=this.ChartBorder.GetLeft();
37996
38014
  var right=this.ChartBorder.GetRight();
37997
38015
  var top=border.TopEx;
@@ -38027,16 +38045,17 @@ function ChartMultiText()
38027
38045
 
38028
38046
  var textWidth=this.Canvas.measureText(item.Text).width;
38029
38047
  this.Canvas.textAlign='center';
38030
- if (x+textWidth/2>=right)
38048
+ if (x+textWidth/2>=chartright)
38031
38049
  {
38032
38050
  this.Canvas.textAlign='right';
38033
- x=right;
38051
+ x=chartright;
38034
38052
  }
38035
- else if (x-textWidth/2<left)
38053
+ else if (x-textWidth/2<chartleft)
38036
38054
  {
38037
38055
  this.Canvas.textAlign = 'left';
38038
- x=left;
38056
+ x=chartleft;
38039
38057
  }
38058
+
38040
38059
  if (item.Baseline==1) this.Canvas.textBaseline='top';
38041
38060
  else if (item.Baseline==2) this.Canvas.textBaseline='bottom';
38042
38061
  else this.Canvas.textBaseline = 'middle';