hqchart 1.1.13403 → 1.1.13409

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.13403",
3
+ "version": "1.1.13409",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -87,6 +87,17 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
87
87
  if (IFrameSplitOperator.IsNumber(option.ZIndex)) element.style["z-index"]=option.ZIndex;
88
88
  }
89
89
 
90
+ if (this.CanvasElement)
91
+ {
92
+ element.height=this.CanvasElement.height;
93
+ element.width=this.CanvasElement.width;
94
+ if (element.style)
95
+ {
96
+ element.style.width=this.CanvasElement.style.width;
97
+ element.style.height=this.CanvasElement.style.height
98
+ }
99
+ }
100
+
90
101
  divElement.appendChild(element);
91
102
 
92
103
  var item={ Element:element, Canvas:null };
@@ -423,6 +434,22 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
423
434
  }
424
435
  }
425
436
 
437
+ if (chart.ClassName=="KLineChartContainer")
438
+ {
439
+ if (!option.DragSelectRect)
440
+ {
441
+ option.DragSelectRect={ Enable:true }; //默认开启区间选中画布
442
+ }
443
+
444
+ if (option.DragSelectRect)
445
+ {
446
+ var zindex=10;
447
+ var item=option.DragSelectRect;
448
+ if (IFrameSplitOperator.IsNumber(item.ZIndex)) zindex=item.ZIndex;
449
+ if (item.Enable) this.CreateExtraCanvasElement(JSChart.RectDragCanvasKey, { ZIndex:zindex }); //创建独立的区间选择画布
450
+ }
451
+ }
452
+
426
453
  //创建子窗口
427
454
  chart.Create(option.Windows.length, option);
428
455
 
@@ -430,6 +457,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
430
457
 
431
458
  this.AdjustChartBorder(chart);
432
459
 
460
+
433
461
  if (option.KLine)
434
462
  {
435
463
  if (option.KLine.PageSize > 0) //一屏显示的数据个数
@@ -902,6 +930,22 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
902
930
  if (IFrameSplitOperator.IsBool(item.EnableMoveOn)) chart.SelectedChart.EnableMoveOn=item.EnableMoveOn;
903
931
  }
904
932
 
933
+ if (chart.ClassName=="MinuteChartContainer")
934
+ {
935
+ if (!option.DragSelectRect)
936
+ {
937
+ option.DragSelectRect={ Enable:true }; //默认开启区间选中画布
938
+ }
939
+
940
+ if (option.DragSelectRect)
941
+ {
942
+ var item=option.DragSelectRect;
943
+ var zindex=10;
944
+ if (IFrameSplitOperator.IsNumber(item.ZIndex)) zindex=item.ZIndex;
945
+ if (item.Enable) this.CreateExtraCanvasElement(JSChart.RectDragCanvasKey, { ZIndex:zindex }); //创建独立的区间选择画布
946
+ }
947
+ }
948
+
905
949
  //分页
906
950
  if (option.PageInfo) chart.SetPageInfo(option.PageInfo);
907
951
 
@@ -2155,6 +2199,7 @@ JSChart.LastVersion=null; //最新的版本号
2155
2199
  JSChart.EnableCanvasWillReadFrequently=false; //https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently
2156
2200
  JSChart.CorssCursorCanvasKey="hqchart_corsscursor";
2157
2201
  JSChart.TooltipCursorCanvasKey="hqchart_tooltip";
2202
+ JSChart.RectDragCanvasKey="hqchart_drag_rect";
2158
2203
 
2159
2204
  //初始化
2160
2205
  JSChart.Init=function(divElement,bScreen,bCacheCanvas)
@@ -2698,6 +2743,8 @@ var JSCHART_MENU_ID=
2698
2743
  CMD_ADD_OVERLAY_INDEX_ID:36, //添加叠加指标
2699
2744
 
2700
2745
  CMD_CHANGE_LANGUAGE_ID:37, //语言切换
2746
+
2747
+ CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID:38,
2701
2748
  }
2702
2749
 
2703
2750
 
@@ -2781,6 +2828,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
2781
2828
  this.EnableShowCorssCursor={ DrawPicture:true }; //DrawPicture=画图是否显示十字光标
2782
2829
  this.ChartPictureMenu; //画图工具 单个图形设置菜单
2783
2830
  this.ChartCorssCursor; //十字光标
2831
+ this.ChartDragSelectRect; //选择区间选中
2784
2832
  this.IsClickShowCorssCursor=false; //手势点击显示十字光标
2785
2833
  this.ChartSplashPaint=null; //等待提示
2786
2834
  this.LoadDataSplashTitle="数据加载中"; //下载数据提示信息
@@ -2854,16 +2902,6 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
2854
2902
  this.IsShowTooltip=true; //是否显示K线tooltip
2855
2903
  this.TooltipCache={ Type:null, IsShow:false, X:null, Y:null, Data:null, InnerHTML:null }; //缓存tooltip数据
2856
2904
 
2857
- //区间选择
2858
- this.SelectRect=document.createElement("div");
2859
- this.SelectRect.className="jschart-selectrect";
2860
- this.SelectRect.style.background=g_JSChartResource.SelectRectBGColor;
2861
- this.SelectRect.style["pointer-events"]="none";
2862
- //this.SelectRect.style.opacity=g_JSChartResource.SelectRectAlpha;
2863
- this.SelectRect.id=Guid();
2864
- this.SelectRect.oncontextmenu=function() { return false; }; //屏蔽选中区域系统右键菜单
2865
- uielement.parentNode.appendChild(this.SelectRect);
2866
-
2867
2905
  //坐标轴风格方法 double-更加数值型分割 price-更加股票价格分割
2868
2906
  this.FrameSplitData=new Map();
2869
2907
  this.FrameSplitData.set("double",new SplitData());
@@ -3421,6 +3459,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3421
3459
  }
3422
3460
 
3423
3461
  this.HideSelectRect();
3462
+ this.ClearDragSelectRect();
3424
3463
  if (this.ChartPictureMenu) this.ChartPictureMenu.Hide();
3425
3464
 
3426
3465
  var paint=this.GetRectSelectPaint();
@@ -3824,13 +3863,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3824
3863
 
3825
3864
  if (moveSetp<5 && yMoveSetp<5) return;
3826
3865
 
3827
- //this.UIElement.style.cursor="default";
3828
3866
  this.SetCursor({Cursor:"default"});
3829
- var x=drag.Click.X-uielement.getBoundingClientRect().left;
3830
- var y=drag.Click.Y-uielement.getBoundingClientRect().top;
3831
- var x2=e.clientX-uielement.getBoundingClientRect().left;
3832
- var y2=e.clientY-uielement.getBoundingClientRect().top;
3833
- this.ShowSelectRect(x,y,x2,y2);
3867
+ var ptStart=this.PointAbsoluteToRelative(drag.Click.X, drag.Click.Y);
3868
+ var ptEnd=this.PointAbsoluteToRelative(e.clientX, e.clientY);
3869
+
3870
+ this.ShowDragSelectRect(ptStart, ptEnd);
3834
3871
 
3835
3872
  drag.LastMove.X=e.clientX;
3836
3873
  drag.LastMove.Y=e.clientY;
@@ -4042,7 +4079,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
4042
4079
  selectData.JSChartContainer=this;
4043
4080
  selectData.Stock={Symbol:this.Symbol, Name:this.Name};
4044
4081
 
4045
- if (!this.BorderDrag && this.GetSelectRectData(selectData))
4082
+ if (this.ChartDragSelectRect.Enable && !this.BorderDrag && this.GetSelectRectData(selectData))
4046
4083
  {
4047
4084
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SELECT_RECT);
4048
4085
  var paint=this.GetRectSelectPaint();
@@ -4053,7 +4090,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
4053
4090
  {
4054
4091
  X:drag.LastMove.X-uielement.getBoundingClientRect().left,
4055
4092
  Y:drag.LastMove.Y-uielement.getBoundingClientRect().top,
4056
- SelectData:selectData, //区间选择的数据
4093
+ SelectData:selectData, //区间选择的数据
4057
4094
  RectSelectPaint:paint, //区间选择背景
4058
4095
  IsShowMenu:true,
4059
4096
  e,e
@@ -5132,6 +5169,15 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5132
5169
  }
5133
5170
  }
5134
5171
 
5172
+ //清空画布
5173
+ this.ClearCanvas=function(canvas)
5174
+ {
5175
+ if (!canvas) return;
5176
+ if (!this.UIElement) return;
5177
+
5178
+ canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);
5179
+ }
5180
+
5135
5181
  this.Draw=function()
5136
5182
  {
5137
5183
  if (this.ChartCorssCursor) this.ChartCorssCursor.Status=0;
@@ -6970,36 +7016,6 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6970
7016
  if (this.Tooltip.style.display!="none") this.Tooltip.style.display = "none";
6971
7017
  }
6972
7018
 
6973
- this.ShowSelectRect=function(x,y,x2,y2)
6974
- {
6975
- var left = x;
6976
- var top = y;
6977
-
6978
- var border=this.Frame.ChartBorder.GetBorder();
6979
-
6980
- var borderRight=border.Right;
6981
- var borderLeft=border.Left;
6982
-
6983
- if (x>borderRight) x=borderRight;
6984
- if (x2>borderRight) x2=borderRight;
6985
-
6986
- if (x<borderLeft) x=borderLeft;
6987
- if (x2<borderLeft) x2=borderLeft;
6988
-
6989
- if (x>x2) left=x2;
6990
- if (y>y2) top=y2;
6991
-
6992
- var width=Math.abs(x-x2);
6993
- var height=Math.abs(y-y2);
6994
-
6995
- this.SelectRect.style.width = width+"px";
6996
- this.SelectRect.style.height =height+"px";
6997
- this.SelectRect.style.position = "absolute";
6998
- this.SelectRect.style.left = left +"px";
6999
- this.SelectRect.style.top = top +"px";
7000
- this.SelectRect.style.display = "block";
7001
- }
7002
-
7003
7019
  this.UpdateSelectRect=function(start,end)
7004
7020
  {
7005
7021
  if (!this.ChartPaint[0].Data) return;
@@ -7019,7 +7035,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7019
7035
 
7020
7036
  this.HideSelectRect=function()
7021
7037
  {
7022
- this.SelectRect.style.display = "none";
7038
+ this.ClearDragSelectRect();
7023
7039
  }
7024
7040
 
7025
7041
  this.ResetFrameXYSplit=function()
@@ -7814,11 +7830,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7814
7830
 
7815
7831
  this.ReloadExtendChartPaintResource=function(resource) //扩展画法重新加载配置
7816
7832
  {
7817
- for(var i in this.ExtendChartPaint)
7833
+ for(var i=0;i<this.ExtendChartPaint.length; ++i)
7818
7834
  {
7819
7835
  var item=this.ExtendChartPaint[i];
7820
7836
  if (item.ReloadResource) item.ReloadResource(resource);
7821
7837
  }
7838
+
7839
+ if (this.ChartDragSelectRect && this.ChartDragSelectRect.ReloadResource) this.ChartDragSelectRect.ReloadResource(resource);
7822
7840
  }
7823
7841
 
7824
7842
  this.ReloadChartDrawPictureResource=function(resource)
@@ -8519,14 +8537,19 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8519
8537
  //区间选择
8520
8538
  this.GetRectSelectPaint=function()
8521
8539
  {
8522
- for(var i=0;i<this.ExtendChartPaint.length;++i)
8523
- {
8524
- var item=this.ExtendChartPaint[i];
8525
- if (item.ClassName=="RectSelectPaint")
8526
- return item;
8527
- }
8540
+ var finder=this.GetExtendChartByClassName("RectSelectPaint");
8541
+ if (!finder) return null;
8528
8542
 
8529
- return null;
8543
+ return finder.Chart;
8544
+ }
8545
+
8546
+ //鼠标拖动区域
8547
+ this.GetRectDragPaint=function()
8548
+ {
8549
+ var finder=this.GetExtendChartByClassName("RectDragPaint");
8550
+ if (!finder) return null;
8551
+
8552
+ return finder.Chart;
8530
8553
  }
8531
8554
 
8532
8555
  this.SetRectSelectData=function(kItem, index)
@@ -9492,6 +9515,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9492
9515
  case JSCHART_MENU_ID.CMD_CHANGE_LANGUAGE_ID:
9493
9516
  if (srcParam) this.SetLanguage(srcParam);
9494
9517
  break;
9518
+
9519
+ case JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID:
9520
+ if (param!=null)
9521
+ {
9522
+ if (this.ChartDragSelectRect) this.ChartDragSelectRect.ShowMode=param;
9523
+ }
9524
+ break;
9495
9525
  }
9496
9526
  }
9497
9527
 
@@ -9635,6 +9665,37 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9635
9665
  {
9636
9666
  this.CurrentChartDrawPicture=null;
9637
9667
  }
9668
+
9669
+
9670
+ this.CreateDragSelectRect=function(option)
9671
+ {
9672
+ var chart=g_ExtendChartPaintFactory.Create("RectDragPaint",option);
9673
+ if (!chart) return null;
9674
+
9675
+ if (option && option.Enable===true) chart.Enable=true;
9676
+ chart.ChartBorder=this.Frame.ChartBorder;
9677
+ chart.ChartFrame=this.Frame;
9678
+ chart.HQChart=this;
9679
+ chart.SetOption(option);
9680
+
9681
+ this.ChartDragSelectRect=chart;
9682
+ }
9683
+
9684
+ this.ClearDragSelectRect=function()
9685
+ {
9686
+ if (!this.ChartDragSelectRect) return;
9687
+
9688
+ this.ChartDragSelectRect.ClearPoint();
9689
+ }
9690
+
9691
+ this.ShowDragSelectRect=function(ptStart, ptEnd)
9692
+ {
9693
+ if (!this.ChartDragSelectRect) return;
9694
+
9695
+ this.ChartDragSelectRect.SetFirstPoint(ptStart.X, ptStart.Y);
9696
+ this.ChartDragSelectRect.SetSecondPoint(ptEnd.X, ptEnd.Y);
9697
+ this.ChartDragSelectRect.Draw();
9698
+ }
9638
9699
  }
9639
9700
 
9640
9701
  function GetDevicePixelRatio()
@@ -19691,6 +19752,8 @@ function HistoryData()
19691
19752
  this.BFactor; //前复权
19692
19753
  this.AFactor; //后复权
19693
19754
 
19755
+ this.RightSeed; //本地计算的复权系数
19756
+
19694
19757
  /*
19695
19758
  {
19696
19759
  PriceOffset: 每个单元的价格间距,
@@ -20696,7 +20759,10 @@ function ChartData()
20696
20759
  for(--index; index>=0; --index)
20697
20760
  {
20698
20761
  if (yClose!=this.Data[index].Close) break;
20699
- result[index]=HistoryData.Copy(this.Data[index]);
20762
+ var newItem=HistoryData.Copy(this.Data[index]);
20763
+ newItem.RightSeed=seed;
20764
+ result[index]=newItem;
20765
+
20700
20766
  yClose=this.Data[index].YClose;
20701
20767
  }
20702
20768
 
@@ -20706,7 +20772,9 @@ function ChartData()
20706
20772
  if(yClose!=value && value!=0)
20707
20773
  seed *= yClose/value;
20708
20774
 
20709
- result[index]=HistoryData.CopyRight(this.Data[index],seed);
20775
+ var newItem=HistoryData.CopyRight(this.Data[index],seed);
20776
+ newItem.RightSeed=seed;
20777
+ result[index]=newItem
20710
20778
 
20711
20779
  yClose=this.Data[index].YClose;
20712
20780
  }
@@ -20721,7 +20789,9 @@ function ChartData()
20721
20789
  for(++index;index<this.Data.length;++index)
20722
20790
  {
20723
20791
  if (close!=this.Data[index].YClose) break;
20724
- result[index]=HistoryData.Copy(this.Data[index]);
20792
+ var newItem=HistoryData.Copy(this.Data[index]);
20793
+ newItem.RightSeed=seed;
20794
+ result[index]=newItem;
20725
20795
  close=this.Data[index].Close;
20726
20796
  }
20727
20797
 
@@ -20730,7 +20800,9 @@ function ChartData()
20730
20800
  if(close!=this.Data[index].YClose)
20731
20801
  seed *= close/this.Data[index].YClose;
20732
20802
 
20733
- result[index]=HistoryData.CopyRight(this.Data[index],seed);
20803
+ var newItem=HistoryData.CopyRight(this.Data[index],seed);
20804
+ newItem.RightSeed=seed;
20805
+ result[index]=newItem;
20734
20806
 
20735
20807
  close=this.Data[index].Close;
20736
20808
  }
@@ -40321,6 +40393,7 @@ function ExtendChartPaintFactory()
40321
40393
  [
40322
40394
  ["FrameSplitPaint", { Create:function() { return new FrameSplitPaint(); } }],
40323
40395
  ["RectSelectPaint", { Create:function() { return new RectSelectPaint(); } }],
40396
+ ["RectDragPaint", { Create:function() { return new RectDragPaint(); } }],
40324
40397
  ["DragMovePaint", { Create:function() { return new DragMovePaint(); } }],
40325
40398
  ["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}],
40326
40399
  ["FrameButtomToolbarPaint", {Create:function() { return new FrameButtomToolbarPaint(); }}]
@@ -43307,6 +43380,189 @@ function RectSelectPaint()
43307
43380
  }
43308
43381
  }
43309
43382
  }
43383
+
43384
+ //鼠标拖动选中区域
43385
+ function RectDragPaint()
43386
+ {
43387
+ this.newMethod=IExtendChartPainting; //派生
43388
+ this.newMethod();
43389
+ delete this.newMethod;
43390
+
43391
+ this.ClassName='RectDragPaint';
43392
+ this.LineColor=g_JSChartResource.RectDrag.LineColor; //竖线
43393
+ this.LineWidth=g_JSChartResource.RectDrag.LineWidth;
43394
+ this.BGColor=g_JSChartResource.RectDrag.BGColor;
43395
+ this.ShowMode=0; //0=只画边框 1=遮挡未选中区域 2=整体全选
43396
+ this.Enable=false;
43397
+
43398
+ this.FirstPoint;
43399
+ this.SecondPoint;
43400
+
43401
+ this.IsClearCanvas=true; //画布是否是清空状态
43402
+
43403
+ //设置参数接口
43404
+ this.SetOption=function(option)
43405
+ {
43406
+ if (option)
43407
+ {
43408
+ if (option.LineColor) this.LineColor=option.LineColor;
43409
+ if (option.BGColor) this.BGColor=option.BGColor;
43410
+ if (IFrameSplitOperator.IsNumber(option.ShowMode)) this.ShowMode=option.ShowMode;
43411
+ }
43412
+ }
43413
+
43414
+ this.ReloadResource=function(resource)
43415
+ {
43416
+ this.LineColor=g_JSChartResource.RectDrag.LineColor; //竖线
43417
+ this.LineWidth=g_JSChartResource.RectDrag.LineWidth;
43418
+ this.BGColor=g_JSChartResource.RectDrag.BGColor; //面积
43419
+ }
43420
+
43421
+ this.ClearPoint=function()
43422
+ {
43423
+ this.FirstPoint=null;
43424
+ this.SecondPoint=null;
43425
+
43426
+ if (!this.IsClearCanvas) this.Draw();
43427
+ }
43428
+
43429
+ this.SetFirstPoint=function(x, y)
43430
+ {
43431
+ this.FirstPoint={ X:x, Y:y };
43432
+ }
43433
+
43434
+ this.SetSecondPoint=function(x, y)
43435
+ {
43436
+ this.SecondPoint={ X:x, Y:y };
43437
+ }
43438
+
43439
+ this.DrawSelectedBorderMode=function(rtSelect)
43440
+ {
43441
+ this.Canvas.strokeStyle=this.LineColor;
43442
+ this.Canvas.strokeRect(ToFixedPoint(rtSelect.Left),ToFixedPoint(rtSelect.Top),ToFixedRect(rtSelect.Width),ToFixedRect(rtSelect.Height));
43443
+ }
43444
+
43445
+ this.DrawUnselectedMaskMode=function(rtSelect, rtClient)
43446
+ {
43447
+ if (this.BGColor)
43448
+ {
43449
+ this.Canvas.save();
43450
+
43451
+ var clipPath=new Path2D();
43452
+ clipPath.rect(rtClient.Left, rtClient.Top, rtClient.Width, rtSelect.Top-rtClient.Top);
43453
+
43454
+ var leftPath=new Path2D();
43455
+ leftPath.rect(rtClient.Left,rtSelect.Top, rtSelect.Left-rtClient.Left, rtSelect.Height);
43456
+ clipPath.addPath(leftPath);
43457
+
43458
+ var rightPath=new Path2D();
43459
+ rightPath.rect(rtSelect.Right,rtSelect.Top, rtClient.Right-rtSelect.Right, rtSelect.Height);
43460
+ clipPath.addPath(rightPath);
43461
+
43462
+ var bottmPath=new Path2D();
43463
+ bottmPath.rect(rtClient.Left,rtSelect.Bottom, rtClient.Width, rtClient.Bottom-rtSelect.Bottom);
43464
+ clipPath.addPath(bottmPath);
43465
+
43466
+ this.Canvas.clip(clipPath);
43467
+
43468
+ this.Canvas.fillStyle=this.BGColor;
43469
+ this.Canvas.fillRect(rtClient.Left,rtClient.Top,rtClient.Width,rtClient.Height);
43470
+
43471
+ this.Canvas.restore();
43472
+ }
43473
+
43474
+ this.Canvas.strokeStyle=this.LineColor;
43475
+ this.Canvas.strokeRect(ToFixedPoint(rtSelect.Left),ToFixedPoint(rtSelect.Top),ToFixedRect(rtSelect.Width),ToFixedRect(rtSelect.Height));
43476
+ }
43477
+
43478
+ this.DrawFullselectedMode=function(rtSelect, rtClient)
43479
+ {
43480
+ if (this.BGColor)
43481
+ {
43482
+ this.Canvas.save();
43483
+
43484
+ var clipPath=new Path2D();
43485
+ clipPath.rect(rtClient.Left, rtClient.Top, rtSelect.Left-rtClient.Left, rtClient.Height);
43486
+
43487
+ var rightPath=new Path2D();
43488
+ rightPath.rect(rtSelect.Right,rtClient.Top, rtClient.Right-rtSelect.Right, rtClient.Height);
43489
+ clipPath.addPath(rightPath);
43490
+
43491
+ this.Canvas.clip(clipPath);
43492
+
43493
+ this.Canvas.fillStyle=this.BGColor;
43494
+ this.Canvas.fillRect(rtClient.Left,rtClient.Top,rtClient.Width,rtClient.Height);
43495
+
43496
+ this.Canvas.restore();
43497
+ }
43498
+
43499
+ this.Canvas.strokeStyle=this.LineColor;
43500
+ this.Canvas.strokeRect(ToFixedPoint(rtSelect.Left),ToFixedPoint(rtClient.Top),ToFixedRect(rtSelect.Width),ToFixedRect(rtClient.Height));
43501
+ }
43502
+
43503
+ this.Draw=function()
43504
+ {
43505
+ if (!this.Enable) return;
43506
+ if (!this.HQChart) return;
43507
+
43508
+ var finder=this.HQChart.GetExtraCanvas(JSChart.RectDragCanvasKey);
43509
+ if (!finder) return;
43510
+
43511
+ this.Canvas=finder.Canvas;
43512
+ this.HQChart.ClearCanvas(this.Canvas);
43513
+ this.IsClearCanvas=true;
43514
+
43515
+ if (!this.FirstPoint && !this.SecondPoint) return;
43516
+
43517
+ var top=this.ChartBorder.GetTop();
43518
+ var bottom=this.ChartBorder.GetBottom();
43519
+ var left=this.ChartBorder.GetLeft();
43520
+ var right=this.ChartBorder.GetRight();
43521
+
43522
+ var rtClient={Left:left, Top:top, Right:right, Bottom:bottom };
43523
+ rtClient.Width=rtClient.Right-rtClient.Left;
43524
+ rtClient.Height=rtClient.Bottom-rtClient.Top;
43525
+
43526
+ var rtSelect=
43527
+ {
43528
+ Left:Math.min(this.FirstPoint.X,this.SecondPoint.X),
43529
+ Right:Math.max(this.FirstPoint.X,this.SecondPoint.X),
43530
+ Top:Math.min(this.FirstPoint.Y,this.SecondPoint.Y),
43531
+ Bottom:Math.max(this.FirstPoint.Y,this.SecondPoint.Y)
43532
+ }
43533
+
43534
+ if (rtSelect.Top<top) rtSelect.Top=top;
43535
+ else if (rtSelect.Top>bottom) rtSelect.Top=bottom;
43536
+ if (rtSelect.Bottom<top) rtSelect.Bottom=top;
43537
+ else if (rtSelect.Bottom>bottom) rtSelect.Bottom=bottom;
43538
+
43539
+ if (rtSelect.Left<left) rtSelect.Left=left;
43540
+ else if (rtSelect.Left>right) rtSelect.Left=right;
43541
+ if (rtSelect.Right<left) rtSelect.Right=left;
43542
+ else if (rtSelect.Right>right) rtSelect.Right=right;
43543
+
43544
+ rtSelect.Width=rtSelect.Right-rtSelect.Left;
43545
+ rtSelect.Height=rtSelect.Bottom-rtSelect.Top;
43546
+
43547
+ switch(this.ShowMode)
43548
+ {
43549
+ case 1:
43550
+ this.DrawUnselectedMaskMode(rtSelect,rtClient);
43551
+ break;
43552
+ case 2:
43553
+ this.DrawFullselectedMode(rtSelect,rtClient);
43554
+ break;
43555
+ default:
43556
+ this.DrawSelectedBorderMode(rtSelect);
43557
+ break;
43558
+ }
43559
+
43560
+
43561
+
43562
+ this.IsClearCanvas=false;
43563
+ }
43564
+ }
43565
+
43310
43566
  //深度图 支持横屏
43311
43567
  /*
43312
43568
  数据格式:
@@ -57409,8 +57665,8 @@ function ChartDrawHLine()
57409
57665
  var bottom=this.Frame.ChartBorder.GetBottomEx();
57410
57666
  var pixelTatio = GetDevicePixelRatio();
57411
57667
 
57412
- if (IFrameSplitOperator.IsNumber(labInfo.TopOffset)) top-=labInfo.TopOffset;
57413
- if (IFrameSplitOperator.IsNumber(labInfo.BottomOffset)) bottom+=labInfo.BottomOffset;
57668
+ if (labInfo && IFrameSplitOperator.IsNumber(labInfo.TopOffset)) top-=labInfo.TopOffset;
57669
+ if (labInfo && IFrameSplitOperator.IsNumber(labInfo.BottomOffset)) bottom+=labInfo.BottomOffset;
57414
57670
 
57415
57671
  var yValue=this.Frame.GetYData(y,false);
57416
57672
  var strValue=yValue.toFixed(this.Precision);
@@ -66487,6 +66743,7 @@ function JSChartResource()
66487
66743
  RangeTextSubBGColor:'rgb(54,54,54)',
66488
66744
  }
66489
66745
 
66746
+ //选中图形
66490
66747
  this.SelectedChart=
66491
66748
  {
66492
66749
  LineWidth:1,
@@ -66496,6 +66753,14 @@ function JSChartResource()
66496
66753
  BGColor:"rgb(255,255,255)"
66497
66754
  }
66498
66755
 
66756
+ //鼠标区间选中
66757
+ this.RectDrag=
66758
+ {
66759
+ LineColor:"rgb(0,0,0)", //竖线
66760
+ LineWidth:1*GetDevicePixelRatio(),
66761
+ BGColor:"rgba(128,128,128,0.2)", //面积
66762
+ }
66763
+
66499
66764
  this.DragMovePaint=
66500
66765
  {
66501
66766
  TextColor:"rgb(0,0,0)",
@@ -67229,6 +67494,16 @@ function JSChartResource()
67229
67494
  if (item.RangeTextSubBGColor) this.RectSelect.RangeTextSubBGColor=item.RangeTextSubBGColor;
67230
67495
  }
67231
67496
 
67497
+ if (style.RectDrag)
67498
+ {
67499
+ var item=style.RectDrag;
67500
+ var dest=this.RectDrag;
67501
+
67502
+ if (item.LineColor) dest.LineColor=item.LineColor;
67503
+ if (IFrameSplitOperator.IsPlusNumber(item.LineWidth)) dest.LineWidth=item.LineWidth;
67504
+ if (item.BGColor) dest.BGColor=item.BGColor;
67505
+ }
67506
+
67232
67507
  if (style.OrderFlow)
67233
67508
  {
67234
67509
  item=style.OrderFlow;
@@ -69624,6 +69899,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
69624
69899
  this.CreateMainKLine();
69625
69900
  this.CreateExtendChart("RectSelectPaint", option? option.SelectRect:null); //区间统计
69626
69901
  if (this.EnableIndexChartDrag) this.CreateExtendChart("DragMovePaint");
69902
+ this.CreateDragSelectRect(option? option.DragSelectRect:null);
69627
69903
 
69628
69904
  //子窗口动态标题
69629
69905
  for(var i in this.Frame.SubFrame)
@@ -69664,6 +69940,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
69664
69940
  if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
69665
69941
  }
69666
69942
 
69943
+
69944
+
69667
69945
  this.OnCustomKeyDown=function(keyID, e) //自定义键盘事件
69668
69946
  {
69669
69947
  if (keyID==37 && e.ctrlKey) //Ctrl+Left
@@ -74436,7 +74714,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
74436
74714
 
74437
74715
  { Name:"禁止拖拽", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_MODE_ID, Args:[0]}, Checked:0==this.DragMode },
74438
74716
  { Name:"启动拖拽", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_MODE_ID, Args:[1]}, Checked:1==this.DragMode },
74439
- { Name:"区间选择", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_MODE_ID, Args:[2]}, Checked:2==this.DragMode },
74717
+ { Name:"左键区间选择", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_MODE_ID, Args:[2]}, Checked:2==this.DragMode },
74440
74718
  { Name:JSPopMenu.SEPARATOR_LINE_NAME },
74441
74719
 
74442
74720
  { Name:"背景分割", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_BG_SPLIT_ID, Args:[!bBGSpit]}, Checked:bBGSpit},
@@ -74462,6 +74740,15 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
74462
74740
  { Name:"繁体", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_LANGUAGE_ID, Args:["TC"]}, Checked:this.LanguageID==JSCHART_LANGUAGE_ID.LANGUAGE_TRADITIONAL_CHINESE_ID },
74463
74741
  ]
74464
74742
  },
74743
+ {
74744
+ Name:"区间选择样式",
74745
+ SubMenu:
74746
+ [
74747
+ { Name:"样式1(默认)", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID, Args:[0]}, Checked:0==this.ChartDragSelectRect.ShowMode },
74748
+ { Name:"样式2", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID, Args:[1]}, Checked:1==this.ChartDragSelectRect.ShowMode },
74749
+ { Name:"样式3", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID, Args:[2]}, Checked:2==this.ChartDragSelectRect.ShowMode },
74750
+ ]
74751
+ }
74465
74752
  ]
74466
74753
  }
74467
74754
  ];
@@ -76831,11 +77118,10 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
76831
77118
 
76832
77119
  //this.UIElement.style.cursor="default";
76833
77120
  this.SetCursor({Cursor:"default"});
76834
- var x=drag.Click.X-uielement.getBoundingClientRect().left;
76835
- var y=drag.Click.Y-uielement.getBoundingClientRect().top;
76836
- var x2=e.clientX-uielement.getBoundingClientRect().left;
76837
- var y2=e.clientY-uielement.getBoundingClientRect().top;
76838
- this.ShowSelectRect(x,y,x2,y2);
77121
+ var ptStart=this.PointAbsoluteToRelative(drag.Click.X, drag.Click.Y);
77122
+ var ptEnd=this.PointAbsoluteToRelative(e.clientX, e.clientY);
77123
+
77124
+ this.ShowDragSelectRect(ptStart, ptEnd);
76839
77125
 
76840
77126
  drag.LastMove.X=e.clientX;
76841
77127
  drag.LastMove.Y=e.clientY;
@@ -78006,6 +78292,16 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78006
78292
  SubMenu:
78007
78293
  [
78008
78294
  { Name:"画图工具", Data:{ ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID, Args:[]}, Checked:this.IsShowDrawToolDialog()},
78295
+
78296
+ {
78297
+ Name:"区间选择样式",
78298
+ SubMenu:
78299
+ [
78300
+ { Name:"样式1(默认)", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID, Args:[0]}, Checked:0==this.ChartDragSelectRect.ShowMode },
78301
+ { Name:"样式2", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID, Args:[1]}, Checked:1==this.ChartDragSelectRect.ShowMode },
78302
+ { Name:"样式3", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID, Args:[2]}, Checked:2==this.ChartDragSelectRect.ShowMode },
78303
+ ]
78304
+ }
78009
78305
  ]
78010
78306
  }
78011
78307
 
@@ -78196,6 +78492,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78196
78492
  this.CreateMainKLine();
78197
78493
  this.CreateExtendChart("RectSelectPaint", option? option.SelectRect:null); //区间统计
78198
78494
  if (this.EnableIndexChartDrag) this.CreateExtendChart("DragMovePaint");
78495
+ this.CreateDragSelectRect(option? option.DragSelectRect:null);
78199
78496
 
78200
78497
  //子窗口动态标题
78201
78498
  for(var i=0;i<this.Frame.SubFrame.length; ++i)