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.
@@ -7243,7 +7243,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7243
7243
  },
7244
7244
 
7245
7245
  //锁十字光标
7246
- LockCorssCursor:{ X:{ Enable:false } }
7246
+ LockCorssCursor:{ X:{ Enable:false } },
7247
+
7248
+ //图形中的单元选中状态
7249
+ MapIndexChartCache:new Map(), //key 指标GUID
7247
7250
  };
7248
7251
 
7249
7252
  this.VerticalDrag; //通过X轴左右拖动数据(手势才有)
@@ -7920,6 +7923,56 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7920
7923
  return false;
7921
7924
  }
7922
7925
 
7926
+ //点击图新内部元素
7927
+ this.TryClickChartCell=function(x, y, e)
7928
+ {
7929
+ var result=null;
7930
+ for(var i=0;i<this.ChartPaint.length;++i)
7931
+ {
7932
+ var item=this.ChartPaint[i];
7933
+ if (!item.ClickCell) continue;
7934
+ if (item.IsHideScriptIndex()) continue;
7935
+
7936
+ result=item.ClickCell(x,y,e);
7937
+ if (result) return result;
7938
+ }
7939
+
7940
+ for(var i=0;i<this.OverlayChartPaint.length;++i)
7941
+ {
7942
+ var item=this.OverlayChartPaint[i];
7943
+ if (!item.ClickCell) continue;
7944
+
7945
+ result=item.ClickCell(x,y,e);
7946
+ if (result) return result;
7947
+ }
7948
+
7949
+ for(var i=0,j=0,k=0;i<this.Frame.SubFrame.length;++i)
7950
+ {
7951
+ var item=this.Frame.SubFrame[i];
7952
+ if (!IFrameSplitOperator.IsNonEmptyArray(item.OverlayIndex)) continue;
7953
+
7954
+ for(j=0;j<item.OverlayIndex.length;++j)
7955
+ {
7956
+ var overlayItem=item.OverlayIndex[j];
7957
+ if (!IFrameSplitOperator.IsNonEmptyArray(overlayItem.ChartPaint)) continue;
7958
+
7959
+ for(var k=0;k<overlayItem.ChartPaint.length; ++k)
7960
+ {
7961
+ var chart=overlayItem.ChartPaint[k];
7962
+ if (!chart.IsShow) continue;
7963
+ if (chart.IsHideScriptIndex()) continue;
7964
+ if (chart.ClickCell)
7965
+ {
7966
+ result=chart.ClickCell(x,y,e);
7967
+ if (result) return result;
7968
+ }
7969
+ }
7970
+ }
7971
+ }
7972
+
7973
+ return null;
7974
+ }
7975
+
7923
7976
  this.TryMouseMove_CustomChartDrag=function(sendData)
7924
7977
  {
7925
7978
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_MOVE);
@@ -8231,23 +8284,41 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8231
8284
  }, 250);
8232
8285
 
8233
8286
  var bSelectedChartChanged=false;
8234
- if (this.SelectedChart.EnableSelected)
8287
+ var clickCellData=this.TryClickChartCell(x,y,e); //点击图形子元素
8288
+
8289
+ if (clickCellData)
8235
8290
  {
8236
- var selectChart=this.PtInChart(x,y);
8237
- if (selectChart)
8291
+ if (clickCellData.Redraw===true) bRedraw=true;
8292
+ }
8293
+ else
8294
+ {
8295
+ if (this.SelectedChart.EnableSelected) //整体图形选中
8238
8296
  {
8239
- if (this.SelectedChart.Selected.Identify!=selectChart.Identify)
8297
+ var selectChart=this.PtInChart(x,y);
8298
+ if (selectChart)
8240
8299
  {
8241
- this.SelectedChart.Selected.Identify=selectChart.Identify;
8242
- this.SelectedChart.Selected.Chart=selectChart.Chart;
8243
- bSelectedChartChanged=true;
8244
- }
8300
+ if (this.SelectedChart.Selected.Identify!=selectChart.Identify)
8301
+ {
8302
+ this.SelectedChart.Selected.Identify=selectChart.Identify;
8303
+ this.SelectedChart.Selected.Chart=selectChart.Chart;
8304
+ bSelectedChartChanged=true;
8305
+ }
8245
8306
 
8246
- if (this.EnableIndexChartDrag)
8307
+ if (this.EnableIndexChartDrag)
8308
+ {
8309
+ this.IndexChartDrag={ SelectedChart:selectChart, LastMove:{X:x, Y:y}, Click:{X:x, Y:y } };
8310
+ this.IndexChartDrag.Info=this.GetSelectedChartInfo(selectChart);
8311
+ if (this.IndexChartDrag.Info) this.IndexChartDrag.Info.FrameID=this.Frame.PtInFrame(x,y);
8312
+ }
8313
+ }
8314
+ else
8247
8315
  {
8248
- this.IndexChartDrag={ SelectedChart:selectChart, LastMove:{X:x, Y:y}, Click:{X:x, Y:y } };
8249
- this.IndexChartDrag.Info=this.GetSelectedChartInfo(selectChart);
8250
- if (this.IndexChartDrag.Info) this.IndexChartDrag.Info.FrameID=this.Frame.PtInFrame(x,y);
8316
+ if (this.SelectedChart.Selected.Identify)
8317
+ {
8318
+ this.SelectedChart.Selected.Identify=null;
8319
+ this.SelectedChart.Selected.Chart=null;
8320
+ bSelectedChartChanged=true;
8321
+ }
8251
8322
  }
8252
8323
  }
8253
8324
  else
@@ -8255,19 +8326,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8255
8326
  if (this.SelectedChart.Selected.Identify)
8256
8327
  {
8257
8328
  this.SelectedChart.Selected.Identify=null;
8258
- this.SelectedChart.Selected.Chart=null;
8259
8329
  bSelectedChartChanged=true;
8260
8330
  }
8261
8331
  }
8262
8332
  }
8263
- else
8264
- {
8265
- if (this.SelectedChart.Selected.Identify)
8266
- {
8267
- this.SelectedChart.Selected.Identify=null;
8268
- bSelectedChartChanged=true;
8269
- }
8270
- }
8271
8333
 
8272
8334
  if ((drawPictureActive.Select.Guid!=null && this.SelectChartDrawPicture==null) || bSelectedChartChanged)
8273
8335
  {
@@ -11148,8 +11210,18 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11148
11210
  var sendData={ MouseStatus:null, X:x, Y:y, FrameID:frameID, e:e };
11149
11211
  if (this.TryMouseMove_CustomChartDrag(sendData))
11150
11212
  {
11151
- if (sendData.MouseStatus)
11152
- mouseStatus=sendData.MouseStatus;
11213
+ if (sendData.MouseStatus)
11214
+ {
11215
+ if (sendData.MouseStatus.Level==1) //高等级 覆盖状态
11216
+ {
11217
+ mouseStatus=sendData.MouseStatus;
11218
+ }
11219
+ else
11220
+ {
11221
+ if (!mouseStatus) mouseStatus=sendData.MouseStatus;
11222
+ }
11223
+ }
11224
+
11153
11225
  }
11154
11226
 
11155
11227
  var bDrawPicture=false; //是否正在画图
@@ -14113,6 +14185,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
14113
14185
  frame.Canvas=this.Canvas;
14114
14186
  frame.MainFrame=subFrame.Frame;
14115
14187
  frame.ChartBorder=subFrame.Frame.ChartBorder;
14188
+ frame.GlobalOption=this.GlobalOption;
14116
14189
  if (findOverlayItem) frame.IsShow=findOverlayItem.Frame.IsShow;
14117
14190
  //if (obj.IsShareY===true) frame.IsShareY=true;
14118
14191
  frame.YSplitOperator=new FrameSplitY();
@@ -29581,6 +29654,59 @@ function IChartPainting()
29581
29654
  else return item.Date;
29582
29655
  }
29583
29656
 
29657
+ //保存图形状态
29658
+ this.SaveCacheData=function(name, value)
29659
+ {
29660
+ if (!this.ChartFrame || !this.ChartFrame.GlobalOption) return false;
29661
+ var mapIndexCache=this.ChartFrame.GlobalOption.MapIndexChartCache;
29662
+ if (!mapIndexCache) return false;
29663
+
29664
+ if (!this.Script || !this.Script.Guid) return false;
29665
+ if (!this.Name) return false;
29666
+
29667
+ var id=this.Script.Guid; //指标ID;
29668
+ if (!mapIndexCache.has(id))
29669
+ {
29670
+ mapIndexCache.set(id, { MapData:new Map() });
29671
+ }
29672
+
29673
+ var mapItem=mapIndexCache.get(id);
29674
+ var key=`${this.Name}-${name}`;
29675
+ mapItem.MapData.set(key, value);
29676
+
29677
+ return true;
29678
+ }
29679
+
29680
+ //获取缓存数据 返回数据 out:{ Data, Key, IndexGuid }
29681
+ this.GetCacheData=function(name, out)
29682
+ {
29683
+ if (!this.ChartFrame || !this.ChartFrame.GlobalOption) return false;
29684
+ var mapIndexCache=this.ChartFrame.GlobalOption.MapIndexChartCache;
29685
+ if (!mapIndexCache) return false;
29686
+
29687
+ if (!this.Script || !this.Script.Guid) return false;
29688
+ if (!this.Name) return false;
29689
+
29690
+ var id=this.Script.Guid; //指标ID;
29691
+ if (!mapIndexCache.has(id)) return false;
29692
+
29693
+ var mapItem=mapIndexCache.get(id);
29694
+ var key=`${this.Name}-${name}`;
29695
+
29696
+ if (!mapItem.MapData.has(key)) return false;
29697
+
29698
+ var value=mapItem.MapData.get(key);
29699
+ if (out)
29700
+ {
29701
+ out.Data=value;
29702
+ out.Key=key;
29703
+ out.IndexGuid=id;
29704
+ }
29705
+
29706
+ return true;
29707
+ }
29708
+
29709
+
29584
29710
  //数据导出 数据格式 [{ Title:数据名称, Data:[] }]
29585
29711
  //this.ExportData=function(aryKData) { }
29586
29712
 
@@ -30294,6 +30420,12 @@ function IChartPainting()
30294
30420
  }
30295
30421
  }
30296
30422
 
30423
+ //缓存键值
30424
+ IChartPainting.CACHE_KEY=
30425
+ {
30426
+ SELECTED:"_Selected_Key_", //图形元素选中(单选)
30427
+ }
30428
+
30297
30429
 
30298
30430
  //缩放因子
30299
30431
  /*
@@ -36699,7 +36831,7 @@ function ChartKLineTable()
36699
36831
  this.newMethod();
36700
36832
  delete this.newMethod;
36701
36833
 
36702
- this.ClassName='ChartKlineTable'; //类名
36834
+ this.ClassName='ChartKLineTable'; //类名
36703
36835
  this.Data;
36704
36836
  this.RowName;
36705
36837
  this.RowNamePosition=1; //0=不显示 1=左边内部 2=左边外部 3=右边外部
@@ -48096,8 +48228,11 @@ function ChartDrawSVG()
48096
48228
  this.BuildKeyCallback=null;
48097
48229
  this.MapCache=null; //key=date/date-time value={ Data:[] }
48098
48230
 
48099
- this.AryDrawDetail=[]; //需要绘制的文字信息
48100
- this.EnalbeDetailNoOverlap=false; //详情重叠不显示
48231
+ this.AryDrawDetail=[]; //需要绘制的文字信息
48232
+ this.EnalbeDetailNoOverlap=false; //详情重叠不显示
48233
+ this.EnableClick=false; //是否支持点击
48234
+ this.PixelRatio=GetDevicePixelRatio();
48235
+ this.SelectedItemCache=null;
48101
48236
 
48102
48237
  this.BuildKey=function(item)
48103
48238
  {
@@ -48135,6 +48270,7 @@ function ChartDrawSVG()
48135
48270
  this.AryDrawRect=[];
48136
48271
  this.AryDrawDetail=[];
48137
48272
  this.AutoYOffset=0;
48273
+ this.SelectedItemCache=null;
48138
48274
 
48139
48275
  if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
48140
48276
  if (this.IsShowIndexTitleOnly()) return;
@@ -48145,13 +48281,17 @@ function ChartDrawSVG()
48145
48281
 
48146
48282
  if (this.EnalbeDetailNoOverlap) this.DrawOnVerlapDetail();
48147
48283
 
48284
+ this.DrawSelectedItem();
48285
+
48148
48286
  this.AryDrawDetail=[];
48287
+ this.SelectedItemCache=null;
48149
48288
  }
48150
48289
 
48151
48290
  this.DrawDetail=function(rtSVG, data, svgItem)
48152
48291
  {
48153
48292
  if (!IFrameSplitOperator.IsNonEmptyArray(data.Content)) return;
48154
48293
 
48294
+ var bSelected=this.IsSelectedItem(svgItem); //是否是选中点
48155
48295
  var lefMargin=2;
48156
48296
  var rightMargin=2;
48157
48297
  var itemSpace=2;
@@ -48212,13 +48352,15 @@ function ChartDrawSVG()
48212
48352
  }
48213
48353
  }
48214
48354
 
48355
+ if (bSelected) this.SelectedItemCache.Detail={ AryText:aryText, Rect:rtBorder, Data:svgItem };
48356
+
48215
48357
  if (this.EnalbeDetailNoOverlap) //启动重叠不会 先不画只计算位置, 后面统一画
48216
48358
  {
48217
48359
  this.AryDrawDetail.push({ Rect:rtBorder, AryText:aryText, Data:svgItem });
48218
48360
  return;
48219
48361
  }
48220
48362
 
48221
- this.DrawDetailText(data,aryText,rtBorder);
48363
+ if (!bSelected) this.DrawDetailText(data,aryText,rtBorder);
48222
48364
 
48223
48365
  this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:svgItem } );
48224
48366
  }
@@ -48265,7 +48407,9 @@ function ChartDrawSVG()
48265
48407
 
48266
48408
  if (this.IsRectOverlap(rtBorder)) continue;
48267
48409
 
48268
- this.DrawDetailText(drawItem.Data.Detail, drawItem.AryText, rtBorder);
48410
+ var bSelected=this.IsSelectedItem(drawItem.Data); //是否是选中点
48411
+
48412
+ if (!bSelected) this.DrawDetailText(drawItem.Data.Detail, drawItem.AryText, rtBorder);
48269
48413
 
48270
48414
  this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:drawItem.Data } );
48271
48415
  }
@@ -48430,6 +48574,12 @@ function ChartDrawSVG()
48430
48574
  }
48431
48575
  }
48432
48576
 
48577
+ this.IsSelectedItem=function(item)
48578
+ {
48579
+ if (!this.SelectedItemCache) return false;
48580
+ return this.SelectedItemCache.ID==item.ID;
48581
+ }
48582
+
48433
48583
  this.DrawSVGV2=function()
48434
48584
  {
48435
48585
  if (!this.IsShow || this.ChartFrame.IsMinSize) return;
@@ -48445,7 +48595,7 @@ function ChartDrawSVG()
48445
48595
  var distanceWidth=this.ChartFrame.DistanceWidth;
48446
48596
  var isMinute=this.IsMinuteFrame();
48447
48597
  var border=this.GetBorder();
48448
- var pixelRatio = GetDevicePixelRatio();
48598
+ this.PixelRatio=GetDevicePixelRatio();
48449
48599
 
48450
48600
  if (this.IsHScreen)
48451
48601
  {
@@ -48460,7 +48610,11 @@ function ChartDrawSVG()
48460
48610
  var bottom=border.BottomEx;
48461
48611
  }
48462
48612
 
48463
- var x,y,price;
48613
+ var selectedData={ };
48614
+ if (this.GetCacheData(IChartPainting.CACHE_KEY.SELECTED, selectedData)) //选中图标
48615
+ this.SelectedItemCache={ ID:selectedData.Data.ID };
48616
+
48617
+ var x;
48464
48618
  var setKey=new Set(); //已经画过的Key就不再用了
48465
48619
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
48466
48620
  {
@@ -48487,147 +48641,200 @@ function ChartDrawSVG()
48487
48641
  {
48488
48642
  var item=mapItem.Data[k];
48489
48643
 
48490
- if (item.Value=="Top") y=top;
48491
- else if (item.Value=="Bottom") y=bottom;
48492
- else
48644
+ if (this.IsSelectedItem(item))
48493
48645
  {
48494
- if (IFrameSplitOperator.IsString(item.Value)) price=this.GetKValue(kItem,item.Value);
48495
- else price=item.Value;
48496
-
48497
- y=this.ChartFrame.GetYFromData(price, false);
48646
+ this.SelectedItemCache.Item=item;
48647
+ this.SelectedItemCache.KItem=kItem;
48648
+ this.SelectedItemCache.Index=i;
48649
+ this.SelectedItemCache.X=x;
48650
+ this.SelectedItemCache.Top=top;
48651
+ this.SelectedItemCache.Bottom=bottom;
48498
48652
  }
48499
- if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
48500
48653
 
48501
- var svgItem=item.SVG;
48502
- if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
48654
+ this.DrawSVGItem(item, kItem, i, x, top, bottom);
48655
+ }
48503
48656
 
48504
- if (this.AutoPosition)
48505
- {
48506
- var pt={ X:x, Y:y };
48507
- this.CalculateShowPosition(item, pt); //重新计算位置
48508
- x=pt.X;
48509
- y=pt.Y;
48510
- }
48657
+ setKey.add(key);
48658
+ }
48659
+ }
48511
48660
 
48512
- var fontSVG=`${svgItem.Size}px ${this.Family}`;
48513
- this.Canvas.font=fontSVG;
48514
- var halfSize=svgItem.Size/2;
48515
- var textBaseline='bottom';
48516
- var rtSVG={ Left:x-halfSize, Right:x+halfSize, Top:y-svgItem.Size, Bottom:y, Height:svgItem.Size, Width:svgItem.Size };
48517
- if (svgItem.VAlign===0)
48518
- {
48519
- textBaseline="top";
48520
- rtSVG.Top=y;
48521
- rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48522
- }
48523
- else if (svgItem.VAlign===1)
48524
- {
48525
- textBaseline='middle';
48526
- rtSVG.Top=y-svgItem.Size/2;
48527
- rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48528
- }
48529
48661
 
48530
- if (rtSVG.Top<0)
48531
- {
48532
- rtSVG.Top=0;
48533
- rtSVG.Bottom=svgItem.Size;
48534
- y=rtSVG.Bottom;
48535
- }
48662
+ this.GetYFromData=function(value, kItem, top, bottom)
48663
+ {
48664
+ if (value=="Top") return top;
48665
+ if (value=="Bottom") return bottom;
48666
+
48667
+ var price;
48668
+ if (IFrameSplitOperator.IsString(value)) price=this.GetKValue(kItem,value);
48669
+ else price=value;
48536
48670
 
48537
- this.Canvas.textBaseline=textBaseline;
48538
- this.Canvas.textAlign='center';
48539
- this.Canvas.fillStyle = svgItem.Color;
48540
- this.Canvas.fillText(svgItem.Symbol, x, y);
48671
+ var y=this.ChartFrame.GetYFromData(price, false);
48541
48672
 
48542
- this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
48673
+ return y;
48674
+ }
48543
48675
 
48544
- if (this.EnableTooltip) this.TooltipRect.push({ Rect:rtSVG, Index:i, Item:item });
48676
+ this.DrawSVGItem=function(item, kItem, index, x, top, bottom)
48677
+ {
48678
+ var y=this.GetYFromData(item.Value, kItem, top, bottom);
48679
+ if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
48545
48680
 
48546
- //文字
48547
- if (item.Text && item.Text.Content && this.TextFont)
48548
- {
48549
- var textItem=item.Text;
48550
- this.Canvas.font=this.TextFont;
48551
- this.Canvas.fillStyle=textItem.Color;
48552
- var yText=y;
48553
- if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
48554
- this.Canvas.fillText(textItem.Content, x, yText);
48555
- }
48681
+ var svgItem=item.SVG;
48682
+ if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
48556
48683
 
48557
- if (item.Detail)
48558
- {
48559
- this.DrawDetail(rtSVG,item.Detail, item);
48560
- }
48561
-
48562
- //连线
48563
- if (item.Line)
48564
- {
48565
- var lineItem=item.Line;
48566
- var price=null, yPrice=null;
48567
- if (lineItem.Value=="Bottom")
48568
- {
48569
- yPrice=bottom;
48570
- }
48571
- else if (lineItem.Value=="Top")
48572
- {
48573
- yPrice=top;
48574
- }
48575
- else
48576
- {
48577
- if (IFrameSplitOperator.IsString(lineItem.Value)) price=this.GetKValue(kItem,lineItem.Value);
48578
- else if (IFrameSplitOperator.IsNumber(lineItem.Value)) price=lineItem.Value;
48684
+ if (this.AutoPosition)
48685
+ {
48686
+ var pt={ X:x, Y:y };
48687
+ this.CalculateShowPosition(item, pt); //重新计算位置
48688
+ x=pt.X;
48689
+ y=pt.Y;
48690
+ }
48579
48691
 
48580
- if (!IFrameSplitOperator.IsNumber(price)) continue;
48581
- yPrice=this.ChartFrame.GetYFromData(price);
48582
- }
48583
-
48584
- if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) continue;
48692
+ var bSelected=this.IsSelectedItem(item); //是否是选中点
48585
48693
 
48586
- var yText;
48587
- if (yPrice<rtSVG.Top)
48588
- {
48589
- yText=rtSVG.Top;
48590
- if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48591
- {
48592
- //yPrice+=lineItem.Blank;
48593
- yText-=lineItem.SVGBlank;
48594
- }
48595
- }
48596
- else
48597
- {
48598
- yText=rtSVG.Bottom;
48599
- if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48600
- {
48601
- //yPrice-=lineItem.Blank;
48602
- yText+=lineItem.SVGBlank;
48603
- }
48604
- }
48694
+ var fontSVG=`${svgItem.Size}px ${this.Family}`;
48695
+ this.Canvas.font=fontSVG;
48696
+ var halfSize=svgItem.Size/2;
48697
+ var textBaseline='bottom';
48698
+ var rtSVG={ Left:x-halfSize, Right:x+halfSize, Top:y-svgItem.Size, Bottom:y, Height:svgItem.Size, Width:svgItem.Size };
48699
+ if (svgItem.VAlign===0)
48700
+ {
48701
+ textBaseline="top";
48702
+ rtSVG.Top=y;
48703
+ rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48704
+ }
48705
+ else if (svgItem.VAlign===1)
48706
+ {
48707
+ textBaseline='middle';
48708
+ rtSVG.Top=y-svgItem.Size/2;
48709
+ rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48710
+ }
48605
48711
 
48606
- if (lineItem.Dash) this.Canvas.setLineDash(lineItem.Dash); //虚线
48607
- var lineWidth=1*pixelRatio;
48608
- if (lineItem.Width>0) lineWidth=lineItem.Width*pixelRatio;
48609
- this.Canvas.lineWidth=lineWidth; //线宽
48610
- this.Canvas.strokeStyle = lineItem.Color;
48611
- this.Canvas.beginPath();
48712
+ if (rtSVG.Top<0)
48713
+ {
48714
+ rtSVG.Top=0;
48715
+ rtSVG.Bottom=svgItem.Size;
48716
+ y=rtSVG.Bottom;
48717
+ }
48612
48718
 
48613
- if (this.IsHScreen)
48614
- {
48615
- this.Canvas.moveTo(yText, ToFixedPoint(x));
48616
- this.Canvas.lineTo(yPrice,ToFixedPoint(x));
48617
- }
48618
- else
48619
- {
48620
- this.Canvas.moveTo(ToFixedPoint2(lineWidth,x),yText);
48621
- this.Canvas.lineTo(ToFixedPoint2(lineWidth,x),yPrice);
48622
- }
48623
-
48624
- this.Canvas.stroke();
48625
- this.Canvas.setLineDash([]);
48626
- }
48719
+ if (!bSelected)
48720
+ {
48721
+ this.Canvas.textBaseline=textBaseline;
48722
+ this.Canvas.textAlign='center';
48723
+ this.Canvas.fillStyle = svgItem.Color;
48724
+ this.Canvas.fillText(svgItem.Symbol, x, y);
48725
+ }
48726
+ else
48727
+ {
48728
+ this.SelectedItemCache.RectSVG=rtSVG; //保存图标的位置
48729
+ this.SelectedItemCache.SVGConfig={ Font:fontSVG, TextBaseline:textBaseline, X:x, Y:y };
48730
+ }
48731
+
48732
+ this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
48733
+
48734
+ if (this.EnableTooltip) this.TooltipRect.push({ Rect:rtSVG, Index:index, Item:item });
48735
+
48736
+ //图标内的文字
48737
+ if (!bSelected && item.Text && item.Text.Content && this.TextFont)
48738
+ {
48739
+ var textItem=item.Text;
48740
+ this.Canvas.font=this.TextFont;
48741
+ this.Canvas.fillStyle=textItem.Color;
48742
+ var yText=y;
48743
+ if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
48744
+ this.Canvas.fillText(textItem.Content, x, yText);
48745
+ }
48746
+
48747
+ //图标左右两边文字
48748
+ if (item.Detail) this.DrawDetail(rtSVG, item.Detail, item);
48749
+
48750
+ //连线
48751
+ if (!bSelected && item.Line) this.DrawVerticalLine(item,kItem,x, rtSVG, top, bottom);
48752
+ }
48753
+
48754
+ //绘制垂直连线
48755
+ this.DrawVerticalLine=function(item, kItem, x, rtSVG, top, bottom)
48756
+ {
48757
+ if (!item.Line) return;
48758
+
48759
+ var lineItem=item.Line;
48760
+ var yPrice=this.GetYFromData(lineItem.Value, kItem, top, bottom)
48761
+ if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) return;
48762
+
48763
+ var yText;
48764
+ if (yPrice<rtSVG.Top)
48765
+ {
48766
+ yText=rtSVG.Top;
48767
+ if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48768
+ {
48769
+ //yPrice+=lineItem.Blank;
48770
+ yText-=lineItem.SVGBlank;
48627
48771
  }
48772
+ }
48773
+ else
48774
+ {
48775
+ yText=rtSVG.Bottom;
48776
+ if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48777
+ {
48778
+ //yPrice-=lineItem.Blank;
48779
+ yText+=lineItem.SVGBlank;
48780
+ }
48781
+ }
48628
48782
 
48629
- setKey.add(key);
48783
+ if (lineItem.Dash) this.Canvas.setLineDash(lineItem.Dash); //虚线
48784
+ var lineWidth=1*this.PixelRatio;
48785
+ if (lineItem.Width>0) lineWidth=lineItem.Width*this.PixelRatio;
48786
+ this.Canvas.lineWidth=lineWidth; //线宽
48787
+ this.Canvas.strokeStyle = lineItem.Color;
48788
+ this.Canvas.beginPath();
48789
+
48790
+ if (this.IsHScreen)
48791
+ {
48792
+ this.Canvas.moveTo(yText, ToFixedPoint(x));
48793
+ this.Canvas.lineTo(yPrice,ToFixedPoint(x));
48794
+ }
48795
+ else
48796
+ {
48797
+ this.Canvas.moveTo(ToFixedPoint2(lineWidth,x),yText);
48798
+ this.Canvas.lineTo(ToFixedPoint2(lineWidth,x),yPrice);
48630
48799
  }
48800
+
48801
+ this.Canvas.stroke();
48802
+ this.Canvas.setLineDash([]);
48803
+ }
48804
+
48805
+ this.DrawSelectedItem=function()
48806
+ {
48807
+ if (!this.SelectedItemCache || !this.SelectedItemCache.Item) return;
48808
+
48809
+ var selecteItem=this.SelectedItemCache;
48810
+ var item=selecteItem.Item;
48811
+ var kItem=selecteItem.KItem;
48812
+ var top=selecteItem.Top;
48813
+ var bottom=selecteItem.Bottom;
48814
+ var rtSVG=selecteItem.RectSVG;
48815
+ var svgItem=item.SVG;
48816
+ var config=selecteItem.SVGConfig;
48817
+
48818
+ var x=config.X, y=config.Y;
48819
+ this.Canvas.font=config.Font;
48820
+ this.Canvas.textBaseline=config.TextBaseline;
48821
+ this.Canvas.textAlign='center';
48822
+ this.Canvas.fillStyle = svgItem.Color;
48823
+ this.Canvas.fillText(svgItem.Symbol, config.X, config.Y);
48824
+
48825
+ if (item.Text && item.Text.Content && this.TextFont)
48826
+ {
48827
+ var textItem=item.Text;
48828
+ this.Canvas.font=this.TextFont;
48829
+ this.Canvas.fillStyle=textItem.Color;
48830
+ var yText=y;
48831
+ if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
48832
+ this.Canvas.fillText(textItem.Content, x, yText);
48833
+ }
48834
+
48835
+ if (item.Line) this.DrawVerticalLine(item, kItem, x, rtSVG, top, bottom);
48836
+
48837
+ if (selecteItem.Detail) this.DrawDetailText(selecteItem.Item.Detail, selecteItem.Detail.AryText, selecteItem.Detail.Rect);
48631
48838
  }
48632
48839
 
48633
48840
  this.GetMaxMin=function()
@@ -48666,8 +48873,9 @@ function ChartDrawSVG()
48666
48873
  this.GetTooltipData=function(x,y,tooltip)
48667
48874
  {
48668
48875
  if (!this.IsShow) return false;
48876
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipRect)) return;
48669
48877
 
48670
- for(var i=0;i<this.TooltipRect.length;++i)
48878
+ for(var i=this.TooltipRect.length-1; i>=0; --i)
48671
48879
  {
48672
48880
  var item=this.TooltipRect[i];
48673
48881
  if (!item.Rect) continue;
@@ -48687,6 +48895,38 @@ function ChartDrawSVG()
48687
48895
 
48688
48896
  return false;
48689
48897
  }
48898
+
48899
+ this.ClickCell=function(x,y,e)
48900
+ {
48901
+ if (!this.IsShow) return null;
48902
+ if (!this.EnableClick) return null;
48903
+
48904
+ for(var i=this.TooltipRect.length-1; i>=0; --i)
48905
+ {
48906
+ var item=this.TooltipRect[i];
48907
+ if (!item.Rect) continue;
48908
+
48909
+ var rect=item.Rect;
48910
+ if (x>=rect.Left && x<=rect.Right && y>=rect.Top && y<=rect.Bottom)
48911
+ {
48912
+ var svgItem=item.Item;
48913
+ var id=svgItem.ID;
48914
+ var result={ Data:svgItem, Redraw:false, ChartPaint:this };
48915
+ var oldSelectedID=null;
48916
+ var out={ };
48917
+ if (this.GetCacheData(IChartPainting.CACHE_KEY.SELECTED, out)) oldSelectedID=out.Data.ID;
48918
+ if (id!=oldSelectedID)
48919
+ {
48920
+ this.SaveCacheData(IChartPainting.CACHE_KEY.SELECTED, { ID:id } );
48921
+ result.Redraw=true;
48922
+ }
48923
+
48924
+ return result;
48925
+ }
48926
+ }
48927
+
48928
+ return null;
48929
+ }
48690
48930
  }
48691
48931
 
48692
48932
  // OX图 支持横屏
@@ -85356,6 +85596,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85356
85596
  frame.Canvas=this.Canvas;
85357
85597
  frame.MainFrame=subFrame.Frame;
85358
85598
  frame.ChartBorder=subFrame.Frame.ChartBorder;
85599
+ frame.GlobalOption=this.GlobalOption;
85359
85600
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
85360
85601
  if (obj.ShowRightText===true) frame.IsShow=true;
85361
85602
  else if (obj.ShowRightText===false) frame.IsShow=false;
@@ -126539,6 +126780,8 @@ function ScriptIndex(name,script,args,option)
126539
126780
  if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.EnableTooltip)) chart.EnableTooltip=varItem.Draw.DrawData.EnableTooltip;
126540
126781
  if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.IsDrawFirst)) chart.IsDrawFirst=varItem.Draw.DrawData.IsDrawFirst;
126541
126782
  if (IFrameSplitOperator.IsBool(varItem.Draw.EnalbeDetailNoOverlap)) chart.EnalbeDetailNoOverlap=varItem.Draw.EnalbeDetailNoOverlap;
126783
+ if (IFrameSplitOperator.IsBool(varItem.Draw.EnableClick)) chart.EnableClick=varItem.Draw.EnableClick;
126784
+
126542
126785
  if (varItem.Draw.BuildKeyCallback) chart.BuildKeyCallback=varItem.Draw.BuildKeyCallback;
126543
126786
  chart.Family=varItem.Draw.DrawData.Family;
126544
126787
  chart.TextFont=varItem.Draw.DrawData.TextFont;
@@ -126630,6 +126873,7 @@ function ScriptIndex(name,script,args,option)
126630
126873
  }
126631
126874
 
126632
126875
  chart.BuildCacheData();
126876
+ this.SetChartIndexName(chart);
126633
126877
  hqChart.ChartPaint.push(chart);
126634
126878
 
126635
126879
  var titleIndex=windowIndex+1;
@@ -126678,7 +126922,7 @@ function ScriptIndex(name,script,args,option)
126678
126922
  }
126679
126923
 
126680
126924
  chart.BuildCacheData();
126681
-
126925
+ this.SetChartIndexName(chart);
126682
126926
  hqChart.ChartPaint.push(chart);
126683
126927
  }
126684
126928
 
@@ -128451,6 +128695,7 @@ function OverlayScriptIndex(name,script,args,option)
128451
128695
  chart.Texts= varItem.Draw.DrawData.Data;
128452
128696
  if (varItem.Draw.AutoPosition) chart.AutoPosition=varItem.Draw.AutoPosition;
128453
128697
  if (IFrameSplitOperator.IsBool(varItem.Draw.EnalbeDetailNoOverlap)) chart.EnalbeDetailNoOverlap=varItem.Draw.EnalbeDetailNoOverlap;
128698
+ if (IFrameSplitOperator.IsBool(varItem.Draw.EnableClick)) chart.EnableClick=varItem.Draw.EnableClick;
128454
128699
 
128455
128700
  this.ReloadChartResource(hqChart, windowIndex, chart);
128456
128701
 
@@ -129658,6 +129903,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
129658
129903
  drawItem.DrawType=draw.DrawType;
129659
129904
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
129660
129905
  drawItem.EnalbeDetailNoOverlap=draw.EnalbeDetailNoOverlap;
129906
+ drawItem.EnableClick=draw.EnableClick;
129661
129907
  if (draw.BuildKeyCallback) drawItem.BuildKeyCallback=draw.BuildKeyCallback;
129662
129908
  drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont, EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
129663
129909
  outVarItem.Draw=drawItem;
@@ -130167,6 +130413,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
130167
130413
  drawItem.DrawType=draw.DrawType;
130168
130414
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
130169
130415
  drawItem.EnalbeDetailNoOverlap=draw.EnalbeDetailNoOverlap;
130416
+ drawItem.EnableClick=draw.EnableClick;
130170
130417
  if (draw.BuildKeyCallback) drawItem.BuildKeyCallback=draw.BuildKeyCallback;
130171
130418
  drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont , EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
130172
130419
  outVarItem.Draw=drawItem;
@@ -146551,7 +146798,7 @@ function ScrollBarBGChart()
146551
146798
 
146552
146799
 
146553
146800
 
146554
- var HQCHART_VERSION="1.1.14642";
146801
+ var HQCHART_VERSION="1.1.14650";
146555
146802
 
146556
146803
  function PrintHQChartVersion()
146557
146804
  {