hqchart 1.1.13403 → 1.1.13436

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.
@@ -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)
@@ -2534,7 +2579,7 @@ var JSCHART_EVENT_ID=
2534
2579
 
2535
2580
 
2536
2581
  ON_CHANGE_INDEX:150, //切换指标
2537
- ON_MENU_COMMAND:151, //菜单时间回调
2582
+ ON_MENU_COMMAND:151, //菜单事件回调
2538
2583
  ON_CREATE_RIGHT_MENU:152, //创建右键菜单
2539
2584
 
2540
2585
  ON_FORMAT_CALL_AUCTION_INDEX_TITLE:153, //集合竞价指标窗口标题内容
@@ -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: 每个单元的价格间距,
@@ -20692,11 +20755,15 @@ function ChartData()
20692
20755
  var yClose=this.Data[index].YClose;
20693
20756
 
20694
20757
  result[index]=HistoryData.Copy(this.Data[index]);
20758
+ result[index].RightSeed=seed;
20695
20759
 
20696
20760
  for(--index; index>=0; --index)
20697
20761
  {
20698
20762
  if (yClose!=this.Data[index].Close) break;
20699
- result[index]=HistoryData.Copy(this.Data[index]);
20763
+ var newItem=HistoryData.Copy(this.Data[index]);
20764
+ newItem.RightSeed=seed;
20765
+ result[index]=newItem;
20766
+
20700
20767
  yClose=this.Data[index].YClose;
20701
20768
  }
20702
20769
 
@@ -20706,7 +20773,9 @@ function ChartData()
20706
20773
  if(yClose!=value && value!=0)
20707
20774
  seed *= yClose/value;
20708
20775
 
20709
- result[index]=HistoryData.CopyRight(this.Data[index],seed);
20776
+ var newItem=HistoryData.CopyRight(this.Data[index],seed);
20777
+ newItem.RightSeed=seed;
20778
+ result[index]=newItem
20710
20779
 
20711
20780
  yClose=this.Data[index].YClose;
20712
20781
  }
@@ -20717,11 +20786,14 @@ function ChartData()
20717
20786
  var seed=1;
20718
20787
  var close=this.Data[index].Close;
20719
20788
  result[index]=HistoryData.Copy(this.Data[index]);
20789
+ result[index].RightSeed=seed;
20720
20790
 
20721
20791
  for(++index;index<this.Data.length;++index)
20722
20792
  {
20723
20793
  if (close!=this.Data[index].YClose) break;
20724
- result[index]=HistoryData.Copy(this.Data[index]);
20794
+ var newItem=HistoryData.Copy(this.Data[index]);
20795
+ newItem.RightSeed=seed;
20796
+ result[index]=newItem;
20725
20797
  close=this.Data[index].Close;
20726
20798
  }
20727
20799
 
@@ -20730,7 +20802,9 @@ function ChartData()
20730
20802
  if(close!=this.Data[index].YClose)
20731
20803
  seed *= close/this.Data[index].YClose;
20732
20804
 
20733
- result[index]=HistoryData.CopyRight(this.Data[index],seed);
20805
+ var newItem=HistoryData.CopyRight(this.Data[index],seed);
20806
+ newItem.RightSeed=seed;
20807
+ result[index]=newItem;
20734
20808
 
20735
20809
  close=this.Data[index].Close;
20736
20810
  }
@@ -31042,6 +31116,86 @@ function ChartOverlayLine()
31042
31116
  }
31043
31117
  }
31044
31118
 
31119
+ //独立线段
31120
+ function ChartSingleLine()
31121
+ {
31122
+ this.newMethod=ChartLine; //派生
31123
+ this.newMethod();
31124
+ delete this.newMethod;
31125
+
31126
+ this.ClassName='ChartSingleLine'; //类名
31127
+ this.MaxMin=null; //当前的显示范围
31128
+
31129
+ this.Draw=function()
31130
+ {
31131
+ this.MaxMin=null;
31132
+ if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
31133
+ if (this.IsShowIndexTitleOnly()) return;
31134
+ if (this.IsHideScriptIndex()) return;
31135
+
31136
+ if (!this.Data || !this.Data.Data) return;
31137
+
31138
+ this.MaxMin=this.GetCurrentMaxMin();
31139
+ if (!this.MaxMin) return;
31140
+ if (!IFrameSplitOperator.IsNumber(this.MaxMin.Max) || !IFrameSplitOperator.IsNumber(this.MaxMin.Min)) return;
31141
+
31142
+ switch(this.DrawType)
31143
+ {
31144
+
31145
+ default:
31146
+ return this.DrawStraightLine();
31147
+ }
31148
+ }
31149
+
31150
+ //获取当前页的最大最小值
31151
+ this.GetCurrentMaxMin=function()
31152
+ {
31153
+ var xPointCount=this.ChartFrame.XPointCount;
31154
+ var range={ Max:null, Min:null };
31155
+
31156
+ for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
31157
+ {
31158
+ var value=this.Data.Data[i];
31159
+ if (!IFrameSplitOperator.IsNumber(value)) continue;
31160
+
31161
+ if (range.Max==null) range.Max=value;
31162
+ if (range.Min==null) range.Min=value;
31163
+
31164
+ if (range.Max<value) range.Max=value;
31165
+ if (range.Min>value) range.Min=value;
31166
+ }
31167
+
31168
+ return range;
31169
+ }
31170
+
31171
+ this.GetMaxMin=function()
31172
+ {
31173
+ return { Max:null, Min:null };
31174
+ }
31175
+
31176
+ this.GetYFromData=function(value)
31177
+ {
31178
+ var bHScreen = (this.ChartFrame.IsHScreen === true);
31179
+
31180
+ if (bHScreen)
31181
+ {
31182
+ if (value <= this.MaxMin.Min) return this.ChartBorder.GetLeftEx();
31183
+ if (value >= this.MaxMin.Max) return this.ChartBorder.GetRightEx();
31184
+
31185
+ var width = this.ChartBorder.GetWidthEx() * (value - this.MaxMin.Min) / (this.MaxMin.Max - this.MaxMin.Min);
31186
+ return this.ChartBorder.GetLeftEx() + width;
31187
+ }
31188
+ else
31189
+ {
31190
+ if(value<=this.MaxMin.Min) return this.ChartBorder.GetBottomEx();
31191
+ if(value>=this.MaxMin.Max) return this.ChartBorder.GetTopEx();
31192
+
31193
+ var height=this.ChartBorder.GetHeightEx()*(value-this.MaxMin.Min)/(this.MaxMin.Max-this.MaxMin.Min);
31194
+ return this.ChartBorder.GetBottomEx()-height;
31195
+ }
31196
+ }
31197
+ }
31198
+
31045
31199
  //彩色线段
31046
31200
  function ChartPartLine()
31047
31201
  {
@@ -33962,8 +34116,8 @@ function ChartMinutePriceLine()
33962
34116
  if (isHScreen===true) chartright=this.ChartBorder.GetBottom();
33963
34117
  var xPointCount=this.ChartFrame.XPointCount;
33964
34118
  var minuteCount=this.ChartFrame.MinuteCount;
33965
- var bottom=this.ChartBorder.GetBottomEx();
33966
- var left=this.ChartBorder.GetLeftEx();
34119
+ var bottom=this.ChartBorder.GetBottom();
34120
+ var left=this.ChartBorder.GetLeft();
33967
34121
  var data=this.Data;
33968
34122
 
33969
34123
  this.DrawBeforeOpen(); //盘前
@@ -40321,6 +40475,7 @@ function ExtendChartPaintFactory()
40321
40475
  [
40322
40476
  ["FrameSplitPaint", { Create:function() { return new FrameSplitPaint(); } }],
40323
40477
  ["RectSelectPaint", { Create:function() { return new RectSelectPaint(); } }],
40478
+ ["RectDragPaint", { Create:function() { return new RectDragPaint(); } }],
40324
40479
  ["DragMovePaint", { Create:function() { return new DragMovePaint(); } }],
40325
40480
  ["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}],
40326
40481
  ["FrameButtomToolbarPaint", {Create:function() { return new FrameButtomToolbarPaint(); }}]
@@ -43307,6 +43462,189 @@ function RectSelectPaint()
43307
43462
  }
43308
43463
  }
43309
43464
  }
43465
+
43466
+ //鼠标拖动选中区域
43467
+ function RectDragPaint()
43468
+ {
43469
+ this.newMethod=IExtendChartPainting; //派生
43470
+ this.newMethod();
43471
+ delete this.newMethod;
43472
+
43473
+ this.ClassName='RectDragPaint';
43474
+ this.LineColor=g_JSChartResource.RectDrag.LineColor; //竖线
43475
+ this.LineWidth=g_JSChartResource.RectDrag.LineWidth;
43476
+ this.BGColor=g_JSChartResource.RectDrag.BGColor;
43477
+ this.ShowMode=0; //0=只画边框 1=遮挡未选中区域 2=整体全选
43478
+ this.Enable=false;
43479
+
43480
+ this.FirstPoint;
43481
+ this.SecondPoint;
43482
+
43483
+ this.IsClearCanvas=true; //画布是否是清空状态
43484
+
43485
+ //设置参数接口
43486
+ this.SetOption=function(option)
43487
+ {
43488
+ if (option)
43489
+ {
43490
+ if (option.LineColor) this.LineColor=option.LineColor;
43491
+ if (option.BGColor) this.BGColor=option.BGColor;
43492
+ if (IFrameSplitOperator.IsNumber(option.ShowMode)) this.ShowMode=option.ShowMode;
43493
+ }
43494
+ }
43495
+
43496
+ this.ReloadResource=function(resource)
43497
+ {
43498
+ this.LineColor=g_JSChartResource.RectDrag.LineColor; //竖线
43499
+ this.LineWidth=g_JSChartResource.RectDrag.LineWidth;
43500
+ this.BGColor=g_JSChartResource.RectDrag.BGColor; //面积
43501
+ }
43502
+
43503
+ this.ClearPoint=function()
43504
+ {
43505
+ this.FirstPoint=null;
43506
+ this.SecondPoint=null;
43507
+
43508
+ if (!this.IsClearCanvas) this.Draw();
43509
+ }
43510
+
43511
+ this.SetFirstPoint=function(x, y)
43512
+ {
43513
+ this.FirstPoint={ X:x, Y:y };
43514
+ }
43515
+
43516
+ this.SetSecondPoint=function(x, y)
43517
+ {
43518
+ this.SecondPoint={ X:x, Y:y };
43519
+ }
43520
+
43521
+ this.DrawSelectedBorderMode=function(rtSelect)
43522
+ {
43523
+ this.Canvas.strokeStyle=this.LineColor;
43524
+ this.Canvas.strokeRect(ToFixedPoint(rtSelect.Left),ToFixedPoint(rtSelect.Top),ToFixedRect(rtSelect.Width),ToFixedRect(rtSelect.Height));
43525
+ }
43526
+
43527
+ this.DrawUnselectedMaskMode=function(rtSelect, rtClient)
43528
+ {
43529
+ if (this.BGColor)
43530
+ {
43531
+ this.Canvas.save();
43532
+
43533
+ var clipPath=new Path2D();
43534
+ clipPath.rect(rtClient.Left, rtClient.Top, rtClient.Width, rtSelect.Top-rtClient.Top);
43535
+
43536
+ var leftPath=new Path2D();
43537
+ leftPath.rect(rtClient.Left,rtSelect.Top, rtSelect.Left-rtClient.Left, rtSelect.Height);
43538
+ clipPath.addPath(leftPath);
43539
+
43540
+ var rightPath=new Path2D();
43541
+ rightPath.rect(rtSelect.Right,rtSelect.Top, rtClient.Right-rtSelect.Right, rtSelect.Height);
43542
+ clipPath.addPath(rightPath);
43543
+
43544
+ var bottmPath=new Path2D();
43545
+ bottmPath.rect(rtClient.Left,rtSelect.Bottom, rtClient.Width, rtClient.Bottom-rtSelect.Bottom);
43546
+ clipPath.addPath(bottmPath);
43547
+
43548
+ this.Canvas.clip(clipPath);
43549
+
43550
+ this.Canvas.fillStyle=this.BGColor;
43551
+ this.Canvas.fillRect(rtClient.Left,rtClient.Top,rtClient.Width,rtClient.Height);
43552
+
43553
+ this.Canvas.restore();
43554
+ }
43555
+
43556
+ this.Canvas.strokeStyle=this.LineColor;
43557
+ this.Canvas.strokeRect(ToFixedPoint(rtSelect.Left),ToFixedPoint(rtSelect.Top),ToFixedRect(rtSelect.Width),ToFixedRect(rtSelect.Height));
43558
+ }
43559
+
43560
+ this.DrawFullselectedMode=function(rtSelect, rtClient)
43561
+ {
43562
+ if (this.BGColor)
43563
+ {
43564
+ this.Canvas.save();
43565
+
43566
+ var clipPath=new Path2D();
43567
+ clipPath.rect(rtClient.Left, rtClient.Top, rtSelect.Left-rtClient.Left, rtClient.Height);
43568
+
43569
+ var rightPath=new Path2D();
43570
+ rightPath.rect(rtSelect.Right,rtClient.Top, rtClient.Right-rtSelect.Right, rtClient.Height);
43571
+ clipPath.addPath(rightPath);
43572
+
43573
+ this.Canvas.clip(clipPath);
43574
+
43575
+ this.Canvas.fillStyle=this.BGColor;
43576
+ this.Canvas.fillRect(rtClient.Left,rtClient.Top,rtClient.Width,rtClient.Height);
43577
+
43578
+ this.Canvas.restore();
43579
+ }
43580
+
43581
+ this.Canvas.strokeStyle=this.LineColor;
43582
+ this.Canvas.strokeRect(ToFixedPoint(rtSelect.Left),ToFixedPoint(rtClient.Top),ToFixedRect(rtSelect.Width),ToFixedRect(rtClient.Height));
43583
+ }
43584
+
43585
+ this.Draw=function()
43586
+ {
43587
+ if (!this.Enable) return;
43588
+ if (!this.HQChart) return;
43589
+
43590
+ var finder=this.HQChart.GetExtraCanvas(JSChart.RectDragCanvasKey);
43591
+ if (!finder) return;
43592
+
43593
+ this.Canvas=finder.Canvas;
43594
+ this.HQChart.ClearCanvas(this.Canvas);
43595
+ this.IsClearCanvas=true;
43596
+
43597
+ if (!this.FirstPoint && !this.SecondPoint) return;
43598
+
43599
+ var top=this.ChartBorder.GetTop();
43600
+ var bottom=this.ChartBorder.GetBottom();
43601
+ var left=this.ChartBorder.GetLeft();
43602
+ var right=this.ChartBorder.GetRight();
43603
+
43604
+ var rtClient={Left:left, Top:top, Right:right, Bottom:bottom };
43605
+ rtClient.Width=rtClient.Right-rtClient.Left;
43606
+ rtClient.Height=rtClient.Bottom-rtClient.Top;
43607
+
43608
+ var rtSelect=
43609
+ {
43610
+ Left:Math.min(this.FirstPoint.X,this.SecondPoint.X),
43611
+ Right:Math.max(this.FirstPoint.X,this.SecondPoint.X),
43612
+ Top:Math.min(this.FirstPoint.Y,this.SecondPoint.Y),
43613
+ Bottom:Math.max(this.FirstPoint.Y,this.SecondPoint.Y)
43614
+ }
43615
+
43616
+ if (rtSelect.Top<top) rtSelect.Top=top;
43617
+ else if (rtSelect.Top>bottom) rtSelect.Top=bottom;
43618
+ if (rtSelect.Bottom<top) rtSelect.Bottom=top;
43619
+ else if (rtSelect.Bottom>bottom) rtSelect.Bottom=bottom;
43620
+
43621
+ if (rtSelect.Left<left) rtSelect.Left=left;
43622
+ else if (rtSelect.Left>right) rtSelect.Left=right;
43623
+ if (rtSelect.Right<left) rtSelect.Right=left;
43624
+ else if (rtSelect.Right>right) rtSelect.Right=right;
43625
+
43626
+ rtSelect.Width=rtSelect.Right-rtSelect.Left;
43627
+ rtSelect.Height=rtSelect.Bottom-rtSelect.Top;
43628
+
43629
+ switch(this.ShowMode)
43630
+ {
43631
+ case 1:
43632
+ this.DrawUnselectedMaskMode(rtSelect,rtClient);
43633
+ break;
43634
+ case 2:
43635
+ this.DrawFullselectedMode(rtSelect,rtClient);
43636
+ break;
43637
+ default:
43638
+ this.DrawSelectedBorderMode(rtSelect);
43639
+ break;
43640
+ }
43641
+
43642
+
43643
+
43644
+ this.IsClearCanvas=false;
43645
+ }
43646
+ }
43647
+
43310
43648
  //深度图 支持横屏
43311
43649
  /*
43312
43650
  数据格式:
@@ -57409,8 +57747,8 @@ function ChartDrawHLine()
57409
57747
  var bottom=this.Frame.ChartBorder.GetBottomEx();
57410
57748
  var pixelTatio = GetDevicePixelRatio();
57411
57749
 
57412
- if (IFrameSplitOperator.IsNumber(labInfo.TopOffset)) top-=labInfo.TopOffset;
57413
- if (IFrameSplitOperator.IsNumber(labInfo.BottomOffset)) bottom+=labInfo.BottomOffset;
57750
+ if (labInfo && IFrameSplitOperator.IsNumber(labInfo.TopOffset)) top-=labInfo.TopOffset;
57751
+ if (labInfo && IFrameSplitOperator.IsNumber(labInfo.BottomOffset)) bottom+=labInfo.BottomOffset;
57414
57752
 
57415
57753
  var yValue=this.Frame.GetYData(y,false);
57416
57754
  var strValue=yValue.toFixed(this.Precision);
@@ -66487,6 +66825,7 @@ function JSChartResource()
66487
66825
  RangeTextSubBGColor:'rgb(54,54,54)',
66488
66826
  }
66489
66827
 
66828
+ //选中图形
66490
66829
  this.SelectedChart=
66491
66830
  {
66492
66831
  LineWidth:1,
@@ -66496,6 +66835,14 @@ function JSChartResource()
66496
66835
  BGColor:"rgb(255,255,255)"
66497
66836
  }
66498
66837
 
66838
+ //鼠标区间选中
66839
+ this.RectDrag=
66840
+ {
66841
+ LineColor:"rgb(0,0,0)", //竖线
66842
+ LineWidth:1*GetDevicePixelRatio(),
66843
+ BGColor:"rgba(128,128,128,0.2)", //面积
66844
+ }
66845
+
66499
66846
  this.DragMovePaint=
66500
66847
  {
66501
66848
  TextColor:"rgb(0,0,0)",
@@ -67229,6 +67576,16 @@ function JSChartResource()
67229
67576
  if (item.RangeTextSubBGColor) this.RectSelect.RangeTextSubBGColor=item.RangeTextSubBGColor;
67230
67577
  }
67231
67578
 
67579
+ if (style.RectDrag)
67580
+ {
67581
+ var item=style.RectDrag;
67582
+ var dest=this.RectDrag;
67583
+
67584
+ if (item.LineColor) dest.LineColor=item.LineColor;
67585
+ if (IFrameSplitOperator.IsPlusNumber(item.LineWidth)) dest.LineWidth=item.LineWidth;
67586
+ if (item.BGColor) dest.BGColor=item.BGColor;
67587
+ }
67588
+
67232
67589
  if (style.OrderFlow)
67233
67590
  {
67234
67591
  item=style.OrderFlow;
@@ -69624,6 +69981,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
69624
69981
  this.CreateMainKLine();
69625
69982
  this.CreateExtendChart("RectSelectPaint", option? option.SelectRect:null); //区间统计
69626
69983
  if (this.EnableIndexChartDrag) this.CreateExtendChart("DragMovePaint");
69984
+ this.CreateDragSelectRect(option? option.DragSelectRect:null);
69627
69985
 
69628
69986
  //子窗口动态标题
69629
69987
  for(var i in this.Frame.SubFrame)
@@ -69664,6 +70022,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
69664
70022
  if (bRegisterWheel) this.UIElement.addEventListener("wheel", (e)=>{ this.OnWheel(e); }, true); //上下滚动消息
69665
70023
  }
69666
70024
 
70025
+
70026
+
69667
70027
  this.OnCustomKeyDown=function(keyID, e) //自定义键盘事件
69668
70028
  {
69669
70029
  if (keyID==37 && e.ctrlKey) //Ctrl+Left
@@ -74436,7 +74796,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
74436
74796
 
74437
74797
  { Name:"禁止拖拽", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_MODE_ID, Args:[0]}, Checked:0==this.DragMode },
74438
74798
  { 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 },
74799
+ { Name:"左键区间选择", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_MODE_ID, Args:[2]}, Checked:2==this.DragMode },
74440
74800
  { Name:JSPopMenu.SEPARATOR_LINE_NAME },
74441
74801
 
74442
74802
  { Name:"背景分割", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_BG_SPLIT_ID, Args:[!bBGSpit]}, Checked:bBGSpit},
@@ -74462,6 +74822,15 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
74462
74822
  { Name:"繁体", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_LANGUAGE_ID, Args:["TC"]}, Checked:this.LanguageID==JSCHART_LANGUAGE_ID.LANGUAGE_TRADITIONAL_CHINESE_ID },
74463
74823
  ]
74464
74824
  },
74825
+ {
74826
+ Name:"区间选择样式",
74827
+ SubMenu:
74828
+ [
74829
+ { Name:"样式1(默认)", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID, Args:[0]}, Checked:0==this.ChartDragSelectRect.ShowMode },
74830
+ { Name:"样式2", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID, Args:[1]}, Checked:1==this.ChartDragSelectRect.ShowMode },
74831
+ { Name:"样式3", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID, Args:[2]}, Checked:2==this.ChartDragSelectRect.ShowMode },
74832
+ ]
74833
+ }
74465
74834
  ]
74466
74835
  }
74467
74836
  ];
@@ -76831,11 +77200,10 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
76831
77200
 
76832
77201
  //this.UIElement.style.cursor="default";
76833
77202
  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);
77203
+ var ptStart=this.PointAbsoluteToRelative(drag.Click.X, drag.Click.Y);
77204
+ var ptEnd=this.PointAbsoluteToRelative(e.clientX, e.clientY);
77205
+
77206
+ this.ShowDragSelectRect(ptStart, ptEnd);
76839
77207
 
76840
77208
  drag.LastMove.X=e.clientX;
76841
77209
  drag.LastMove.Y=e.clientY;
@@ -78006,6 +78374,16 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78006
78374
  SubMenu:
78007
78375
  [
78008
78376
  { Name:"画图工具", Data:{ ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID, Args:[]}, Checked:this.IsShowDrawToolDialog()},
78377
+
78378
+ {
78379
+ Name:"区间选择样式",
78380
+ SubMenu:
78381
+ [
78382
+ { Name:"样式1(默认)", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID, Args:[0]}, Checked:0==this.ChartDragSelectRect.ShowMode },
78383
+ { Name:"样式2", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID, Args:[1]}, Checked:1==this.ChartDragSelectRect.ShowMode },
78384
+ { Name:"样式3", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID, Args:[2]}, Checked:2==this.ChartDragSelectRect.ShowMode },
78385
+ ]
78386
+ }
78009
78387
  ]
78010
78388
  }
78011
78389
 
@@ -78196,6 +78574,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78196
78574
  this.CreateMainKLine();
78197
78575
  this.CreateExtendChart("RectSelectPaint", option? option.SelectRect:null); //区间统计
78198
78576
  if (this.EnableIndexChartDrag) this.CreateExtendChart("DragMovePaint");
78577
+ this.CreateDragSelectRect(option? option.DragSelectRect:null);
78199
78578
 
78200
78579
  //子窗口动态标题
78201
78580
  for(var i=0;i<this.Frame.SubFrame.length; ++i)