hqchart 1.1.14643 → 1.1.14651

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.
@@ -3147,7 +3147,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3147
3147
  },
3148
3148
 
3149
3149
  //锁十字光标
3150
- LockCorssCursor:{ X:{ Enable:false } }
3150
+ LockCorssCursor:{ X:{ Enable:false } },
3151
+
3152
+ //图形中的单元选中状态
3153
+ MapIndexChartCache:new Map(), //key 指标GUID
3151
3154
  };
3152
3155
 
3153
3156
  this.VerticalDrag; //通过X轴左右拖动数据(手势才有)
@@ -3824,6 +3827,56 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3824
3827
  return false;
3825
3828
  }
3826
3829
 
3830
+ //点击图新内部元素
3831
+ this.TryClickChartCell=function(x, y, e)
3832
+ {
3833
+ var result=null;
3834
+ for(var i=0;i<this.ChartPaint.length;++i)
3835
+ {
3836
+ var item=this.ChartPaint[i];
3837
+ if (!item.ClickCell) continue;
3838
+ if (item.IsHideScriptIndex()) continue;
3839
+
3840
+ result=item.ClickCell(x,y,e);
3841
+ if (result) return result;
3842
+ }
3843
+
3844
+ for(var i=0;i<this.OverlayChartPaint.length;++i)
3845
+ {
3846
+ var item=this.OverlayChartPaint[i];
3847
+ if (!item.ClickCell) continue;
3848
+
3849
+ result=item.ClickCell(x,y,e);
3850
+ if (result) return result;
3851
+ }
3852
+
3853
+ for(var i=0,j=0,k=0;i<this.Frame.SubFrame.length;++i)
3854
+ {
3855
+ var item=this.Frame.SubFrame[i];
3856
+ if (!IFrameSplitOperator.IsNonEmptyArray(item.OverlayIndex)) continue;
3857
+
3858
+ for(j=0;j<item.OverlayIndex.length;++j)
3859
+ {
3860
+ var overlayItem=item.OverlayIndex[j];
3861
+ if (!IFrameSplitOperator.IsNonEmptyArray(overlayItem.ChartPaint)) continue;
3862
+
3863
+ for(var k=0;k<overlayItem.ChartPaint.length; ++k)
3864
+ {
3865
+ var chart=overlayItem.ChartPaint[k];
3866
+ if (!chart.IsShow) continue;
3867
+ if (chart.IsHideScriptIndex()) continue;
3868
+ if (chart.ClickCell)
3869
+ {
3870
+ result=chart.ClickCell(x,y,e);
3871
+ if (result) return result;
3872
+ }
3873
+ }
3874
+ }
3875
+ }
3876
+
3877
+ return null;
3878
+ }
3879
+
3827
3880
  this.TryMouseMove_CustomChartDrag=function(sendData)
3828
3881
  {
3829
3882
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_MOVE);
@@ -4135,23 +4188,41 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
4135
4188
  }, 250);
4136
4189
 
4137
4190
  var bSelectedChartChanged=false;
4138
- if (this.SelectedChart.EnableSelected)
4191
+ var clickCellData=this.TryClickChartCell(x,y,e); //点击图形子元素
4192
+
4193
+ if (clickCellData)
4194
+ {
4195
+ if (clickCellData.Redraw===true) bRedraw=true;
4196
+ }
4197
+ else
4139
4198
  {
4140
- var selectChart=this.PtInChart(x,y);
4141
- if (selectChart)
4199
+ if (this.SelectedChart.EnableSelected) //整体图形选中
4142
4200
  {
4143
- if (this.SelectedChart.Selected.Identify!=selectChart.Identify)
4201
+ var selectChart=this.PtInChart(x,y);
4202
+ if (selectChart)
4144
4203
  {
4145
- this.SelectedChart.Selected.Identify=selectChart.Identify;
4146
- this.SelectedChart.Selected.Chart=selectChart.Chart;
4147
- bSelectedChartChanged=true;
4148
- }
4204
+ if (this.SelectedChart.Selected.Identify!=selectChart.Identify)
4205
+ {
4206
+ this.SelectedChart.Selected.Identify=selectChart.Identify;
4207
+ this.SelectedChart.Selected.Chart=selectChart.Chart;
4208
+ bSelectedChartChanged=true;
4209
+ }
4149
4210
 
4150
- if (this.EnableIndexChartDrag)
4211
+ if (this.EnableIndexChartDrag)
4212
+ {
4213
+ this.IndexChartDrag={ SelectedChart:selectChart, LastMove:{X:x, Y:y}, Click:{X:x, Y:y } };
4214
+ this.IndexChartDrag.Info=this.GetSelectedChartInfo(selectChart);
4215
+ if (this.IndexChartDrag.Info) this.IndexChartDrag.Info.FrameID=this.Frame.PtInFrame(x,y);
4216
+ }
4217
+ }
4218
+ else
4151
4219
  {
4152
- this.IndexChartDrag={ SelectedChart:selectChart, LastMove:{X:x, Y:y}, Click:{X:x, Y:y } };
4153
- this.IndexChartDrag.Info=this.GetSelectedChartInfo(selectChart);
4154
- if (this.IndexChartDrag.Info) this.IndexChartDrag.Info.FrameID=this.Frame.PtInFrame(x,y);
4220
+ if (this.SelectedChart.Selected.Identify)
4221
+ {
4222
+ this.SelectedChart.Selected.Identify=null;
4223
+ this.SelectedChart.Selected.Chart=null;
4224
+ bSelectedChartChanged=true;
4225
+ }
4155
4226
  }
4156
4227
  }
4157
4228
  else
@@ -4159,19 +4230,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
4159
4230
  if (this.SelectedChart.Selected.Identify)
4160
4231
  {
4161
4232
  this.SelectedChart.Selected.Identify=null;
4162
- this.SelectedChart.Selected.Chart=null;
4163
4233
  bSelectedChartChanged=true;
4164
4234
  }
4165
4235
  }
4166
4236
  }
4167
- else
4168
- {
4169
- if (this.SelectedChart.Selected.Identify)
4170
- {
4171
- this.SelectedChart.Selected.Identify=null;
4172
- bSelectedChartChanged=true;
4173
- }
4174
- }
4175
4237
 
4176
4238
  if ((drawPictureActive.Select.Guid!=null && this.SelectChartDrawPicture==null) || bSelectedChartChanged)
4177
4239
  {
@@ -7052,8 +7114,18 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7052
7114
  var sendData={ MouseStatus:null, X:x, Y:y, FrameID:frameID, e:e };
7053
7115
  if (this.TryMouseMove_CustomChartDrag(sendData))
7054
7116
  {
7055
- if (sendData.MouseStatus)
7056
- mouseStatus=sendData.MouseStatus;
7117
+ if (sendData.MouseStatus)
7118
+ {
7119
+ if (sendData.MouseStatus.Level==1) //高等级 覆盖状态
7120
+ {
7121
+ mouseStatus=sendData.MouseStatus;
7122
+ }
7123
+ else
7124
+ {
7125
+ if (!mouseStatus) mouseStatus=sendData.MouseStatus;
7126
+ }
7127
+ }
7128
+
7057
7129
  }
7058
7130
 
7059
7131
  var bDrawPicture=false; //是否正在画图
@@ -10017,6 +10089,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
10017
10089
  frame.Canvas=this.Canvas;
10018
10090
  frame.MainFrame=subFrame.Frame;
10019
10091
  frame.ChartBorder=subFrame.Frame.ChartBorder;
10092
+ frame.GlobalOption=this.GlobalOption;
10020
10093
  if (findOverlayItem) frame.IsShow=findOverlayItem.Frame.IsShow;
10021
10094
  //if (obj.IsShareY===true) frame.IsShareY=true;
10022
10095
  frame.YSplitOperator=new FrameSplitY();
@@ -25485,6 +25558,59 @@ function IChartPainting()
25485
25558
  else return item.Date;
25486
25559
  }
25487
25560
 
25561
+ //保存图形状态
25562
+ this.SaveCacheData=function(name, value)
25563
+ {
25564
+ if (!this.ChartFrame || !this.ChartFrame.GlobalOption) return false;
25565
+ var mapIndexCache=this.ChartFrame.GlobalOption.MapIndexChartCache;
25566
+ if (!mapIndexCache) return false;
25567
+
25568
+ if (!this.Script || !this.Script.Guid) return false;
25569
+ if (!this.Name) return false;
25570
+
25571
+ var id=this.Script.Guid; //指标ID;
25572
+ if (!mapIndexCache.has(id))
25573
+ {
25574
+ mapIndexCache.set(id, { MapData:new Map() });
25575
+ }
25576
+
25577
+ var mapItem=mapIndexCache.get(id);
25578
+ var key=`${this.Name}-${name}`;
25579
+ mapItem.MapData.set(key, value);
25580
+
25581
+ return true;
25582
+ }
25583
+
25584
+ //获取缓存数据 返回数据 out:{ Data, Key, IndexGuid }
25585
+ this.GetCacheData=function(name, out)
25586
+ {
25587
+ if (!this.ChartFrame || !this.ChartFrame.GlobalOption) return false;
25588
+ var mapIndexCache=this.ChartFrame.GlobalOption.MapIndexChartCache;
25589
+ if (!mapIndexCache) return false;
25590
+
25591
+ if (!this.Script || !this.Script.Guid) return false;
25592
+ if (!this.Name) return false;
25593
+
25594
+ var id=this.Script.Guid; //指标ID;
25595
+ if (!mapIndexCache.has(id)) return false;
25596
+
25597
+ var mapItem=mapIndexCache.get(id);
25598
+ var key=`${this.Name}-${name}`;
25599
+
25600
+ if (!mapItem.MapData.has(key)) return false;
25601
+
25602
+ var value=mapItem.MapData.get(key);
25603
+ if (out)
25604
+ {
25605
+ out.Data=value;
25606
+ out.Key=key;
25607
+ out.IndexGuid=id;
25608
+ }
25609
+
25610
+ return true;
25611
+ }
25612
+
25613
+
25488
25614
  //数据导出 数据格式 [{ Title:数据名称, Data:[] }]
25489
25615
  //this.ExportData=function(aryKData) { }
25490
25616
 
@@ -26198,6 +26324,12 @@ function IChartPainting()
26198
26324
  }
26199
26325
  }
26200
26326
 
26327
+ //缓存键值
26328
+ IChartPainting.CACHE_KEY=
26329
+ {
26330
+ SELECTED:"_Selected_Key_", //图形元素选中(单选)
26331
+ }
26332
+
26201
26333
 
26202
26334
  //缩放因子
26203
26335
  /*
@@ -32603,7 +32735,7 @@ function ChartKLineTable()
32603
32735
  this.newMethod();
32604
32736
  delete this.newMethod;
32605
32737
 
32606
- this.ClassName='ChartKlineTable'; //类名
32738
+ this.ClassName='ChartKLineTable'; //类名
32607
32739
  this.Data;
32608
32740
  this.RowName;
32609
32741
  this.RowNamePosition=1; //0=不显示 1=左边内部 2=左边外部 3=右边外部
@@ -44000,8 +44132,11 @@ function ChartDrawSVG()
44000
44132
  this.BuildKeyCallback=null;
44001
44133
  this.MapCache=null; //key=date/date-time value={ Data:[] }
44002
44134
 
44003
- this.AryDrawDetail=[]; //需要绘制的文字信息
44004
- this.EnalbeDetailNoOverlap=false; //详情重叠不显示
44135
+ this.AryDrawDetail=[]; //需要绘制的文字信息
44136
+ this.EnalbeDetailNoOverlap=false; //详情重叠不显示
44137
+ this.EnableClick=false; //是否支持点击
44138
+ this.PixelRatio=GetDevicePixelRatio();
44139
+ this.SelectedItemCache=null;
44005
44140
 
44006
44141
  this.BuildKey=function(item)
44007
44142
  {
@@ -44039,6 +44174,7 @@ function ChartDrawSVG()
44039
44174
  this.AryDrawRect=[];
44040
44175
  this.AryDrawDetail=[];
44041
44176
  this.AutoYOffset=0;
44177
+ this.SelectedItemCache=null;
44042
44178
 
44043
44179
  if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
44044
44180
  if (this.IsShowIndexTitleOnly()) return;
@@ -44049,13 +44185,17 @@ function ChartDrawSVG()
44049
44185
 
44050
44186
  if (this.EnalbeDetailNoOverlap) this.DrawOnVerlapDetail();
44051
44187
 
44188
+ this.DrawSelectedItem();
44189
+
44052
44190
  this.AryDrawDetail=[];
44191
+ this.SelectedItemCache=null;
44053
44192
  }
44054
44193
 
44055
44194
  this.DrawDetail=function(rtSVG, data, svgItem)
44056
44195
  {
44057
44196
  if (!IFrameSplitOperator.IsNonEmptyArray(data.Content)) return;
44058
44197
 
44198
+ var bSelected=this.IsSelectedItem(svgItem); //是否是选中点
44059
44199
  var lefMargin=2;
44060
44200
  var rightMargin=2;
44061
44201
  var itemSpace=2;
@@ -44116,13 +44256,15 @@ function ChartDrawSVG()
44116
44256
  }
44117
44257
  }
44118
44258
 
44259
+ if (bSelected) this.SelectedItemCache.Detail={ AryText:aryText, Rect:rtBorder, Data:svgItem };
44260
+
44119
44261
  if (this.EnalbeDetailNoOverlap) //启动重叠不会 先不画只计算位置, 后面统一画
44120
44262
  {
44121
44263
  this.AryDrawDetail.push({ Rect:rtBorder, AryText:aryText, Data:svgItem });
44122
44264
  return;
44123
44265
  }
44124
44266
 
44125
- this.DrawDetailText(data,aryText,rtBorder);
44267
+ if (!bSelected) this.DrawDetailText(data,aryText,rtBorder);
44126
44268
 
44127
44269
  this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:svgItem } );
44128
44270
  }
@@ -44169,7 +44311,9 @@ function ChartDrawSVG()
44169
44311
 
44170
44312
  if (this.IsRectOverlap(rtBorder)) continue;
44171
44313
 
44172
- this.DrawDetailText(drawItem.Data.Detail, drawItem.AryText, rtBorder);
44314
+ var bSelected=this.IsSelectedItem(drawItem.Data); //是否是选中点
44315
+
44316
+ if (!bSelected) this.DrawDetailText(drawItem.Data.Detail, drawItem.AryText, rtBorder);
44173
44317
 
44174
44318
  this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:drawItem.Data } );
44175
44319
  }
@@ -44334,6 +44478,12 @@ function ChartDrawSVG()
44334
44478
  }
44335
44479
  }
44336
44480
 
44481
+ this.IsSelectedItem=function(item)
44482
+ {
44483
+ if (!this.SelectedItemCache) return false;
44484
+ return this.SelectedItemCache.ID==item.ID;
44485
+ }
44486
+
44337
44487
  this.DrawSVGV2=function()
44338
44488
  {
44339
44489
  if (!this.IsShow || this.ChartFrame.IsMinSize) return;
@@ -44349,7 +44499,7 @@ function ChartDrawSVG()
44349
44499
  var distanceWidth=this.ChartFrame.DistanceWidth;
44350
44500
  var isMinute=this.IsMinuteFrame();
44351
44501
  var border=this.GetBorder();
44352
- var pixelRatio = GetDevicePixelRatio();
44502
+ this.PixelRatio=GetDevicePixelRatio();
44353
44503
 
44354
44504
  if (this.IsHScreen)
44355
44505
  {
@@ -44364,7 +44514,11 @@ function ChartDrawSVG()
44364
44514
  var bottom=border.BottomEx;
44365
44515
  }
44366
44516
 
44367
- var x,y,price;
44517
+ var selectedData={ };
44518
+ if (this.GetCacheData(IChartPainting.CACHE_KEY.SELECTED, selectedData)) //选中图标
44519
+ this.SelectedItemCache={ ID:selectedData.Data.ID };
44520
+
44521
+ var x;
44368
44522
  var setKey=new Set(); //已经画过的Key就不再用了
44369
44523
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
44370
44524
  {
@@ -44391,147 +44545,200 @@ function ChartDrawSVG()
44391
44545
  {
44392
44546
  var item=mapItem.Data[k];
44393
44547
 
44394
- if (item.Value=="Top") y=top;
44395
- else if (item.Value=="Bottom") y=bottom;
44396
- else
44548
+ if (this.IsSelectedItem(item))
44397
44549
  {
44398
- if (IFrameSplitOperator.IsString(item.Value)) price=this.GetKValue(kItem,item.Value);
44399
- else price=item.Value;
44400
-
44401
- y=this.ChartFrame.GetYFromData(price, false);
44550
+ this.SelectedItemCache.Item=item;
44551
+ this.SelectedItemCache.KItem=kItem;
44552
+ this.SelectedItemCache.Index=i;
44553
+ this.SelectedItemCache.X=x;
44554
+ this.SelectedItemCache.Top=top;
44555
+ this.SelectedItemCache.Bottom=bottom;
44402
44556
  }
44403
- if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
44404
44557
 
44405
- var svgItem=item.SVG;
44406
- if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
44558
+ this.DrawSVGItem(item, kItem, i, x, top, bottom);
44559
+ }
44407
44560
 
44408
- if (this.AutoPosition)
44409
- {
44410
- var pt={ X:x, Y:y };
44411
- this.CalculateShowPosition(item, pt); //重新计算位置
44412
- x=pt.X;
44413
- y=pt.Y;
44414
- }
44561
+ setKey.add(key);
44562
+ }
44563
+ }
44415
44564
 
44416
- var fontSVG=`${svgItem.Size}px ${this.Family}`;
44417
- this.Canvas.font=fontSVG;
44418
- var halfSize=svgItem.Size/2;
44419
- var textBaseline='bottom';
44420
- var rtSVG={ Left:x-halfSize, Right:x+halfSize, Top:y-svgItem.Size, Bottom:y, Height:svgItem.Size, Width:svgItem.Size };
44421
- if (svgItem.VAlign===0)
44422
- {
44423
- textBaseline="top";
44424
- rtSVG.Top=y;
44425
- rtSVG.Bottom=rtSVG.Top+svgItem.Size;
44426
- }
44427
- else if (svgItem.VAlign===1)
44428
- {
44429
- textBaseline='middle';
44430
- rtSVG.Top=y-svgItem.Size/2;
44431
- rtSVG.Bottom=rtSVG.Top+svgItem.Size;
44432
- }
44433
44565
 
44434
- if (rtSVG.Top<0)
44435
- {
44436
- rtSVG.Top=0;
44437
- rtSVG.Bottom=svgItem.Size;
44438
- y=rtSVG.Bottom;
44439
- }
44566
+ this.GetYFromData=function(value, kItem, top, bottom)
44567
+ {
44568
+ if (value=="Top") return top;
44569
+ if (value=="Bottom") return bottom;
44570
+
44571
+ var price;
44572
+ if (IFrameSplitOperator.IsString(value)) price=this.GetKValue(kItem,value);
44573
+ else price=value;
44440
44574
 
44441
- this.Canvas.textBaseline=textBaseline;
44442
- this.Canvas.textAlign='center';
44443
- this.Canvas.fillStyle = svgItem.Color;
44444
- this.Canvas.fillText(svgItem.Symbol, x, y);
44575
+ var y=this.ChartFrame.GetYFromData(price, false);
44445
44576
 
44446
- this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
44577
+ return y;
44578
+ }
44447
44579
 
44448
- if (this.EnableTooltip) this.TooltipRect.push({ Rect:rtSVG, Index:i, Item:item });
44580
+ this.DrawSVGItem=function(item, kItem, index, x, top, bottom)
44581
+ {
44582
+ var y=this.GetYFromData(item.Value, kItem, top, bottom);
44583
+ if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
44449
44584
 
44450
- //文字
44451
- if (item.Text && item.Text.Content && this.TextFont)
44452
- {
44453
- var textItem=item.Text;
44454
- this.Canvas.font=this.TextFont;
44455
- this.Canvas.fillStyle=textItem.Color;
44456
- var yText=y;
44457
- if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
44458
- this.Canvas.fillText(textItem.Content, x, yText);
44459
- }
44585
+ var svgItem=item.SVG;
44586
+ if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
44460
44587
 
44461
- if (item.Detail)
44462
- {
44463
- this.DrawDetail(rtSVG,item.Detail, item);
44464
- }
44465
-
44466
- //连线
44467
- if (item.Line)
44468
- {
44469
- var lineItem=item.Line;
44470
- var price=null, yPrice=null;
44471
- if (lineItem.Value=="Bottom")
44472
- {
44473
- yPrice=bottom;
44474
- }
44475
- else if (lineItem.Value=="Top")
44476
- {
44477
- yPrice=top;
44478
- }
44479
- else
44480
- {
44481
- if (IFrameSplitOperator.IsString(lineItem.Value)) price=this.GetKValue(kItem,lineItem.Value);
44482
- else if (IFrameSplitOperator.IsNumber(lineItem.Value)) price=lineItem.Value;
44588
+ if (this.AutoPosition)
44589
+ {
44590
+ var pt={ X:x, Y:y };
44591
+ this.CalculateShowPosition(item, pt); //重新计算位置
44592
+ x=pt.X;
44593
+ y=pt.Y;
44594
+ }
44483
44595
 
44484
- if (!IFrameSplitOperator.IsNumber(price)) continue;
44485
- yPrice=this.ChartFrame.GetYFromData(price);
44486
- }
44487
-
44488
- if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) continue;
44596
+ var bSelected=this.IsSelectedItem(item); //是否是选中点
44489
44597
 
44490
- var yText;
44491
- if (yPrice<rtSVG.Top)
44492
- {
44493
- yText=rtSVG.Top;
44494
- if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
44495
- {
44496
- //yPrice+=lineItem.Blank;
44497
- yText-=lineItem.SVGBlank;
44498
- }
44499
- }
44500
- else
44501
- {
44502
- yText=rtSVG.Bottom;
44503
- if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
44504
- {
44505
- //yPrice-=lineItem.Blank;
44506
- yText+=lineItem.SVGBlank;
44507
- }
44508
- }
44598
+ var fontSVG=`${svgItem.Size}px ${this.Family}`;
44599
+ this.Canvas.font=fontSVG;
44600
+ var halfSize=svgItem.Size/2;
44601
+ var textBaseline='bottom';
44602
+ var rtSVG={ Left:x-halfSize, Right:x+halfSize, Top:y-svgItem.Size, Bottom:y, Height:svgItem.Size, Width:svgItem.Size };
44603
+ if (svgItem.VAlign===0)
44604
+ {
44605
+ textBaseline="top";
44606
+ rtSVG.Top=y;
44607
+ rtSVG.Bottom=rtSVG.Top+svgItem.Size;
44608
+ }
44609
+ else if (svgItem.VAlign===1)
44610
+ {
44611
+ textBaseline='middle';
44612
+ rtSVG.Top=y-svgItem.Size/2;
44613
+ rtSVG.Bottom=rtSVG.Top+svgItem.Size;
44614
+ }
44509
44615
 
44510
- if (lineItem.Dash) this.Canvas.setLineDash(lineItem.Dash); //虚线
44511
- var lineWidth=1*pixelRatio;
44512
- if (lineItem.Width>0) lineWidth=lineItem.Width*pixelRatio;
44513
- this.Canvas.lineWidth=lineWidth; //线宽
44514
- this.Canvas.strokeStyle = lineItem.Color;
44515
- this.Canvas.beginPath();
44616
+ if (rtSVG.Top<0)
44617
+ {
44618
+ rtSVG.Top=0;
44619
+ rtSVG.Bottom=svgItem.Size;
44620
+ y=rtSVG.Bottom;
44621
+ }
44516
44622
 
44517
- if (this.IsHScreen)
44518
- {
44519
- this.Canvas.moveTo(yText, ToFixedPoint(x));
44520
- this.Canvas.lineTo(yPrice,ToFixedPoint(x));
44521
- }
44522
- else
44523
- {
44524
- this.Canvas.moveTo(ToFixedPoint2(lineWidth,x),yText);
44525
- this.Canvas.lineTo(ToFixedPoint2(lineWidth,x),yPrice);
44526
- }
44527
-
44528
- this.Canvas.stroke();
44529
- this.Canvas.setLineDash([]);
44530
- }
44623
+ if (!bSelected)
44624
+ {
44625
+ this.Canvas.textBaseline=textBaseline;
44626
+ this.Canvas.textAlign='center';
44627
+ this.Canvas.fillStyle = svgItem.Color;
44628
+ this.Canvas.fillText(svgItem.Symbol, x, y);
44629
+ }
44630
+ else
44631
+ {
44632
+ this.SelectedItemCache.RectSVG=rtSVG; //保存图标的位置
44633
+ this.SelectedItemCache.SVGConfig={ Font:fontSVG, TextBaseline:textBaseline, X:x, Y:y };
44634
+ }
44635
+
44636
+ this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
44637
+
44638
+ if (this.EnableTooltip) this.TooltipRect.push({ Rect:rtSVG, Index:index, Item:item });
44639
+
44640
+ //图标内的文字
44641
+ if (!bSelected && item.Text && item.Text.Content && this.TextFont)
44642
+ {
44643
+ var textItem=item.Text;
44644
+ this.Canvas.font=this.TextFont;
44645
+ this.Canvas.fillStyle=textItem.Color;
44646
+ var yText=y;
44647
+ if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
44648
+ this.Canvas.fillText(textItem.Content, x, yText);
44649
+ }
44650
+
44651
+ //图标左右两边文字
44652
+ if (item.Detail) this.DrawDetail(rtSVG, item.Detail, item);
44653
+
44654
+ //连线
44655
+ if (!bSelected && item.Line) this.DrawVerticalLine(item,kItem,x, rtSVG, top, bottom);
44656
+ }
44657
+
44658
+ //绘制垂直连线
44659
+ this.DrawVerticalLine=function(item, kItem, x, rtSVG, top, bottom)
44660
+ {
44661
+ if (!item.Line) return;
44662
+
44663
+ var lineItem=item.Line;
44664
+ var yPrice=this.GetYFromData(lineItem.Value, kItem, top, bottom)
44665
+ if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) return;
44666
+
44667
+ var yText;
44668
+ if (yPrice<rtSVG.Top)
44669
+ {
44670
+ yText=rtSVG.Top;
44671
+ if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
44672
+ {
44673
+ //yPrice+=lineItem.Blank;
44674
+ yText-=lineItem.SVGBlank;
44675
+ }
44676
+ }
44677
+ else
44678
+ {
44679
+ yText=rtSVG.Bottom;
44680
+ if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
44681
+ {
44682
+ //yPrice-=lineItem.Blank;
44683
+ yText+=lineItem.SVGBlank;
44531
44684
  }
44685
+ }
44532
44686
 
44533
- setKey.add(key);
44687
+ if (lineItem.Dash) this.Canvas.setLineDash(lineItem.Dash); //虚线
44688
+ var lineWidth=1*this.PixelRatio;
44689
+ if (lineItem.Width>0) lineWidth=lineItem.Width*this.PixelRatio;
44690
+ this.Canvas.lineWidth=lineWidth; //线宽
44691
+ this.Canvas.strokeStyle = lineItem.Color;
44692
+ this.Canvas.beginPath();
44693
+
44694
+ if (this.IsHScreen)
44695
+ {
44696
+ this.Canvas.moveTo(yText, ToFixedPoint(x));
44697
+ this.Canvas.lineTo(yPrice,ToFixedPoint(x));
44698
+ }
44699
+ else
44700
+ {
44701
+ this.Canvas.moveTo(ToFixedPoint2(lineWidth,x),yText);
44702
+ this.Canvas.lineTo(ToFixedPoint2(lineWidth,x),yPrice);
44534
44703
  }
44704
+
44705
+ this.Canvas.stroke();
44706
+ this.Canvas.setLineDash([]);
44707
+ }
44708
+
44709
+ this.DrawSelectedItem=function()
44710
+ {
44711
+ if (!this.SelectedItemCache || !this.SelectedItemCache.Item) return;
44712
+
44713
+ var selecteItem=this.SelectedItemCache;
44714
+ var item=selecteItem.Item;
44715
+ var kItem=selecteItem.KItem;
44716
+ var top=selecteItem.Top;
44717
+ var bottom=selecteItem.Bottom;
44718
+ var rtSVG=selecteItem.RectSVG;
44719
+ var svgItem=item.SVG;
44720
+ var config=selecteItem.SVGConfig;
44721
+
44722
+ var x=config.X, y=config.Y;
44723
+ this.Canvas.font=config.Font;
44724
+ this.Canvas.textBaseline=config.TextBaseline;
44725
+ this.Canvas.textAlign='center';
44726
+ this.Canvas.fillStyle = svgItem.Color;
44727
+ this.Canvas.fillText(svgItem.Symbol, config.X, config.Y);
44728
+
44729
+ if (item.Text && item.Text.Content && this.TextFont)
44730
+ {
44731
+ var textItem=item.Text;
44732
+ this.Canvas.font=this.TextFont;
44733
+ this.Canvas.fillStyle=textItem.Color;
44734
+ var yText=y;
44735
+ if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
44736
+ this.Canvas.fillText(textItem.Content, x, yText);
44737
+ }
44738
+
44739
+ if (item.Line) this.DrawVerticalLine(item, kItem, x, rtSVG, top, bottom);
44740
+
44741
+ if (selecteItem.Detail) this.DrawDetailText(selecteItem.Item.Detail, selecteItem.Detail.AryText, selecteItem.Detail.Rect);
44535
44742
  }
44536
44743
 
44537
44744
  this.GetMaxMin=function()
@@ -44570,8 +44777,9 @@ function ChartDrawSVG()
44570
44777
  this.GetTooltipData=function(x,y,tooltip)
44571
44778
  {
44572
44779
  if (!this.IsShow) return false;
44780
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipRect)) return;
44573
44781
 
44574
- for(var i=0;i<this.TooltipRect.length;++i)
44782
+ for(var i=this.TooltipRect.length-1; i>=0; --i)
44575
44783
  {
44576
44784
  var item=this.TooltipRect[i];
44577
44785
  if (!item.Rect) continue;
@@ -44591,6 +44799,38 @@ function ChartDrawSVG()
44591
44799
 
44592
44800
  return false;
44593
44801
  }
44802
+
44803
+ this.ClickCell=function(x,y,e)
44804
+ {
44805
+ if (!this.IsShow) return null;
44806
+ if (!this.EnableClick) return null;
44807
+
44808
+ for(var i=this.TooltipRect.length-1; i>=0; --i)
44809
+ {
44810
+ var item=this.TooltipRect[i];
44811
+ if (!item.Rect) continue;
44812
+
44813
+ var rect=item.Rect;
44814
+ if (x>=rect.Left && x<=rect.Right && y>=rect.Top && y<=rect.Bottom)
44815
+ {
44816
+ var svgItem=item.Item;
44817
+ var id=svgItem.ID;
44818
+ var result={ Data:svgItem, Redraw:false, ChartPaint:this };
44819
+ var oldSelectedID=null;
44820
+ var out={ };
44821
+ if (this.GetCacheData(IChartPainting.CACHE_KEY.SELECTED, out)) oldSelectedID=out.Data.ID;
44822
+ if (id!=oldSelectedID)
44823
+ {
44824
+ this.SaveCacheData(IChartPainting.CACHE_KEY.SELECTED, { ID:id } );
44825
+ result.Redraw=true;
44826
+ }
44827
+
44828
+ return result;
44829
+ }
44830
+ }
44831
+
44832
+ return null;
44833
+ }
44594
44834
  }
44595
44835
 
44596
44836
  // OX图 支持横屏
@@ -81260,6 +81500,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
81260
81500
  frame.Canvas=this.Canvas;
81261
81501
  frame.MainFrame=subFrame.Frame;
81262
81502
  frame.ChartBorder=subFrame.Frame.ChartBorder;
81503
+ frame.GlobalOption=this.GlobalOption;
81263
81504
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
81264
81505
  if (obj.ShowRightText===true) frame.IsShow=true;
81265
81506
  else if (obj.ShowRightText===false) frame.IsShow=false;