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.
@@ -7287,7 +7287,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7287
7287
  },
7288
7288
 
7289
7289
  //锁十字光标
7290
- LockCorssCursor:{ X:{ Enable:false } }
7290
+ LockCorssCursor:{ X:{ Enable:false } },
7291
+
7292
+ //图形中的单元选中状态
7293
+ MapIndexChartCache:new Map(), //key 指标GUID
7291
7294
  };
7292
7295
 
7293
7296
  this.VerticalDrag; //通过X轴左右拖动数据(手势才有)
@@ -7964,6 +7967,56 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7964
7967
  return false;
7965
7968
  }
7966
7969
 
7970
+ //点击图新内部元素
7971
+ this.TryClickChartCell=function(x, y, e)
7972
+ {
7973
+ var result=null;
7974
+ for(var i=0;i<this.ChartPaint.length;++i)
7975
+ {
7976
+ var item=this.ChartPaint[i];
7977
+ if (!item.ClickCell) continue;
7978
+ if (item.IsHideScriptIndex()) continue;
7979
+
7980
+ result=item.ClickCell(x,y,e);
7981
+ if (result) return result;
7982
+ }
7983
+
7984
+ for(var i=0;i<this.OverlayChartPaint.length;++i)
7985
+ {
7986
+ var item=this.OverlayChartPaint[i];
7987
+ if (!item.ClickCell) continue;
7988
+
7989
+ result=item.ClickCell(x,y,e);
7990
+ if (result) return result;
7991
+ }
7992
+
7993
+ for(var i=0,j=0,k=0;i<this.Frame.SubFrame.length;++i)
7994
+ {
7995
+ var item=this.Frame.SubFrame[i];
7996
+ if (!IFrameSplitOperator.IsNonEmptyArray(item.OverlayIndex)) continue;
7997
+
7998
+ for(j=0;j<item.OverlayIndex.length;++j)
7999
+ {
8000
+ var overlayItem=item.OverlayIndex[j];
8001
+ if (!IFrameSplitOperator.IsNonEmptyArray(overlayItem.ChartPaint)) continue;
8002
+
8003
+ for(var k=0;k<overlayItem.ChartPaint.length; ++k)
8004
+ {
8005
+ var chart=overlayItem.ChartPaint[k];
8006
+ if (!chart.IsShow) continue;
8007
+ if (chart.IsHideScriptIndex()) continue;
8008
+ if (chart.ClickCell)
8009
+ {
8010
+ result=chart.ClickCell(x,y,e);
8011
+ if (result) return result;
8012
+ }
8013
+ }
8014
+ }
8015
+ }
8016
+
8017
+ return null;
8018
+ }
8019
+
7967
8020
  this.TryMouseMove_CustomChartDrag=function(sendData)
7968
8021
  {
7969
8022
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_MOVE);
@@ -8275,23 +8328,41 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8275
8328
  }, 250);
8276
8329
 
8277
8330
  var bSelectedChartChanged=false;
8278
- if (this.SelectedChart.EnableSelected)
8331
+ var clickCellData=this.TryClickChartCell(x,y,e); //点击图形子元素
8332
+
8333
+ if (clickCellData)
8279
8334
  {
8280
- var selectChart=this.PtInChart(x,y);
8281
- if (selectChart)
8335
+ if (clickCellData.Redraw===true) bRedraw=true;
8336
+ }
8337
+ else
8338
+ {
8339
+ if (this.SelectedChart.EnableSelected) //整体图形选中
8282
8340
  {
8283
- if (this.SelectedChart.Selected.Identify!=selectChart.Identify)
8341
+ var selectChart=this.PtInChart(x,y);
8342
+ if (selectChart)
8284
8343
  {
8285
- this.SelectedChart.Selected.Identify=selectChart.Identify;
8286
- this.SelectedChart.Selected.Chart=selectChart.Chart;
8287
- bSelectedChartChanged=true;
8288
- }
8344
+ if (this.SelectedChart.Selected.Identify!=selectChart.Identify)
8345
+ {
8346
+ this.SelectedChart.Selected.Identify=selectChart.Identify;
8347
+ this.SelectedChart.Selected.Chart=selectChart.Chart;
8348
+ bSelectedChartChanged=true;
8349
+ }
8289
8350
 
8290
- if (this.EnableIndexChartDrag)
8351
+ if (this.EnableIndexChartDrag)
8352
+ {
8353
+ this.IndexChartDrag={ SelectedChart:selectChart, LastMove:{X:x, Y:y}, Click:{X:x, Y:y } };
8354
+ this.IndexChartDrag.Info=this.GetSelectedChartInfo(selectChart);
8355
+ if (this.IndexChartDrag.Info) this.IndexChartDrag.Info.FrameID=this.Frame.PtInFrame(x,y);
8356
+ }
8357
+ }
8358
+ else
8291
8359
  {
8292
- this.IndexChartDrag={ SelectedChart:selectChart, LastMove:{X:x, Y:y}, Click:{X:x, Y:y } };
8293
- this.IndexChartDrag.Info=this.GetSelectedChartInfo(selectChart);
8294
- if (this.IndexChartDrag.Info) this.IndexChartDrag.Info.FrameID=this.Frame.PtInFrame(x,y);
8360
+ if (this.SelectedChart.Selected.Identify)
8361
+ {
8362
+ this.SelectedChart.Selected.Identify=null;
8363
+ this.SelectedChart.Selected.Chart=null;
8364
+ bSelectedChartChanged=true;
8365
+ }
8295
8366
  }
8296
8367
  }
8297
8368
  else
@@ -8299,19 +8370,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8299
8370
  if (this.SelectedChart.Selected.Identify)
8300
8371
  {
8301
8372
  this.SelectedChart.Selected.Identify=null;
8302
- this.SelectedChart.Selected.Chart=null;
8303
8373
  bSelectedChartChanged=true;
8304
8374
  }
8305
8375
  }
8306
8376
  }
8307
- else
8308
- {
8309
- if (this.SelectedChart.Selected.Identify)
8310
- {
8311
- this.SelectedChart.Selected.Identify=null;
8312
- bSelectedChartChanged=true;
8313
- }
8314
- }
8315
8377
 
8316
8378
  if ((drawPictureActive.Select.Guid!=null && this.SelectChartDrawPicture==null) || bSelectedChartChanged)
8317
8379
  {
@@ -11192,8 +11254,18 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11192
11254
  var sendData={ MouseStatus:null, X:x, Y:y, FrameID:frameID, e:e };
11193
11255
  if (this.TryMouseMove_CustomChartDrag(sendData))
11194
11256
  {
11195
- if (sendData.MouseStatus)
11196
- mouseStatus=sendData.MouseStatus;
11257
+ if (sendData.MouseStatus)
11258
+ {
11259
+ if (sendData.MouseStatus.Level==1) //高等级 覆盖状态
11260
+ {
11261
+ mouseStatus=sendData.MouseStatus;
11262
+ }
11263
+ else
11264
+ {
11265
+ if (!mouseStatus) mouseStatus=sendData.MouseStatus;
11266
+ }
11267
+ }
11268
+
11197
11269
  }
11198
11270
 
11199
11271
  var bDrawPicture=false; //是否正在画图
@@ -14157,6 +14229,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
14157
14229
  frame.Canvas=this.Canvas;
14158
14230
  frame.MainFrame=subFrame.Frame;
14159
14231
  frame.ChartBorder=subFrame.Frame.ChartBorder;
14232
+ frame.GlobalOption=this.GlobalOption;
14160
14233
  if (findOverlayItem) frame.IsShow=findOverlayItem.Frame.IsShow;
14161
14234
  //if (obj.IsShareY===true) frame.IsShareY=true;
14162
14235
  frame.YSplitOperator=new FrameSplitY();
@@ -29625,6 +29698,59 @@ function IChartPainting()
29625
29698
  else return item.Date;
29626
29699
  }
29627
29700
 
29701
+ //保存图形状态
29702
+ this.SaveCacheData=function(name, value)
29703
+ {
29704
+ if (!this.ChartFrame || !this.ChartFrame.GlobalOption) return false;
29705
+ var mapIndexCache=this.ChartFrame.GlobalOption.MapIndexChartCache;
29706
+ if (!mapIndexCache) return false;
29707
+
29708
+ if (!this.Script || !this.Script.Guid) return false;
29709
+ if (!this.Name) return false;
29710
+
29711
+ var id=this.Script.Guid; //指标ID;
29712
+ if (!mapIndexCache.has(id))
29713
+ {
29714
+ mapIndexCache.set(id, { MapData:new Map() });
29715
+ }
29716
+
29717
+ var mapItem=mapIndexCache.get(id);
29718
+ var key=`${this.Name}-${name}`;
29719
+ mapItem.MapData.set(key, value);
29720
+
29721
+ return true;
29722
+ }
29723
+
29724
+ //获取缓存数据 返回数据 out:{ Data, Key, IndexGuid }
29725
+ this.GetCacheData=function(name, out)
29726
+ {
29727
+ if (!this.ChartFrame || !this.ChartFrame.GlobalOption) return false;
29728
+ var mapIndexCache=this.ChartFrame.GlobalOption.MapIndexChartCache;
29729
+ if (!mapIndexCache) return false;
29730
+
29731
+ if (!this.Script || !this.Script.Guid) return false;
29732
+ if (!this.Name) return false;
29733
+
29734
+ var id=this.Script.Guid; //指标ID;
29735
+ if (!mapIndexCache.has(id)) return false;
29736
+
29737
+ var mapItem=mapIndexCache.get(id);
29738
+ var key=`${this.Name}-${name}`;
29739
+
29740
+ if (!mapItem.MapData.has(key)) return false;
29741
+
29742
+ var value=mapItem.MapData.get(key);
29743
+ if (out)
29744
+ {
29745
+ out.Data=value;
29746
+ out.Key=key;
29747
+ out.IndexGuid=id;
29748
+ }
29749
+
29750
+ return true;
29751
+ }
29752
+
29753
+
29628
29754
  //数据导出 数据格式 [{ Title:数据名称, Data:[] }]
29629
29755
  //this.ExportData=function(aryKData) { }
29630
29756
 
@@ -30338,6 +30464,12 @@ function IChartPainting()
30338
30464
  }
30339
30465
  }
30340
30466
 
30467
+ //缓存键值
30468
+ IChartPainting.CACHE_KEY=
30469
+ {
30470
+ SELECTED:"_Selected_Key_", //图形元素选中(单选)
30471
+ }
30472
+
30341
30473
 
30342
30474
  //缩放因子
30343
30475
  /*
@@ -36743,7 +36875,7 @@ function ChartKLineTable()
36743
36875
  this.newMethod();
36744
36876
  delete this.newMethod;
36745
36877
 
36746
- this.ClassName='ChartKlineTable'; //类名
36878
+ this.ClassName='ChartKLineTable'; //类名
36747
36879
  this.Data;
36748
36880
  this.RowName;
36749
36881
  this.RowNamePosition=1; //0=不显示 1=左边内部 2=左边外部 3=右边外部
@@ -48140,8 +48272,11 @@ function ChartDrawSVG()
48140
48272
  this.BuildKeyCallback=null;
48141
48273
  this.MapCache=null; //key=date/date-time value={ Data:[] }
48142
48274
 
48143
- this.AryDrawDetail=[]; //需要绘制的文字信息
48144
- this.EnalbeDetailNoOverlap=false; //详情重叠不显示
48275
+ this.AryDrawDetail=[]; //需要绘制的文字信息
48276
+ this.EnalbeDetailNoOverlap=false; //详情重叠不显示
48277
+ this.EnableClick=false; //是否支持点击
48278
+ this.PixelRatio=GetDevicePixelRatio();
48279
+ this.SelectedItemCache=null;
48145
48280
 
48146
48281
  this.BuildKey=function(item)
48147
48282
  {
@@ -48179,6 +48314,7 @@ function ChartDrawSVG()
48179
48314
  this.AryDrawRect=[];
48180
48315
  this.AryDrawDetail=[];
48181
48316
  this.AutoYOffset=0;
48317
+ this.SelectedItemCache=null;
48182
48318
 
48183
48319
  if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
48184
48320
  if (this.IsShowIndexTitleOnly()) return;
@@ -48189,13 +48325,17 @@ function ChartDrawSVG()
48189
48325
 
48190
48326
  if (this.EnalbeDetailNoOverlap) this.DrawOnVerlapDetail();
48191
48327
 
48328
+ this.DrawSelectedItem();
48329
+
48192
48330
  this.AryDrawDetail=[];
48331
+ this.SelectedItemCache=null;
48193
48332
  }
48194
48333
 
48195
48334
  this.DrawDetail=function(rtSVG, data, svgItem)
48196
48335
  {
48197
48336
  if (!IFrameSplitOperator.IsNonEmptyArray(data.Content)) return;
48198
48337
 
48338
+ var bSelected=this.IsSelectedItem(svgItem); //是否是选中点
48199
48339
  var lefMargin=2;
48200
48340
  var rightMargin=2;
48201
48341
  var itemSpace=2;
@@ -48256,13 +48396,15 @@ function ChartDrawSVG()
48256
48396
  }
48257
48397
  }
48258
48398
 
48399
+ if (bSelected) this.SelectedItemCache.Detail={ AryText:aryText, Rect:rtBorder, Data:svgItem };
48400
+
48259
48401
  if (this.EnalbeDetailNoOverlap) //启动重叠不会 先不画只计算位置, 后面统一画
48260
48402
  {
48261
48403
  this.AryDrawDetail.push({ Rect:rtBorder, AryText:aryText, Data:svgItem });
48262
48404
  return;
48263
48405
  }
48264
48406
 
48265
- this.DrawDetailText(data,aryText,rtBorder);
48407
+ if (!bSelected) this.DrawDetailText(data,aryText,rtBorder);
48266
48408
 
48267
48409
  this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:svgItem } );
48268
48410
  }
@@ -48309,7 +48451,9 @@ function ChartDrawSVG()
48309
48451
 
48310
48452
  if (this.IsRectOverlap(rtBorder)) continue;
48311
48453
 
48312
- this.DrawDetailText(drawItem.Data.Detail, drawItem.AryText, rtBorder);
48454
+ var bSelected=this.IsSelectedItem(drawItem.Data); //是否是选中点
48455
+
48456
+ if (!bSelected) this.DrawDetailText(drawItem.Data.Detail, drawItem.AryText, rtBorder);
48313
48457
 
48314
48458
  this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:drawItem.Data } );
48315
48459
  }
@@ -48474,6 +48618,12 @@ function ChartDrawSVG()
48474
48618
  }
48475
48619
  }
48476
48620
 
48621
+ this.IsSelectedItem=function(item)
48622
+ {
48623
+ if (!this.SelectedItemCache) return false;
48624
+ return this.SelectedItemCache.ID==item.ID;
48625
+ }
48626
+
48477
48627
  this.DrawSVGV2=function()
48478
48628
  {
48479
48629
  if (!this.IsShow || this.ChartFrame.IsMinSize) return;
@@ -48489,7 +48639,7 @@ function ChartDrawSVG()
48489
48639
  var distanceWidth=this.ChartFrame.DistanceWidth;
48490
48640
  var isMinute=this.IsMinuteFrame();
48491
48641
  var border=this.GetBorder();
48492
- var pixelRatio = GetDevicePixelRatio();
48642
+ this.PixelRatio=GetDevicePixelRatio();
48493
48643
 
48494
48644
  if (this.IsHScreen)
48495
48645
  {
@@ -48504,7 +48654,11 @@ function ChartDrawSVG()
48504
48654
  var bottom=border.BottomEx;
48505
48655
  }
48506
48656
 
48507
- var x,y,price;
48657
+ var selectedData={ };
48658
+ if (this.GetCacheData(IChartPainting.CACHE_KEY.SELECTED, selectedData)) //选中图标
48659
+ this.SelectedItemCache={ ID:selectedData.Data.ID };
48660
+
48661
+ var x;
48508
48662
  var setKey=new Set(); //已经画过的Key就不再用了
48509
48663
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
48510
48664
  {
@@ -48531,147 +48685,200 @@ function ChartDrawSVG()
48531
48685
  {
48532
48686
  var item=mapItem.Data[k];
48533
48687
 
48534
- if (item.Value=="Top") y=top;
48535
- else if (item.Value=="Bottom") y=bottom;
48536
- else
48688
+ if (this.IsSelectedItem(item))
48537
48689
  {
48538
- if (IFrameSplitOperator.IsString(item.Value)) price=this.GetKValue(kItem,item.Value);
48539
- else price=item.Value;
48540
-
48541
- y=this.ChartFrame.GetYFromData(price, false);
48690
+ this.SelectedItemCache.Item=item;
48691
+ this.SelectedItemCache.KItem=kItem;
48692
+ this.SelectedItemCache.Index=i;
48693
+ this.SelectedItemCache.X=x;
48694
+ this.SelectedItemCache.Top=top;
48695
+ this.SelectedItemCache.Bottom=bottom;
48542
48696
  }
48543
- if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
48544
48697
 
48545
- var svgItem=item.SVG;
48546
- if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
48698
+ this.DrawSVGItem(item, kItem, i, x, top, bottom);
48699
+ }
48547
48700
 
48548
- if (this.AutoPosition)
48549
- {
48550
- var pt={ X:x, Y:y };
48551
- this.CalculateShowPosition(item, pt); //重新计算位置
48552
- x=pt.X;
48553
- y=pt.Y;
48554
- }
48701
+ setKey.add(key);
48702
+ }
48703
+ }
48555
48704
 
48556
- var fontSVG=`${svgItem.Size}px ${this.Family}`;
48557
- this.Canvas.font=fontSVG;
48558
- var halfSize=svgItem.Size/2;
48559
- var textBaseline='bottom';
48560
- var rtSVG={ Left:x-halfSize, Right:x+halfSize, Top:y-svgItem.Size, Bottom:y, Height:svgItem.Size, Width:svgItem.Size };
48561
- if (svgItem.VAlign===0)
48562
- {
48563
- textBaseline="top";
48564
- rtSVG.Top=y;
48565
- rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48566
- }
48567
- else if (svgItem.VAlign===1)
48568
- {
48569
- textBaseline='middle';
48570
- rtSVG.Top=y-svgItem.Size/2;
48571
- rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48572
- }
48573
48705
 
48574
- if (rtSVG.Top<0)
48575
- {
48576
- rtSVG.Top=0;
48577
- rtSVG.Bottom=svgItem.Size;
48578
- y=rtSVG.Bottom;
48579
- }
48706
+ this.GetYFromData=function(value, kItem, top, bottom)
48707
+ {
48708
+ if (value=="Top") return top;
48709
+ if (value=="Bottom") return bottom;
48710
+
48711
+ var price;
48712
+ if (IFrameSplitOperator.IsString(value)) price=this.GetKValue(kItem,value);
48713
+ else price=value;
48580
48714
 
48581
- this.Canvas.textBaseline=textBaseline;
48582
- this.Canvas.textAlign='center';
48583
- this.Canvas.fillStyle = svgItem.Color;
48584
- this.Canvas.fillText(svgItem.Symbol, x, y);
48715
+ var y=this.ChartFrame.GetYFromData(price, false);
48585
48716
 
48586
- this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
48717
+ return y;
48718
+ }
48587
48719
 
48588
- if (this.EnableTooltip) this.TooltipRect.push({ Rect:rtSVG, Index:i, Item:item });
48720
+ this.DrawSVGItem=function(item, kItem, index, x, top, bottom)
48721
+ {
48722
+ var y=this.GetYFromData(item.Value, kItem, top, bottom);
48723
+ if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
48589
48724
 
48590
- //文字
48591
- if (item.Text && item.Text.Content && this.TextFont)
48592
- {
48593
- var textItem=item.Text;
48594
- this.Canvas.font=this.TextFont;
48595
- this.Canvas.fillStyle=textItem.Color;
48596
- var yText=y;
48597
- if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
48598
- this.Canvas.fillText(textItem.Content, x, yText);
48599
- }
48725
+ var svgItem=item.SVG;
48726
+ if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
48600
48727
 
48601
- if (item.Detail)
48602
- {
48603
- this.DrawDetail(rtSVG,item.Detail, item);
48604
- }
48605
-
48606
- //连线
48607
- if (item.Line)
48608
- {
48609
- var lineItem=item.Line;
48610
- var price=null, yPrice=null;
48611
- if (lineItem.Value=="Bottom")
48612
- {
48613
- yPrice=bottom;
48614
- }
48615
- else if (lineItem.Value=="Top")
48616
- {
48617
- yPrice=top;
48618
- }
48619
- else
48620
- {
48621
- if (IFrameSplitOperator.IsString(lineItem.Value)) price=this.GetKValue(kItem,lineItem.Value);
48622
- else if (IFrameSplitOperator.IsNumber(lineItem.Value)) price=lineItem.Value;
48728
+ if (this.AutoPosition)
48729
+ {
48730
+ var pt={ X:x, Y:y };
48731
+ this.CalculateShowPosition(item, pt); //重新计算位置
48732
+ x=pt.X;
48733
+ y=pt.Y;
48734
+ }
48623
48735
 
48624
- if (!IFrameSplitOperator.IsNumber(price)) continue;
48625
- yPrice=this.ChartFrame.GetYFromData(price);
48626
- }
48627
-
48628
- if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) continue;
48736
+ var bSelected=this.IsSelectedItem(item); //是否是选中点
48629
48737
 
48630
- var yText;
48631
- if (yPrice<rtSVG.Top)
48632
- {
48633
- yText=rtSVG.Top;
48634
- if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48635
- {
48636
- //yPrice+=lineItem.Blank;
48637
- yText-=lineItem.SVGBlank;
48638
- }
48639
- }
48640
- else
48641
- {
48642
- yText=rtSVG.Bottom;
48643
- if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48644
- {
48645
- //yPrice-=lineItem.Blank;
48646
- yText+=lineItem.SVGBlank;
48647
- }
48648
- }
48738
+ var fontSVG=`${svgItem.Size}px ${this.Family}`;
48739
+ this.Canvas.font=fontSVG;
48740
+ var halfSize=svgItem.Size/2;
48741
+ var textBaseline='bottom';
48742
+ var rtSVG={ Left:x-halfSize, Right:x+halfSize, Top:y-svgItem.Size, Bottom:y, Height:svgItem.Size, Width:svgItem.Size };
48743
+ if (svgItem.VAlign===0)
48744
+ {
48745
+ textBaseline="top";
48746
+ rtSVG.Top=y;
48747
+ rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48748
+ }
48749
+ else if (svgItem.VAlign===1)
48750
+ {
48751
+ textBaseline='middle';
48752
+ rtSVG.Top=y-svgItem.Size/2;
48753
+ rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48754
+ }
48649
48755
 
48650
- if (lineItem.Dash) this.Canvas.setLineDash(lineItem.Dash); //虚线
48651
- var lineWidth=1*pixelRatio;
48652
- if (lineItem.Width>0) lineWidth=lineItem.Width*pixelRatio;
48653
- this.Canvas.lineWidth=lineWidth; //线宽
48654
- this.Canvas.strokeStyle = lineItem.Color;
48655
- this.Canvas.beginPath();
48756
+ if (rtSVG.Top<0)
48757
+ {
48758
+ rtSVG.Top=0;
48759
+ rtSVG.Bottom=svgItem.Size;
48760
+ y=rtSVG.Bottom;
48761
+ }
48656
48762
 
48657
- if (this.IsHScreen)
48658
- {
48659
- this.Canvas.moveTo(yText, ToFixedPoint(x));
48660
- this.Canvas.lineTo(yPrice,ToFixedPoint(x));
48661
- }
48662
- else
48663
- {
48664
- this.Canvas.moveTo(ToFixedPoint2(lineWidth,x),yText);
48665
- this.Canvas.lineTo(ToFixedPoint2(lineWidth,x),yPrice);
48666
- }
48667
-
48668
- this.Canvas.stroke();
48669
- this.Canvas.setLineDash([]);
48670
- }
48763
+ if (!bSelected)
48764
+ {
48765
+ this.Canvas.textBaseline=textBaseline;
48766
+ this.Canvas.textAlign='center';
48767
+ this.Canvas.fillStyle = svgItem.Color;
48768
+ this.Canvas.fillText(svgItem.Symbol, x, y);
48769
+ }
48770
+ else
48771
+ {
48772
+ this.SelectedItemCache.RectSVG=rtSVG; //保存图标的位置
48773
+ this.SelectedItemCache.SVGConfig={ Font:fontSVG, TextBaseline:textBaseline, X:x, Y:y };
48774
+ }
48775
+
48776
+ this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
48777
+
48778
+ if (this.EnableTooltip) this.TooltipRect.push({ Rect:rtSVG, Index:index, Item:item });
48779
+
48780
+ //图标内的文字
48781
+ if (!bSelected && item.Text && item.Text.Content && this.TextFont)
48782
+ {
48783
+ var textItem=item.Text;
48784
+ this.Canvas.font=this.TextFont;
48785
+ this.Canvas.fillStyle=textItem.Color;
48786
+ var yText=y;
48787
+ if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
48788
+ this.Canvas.fillText(textItem.Content, x, yText);
48789
+ }
48790
+
48791
+ //图标左右两边文字
48792
+ if (item.Detail) this.DrawDetail(rtSVG, item.Detail, item);
48793
+
48794
+ //连线
48795
+ if (!bSelected && item.Line) this.DrawVerticalLine(item,kItem,x, rtSVG, top, bottom);
48796
+ }
48797
+
48798
+ //绘制垂直连线
48799
+ this.DrawVerticalLine=function(item, kItem, x, rtSVG, top, bottom)
48800
+ {
48801
+ if (!item.Line) return;
48802
+
48803
+ var lineItem=item.Line;
48804
+ var yPrice=this.GetYFromData(lineItem.Value, kItem, top, bottom)
48805
+ if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) return;
48806
+
48807
+ var yText;
48808
+ if (yPrice<rtSVG.Top)
48809
+ {
48810
+ yText=rtSVG.Top;
48811
+ if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48812
+ {
48813
+ //yPrice+=lineItem.Blank;
48814
+ yText-=lineItem.SVGBlank;
48671
48815
  }
48816
+ }
48817
+ else
48818
+ {
48819
+ yText=rtSVG.Bottom;
48820
+ if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48821
+ {
48822
+ //yPrice-=lineItem.Blank;
48823
+ yText+=lineItem.SVGBlank;
48824
+ }
48825
+ }
48672
48826
 
48673
- setKey.add(key);
48827
+ if (lineItem.Dash) this.Canvas.setLineDash(lineItem.Dash); //虚线
48828
+ var lineWidth=1*this.PixelRatio;
48829
+ if (lineItem.Width>0) lineWidth=lineItem.Width*this.PixelRatio;
48830
+ this.Canvas.lineWidth=lineWidth; //线宽
48831
+ this.Canvas.strokeStyle = lineItem.Color;
48832
+ this.Canvas.beginPath();
48833
+
48834
+ if (this.IsHScreen)
48835
+ {
48836
+ this.Canvas.moveTo(yText, ToFixedPoint(x));
48837
+ this.Canvas.lineTo(yPrice,ToFixedPoint(x));
48838
+ }
48839
+ else
48840
+ {
48841
+ this.Canvas.moveTo(ToFixedPoint2(lineWidth,x),yText);
48842
+ this.Canvas.lineTo(ToFixedPoint2(lineWidth,x),yPrice);
48674
48843
  }
48844
+
48845
+ this.Canvas.stroke();
48846
+ this.Canvas.setLineDash([]);
48847
+ }
48848
+
48849
+ this.DrawSelectedItem=function()
48850
+ {
48851
+ if (!this.SelectedItemCache || !this.SelectedItemCache.Item) return;
48852
+
48853
+ var selecteItem=this.SelectedItemCache;
48854
+ var item=selecteItem.Item;
48855
+ var kItem=selecteItem.KItem;
48856
+ var top=selecteItem.Top;
48857
+ var bottom=selecteItem.Bottom;
48858
+ var rtSVG=selecteItem.RectSVG;
48859
+ var svgItem=item.SVG;
48860
+ var config=selecteItem.SVGConfig;
48861
+
48862
+ var x=config.X, y=config.Y;
48863
+ this.Canvas.font=config.Font;
48864
+ this.Canvas.textBaseline=config.TextBaseline;
48865
+ this.Canvas.textAlign='center';
48866
+ this.Canvas.fillStyle = svgItem.Color;
48867
+ this.Canvas.fillText(svgItem.Symbol, config.X, config.Y);
48868
+
48869
+ if (item.Text && item.Text.Content && this.TextFont)
48870
+ {
48871
+ var textItem=item.Text;
48872
+ this.Canvas.font=this.TextFont;
48873
+ this.Canvas.fillStyle=textItem.Color;
48874
+ var yText=y;
48875
+ if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
48876
+ this.Canvas.fillText(textItem.Content, x, yText);
48877
+ }
48878
+
48879
+ if (item.Line) this.DrawVerticalLine(item, kItem, x, rtSVG, top, bottom);
48880
+
48881
+ if (selecteItem.Detail) this.DrawDetailText(selecteItem.Item.Detail, selecteItem.Detail.AryText, selecteItem.Detail.Rect);
48675
48882
  }
48676
48883
 
48677
48884
  this.GetMaxMin=function()
@@ -48710,8 +48917,9 @@ function ChartDrawSVG()
48710
48917
  this.GetTooltipData=function(x,y,tooltip)
48711
48918
  {
48712
48919
  if (!this.IsShow) return false;
48920
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipRect)) return;
48713
48921
 
48714
- for(var i=0;i<this.TooltipRect.length;++i)
48922
+ for(var i=this.TooltipRect.length-1; i>=0; --i)
48715
48923
  {
48716
48924
  var item=this.TooltipRect[i];
48717
48925
  if (!item.Rect) continue;
@@ -48731,6 +48939,38 @@ function ChartDrawSVG()
48731
48939
 
48732
48940
  return false;
48733
48941
  }
48942
+
48943
+ this.ClickCell=function(x,y,e)
48944
+ {
48945
+ if (!this.IsShow) return null;
48946
+ if (!this.EnableClick) return null;
48947
+
48948
+ for(var i=this.TooltipRect.length-1; i>=0; --i)
48949
+ {
48950
+ var item=this.TooltipRect[i];
48951
+ if (!item.Rect) continue;
48952
+
48953
+ var rect=item.Rect;
48954
+ if (x>=rect.Left && x<=rect.Right && y>=rect.Top && y<=rect.Bottom)
48955
+ {
48956
+ var svgItem=item.Item;
48957
+ var id=svgItem.ID;
48958
+ var result={ Data:svgItem, Redraw:false, ChartPaint:this };
48959
+ var oldSelectedID=null;
48960
+ var out={ };
48961
+ if (this.GetCacheData(IChartPainting.CACHE_KEY.SELECTED, out)) oldSelectedID=out.Data.ID;
48962
+ if (id!=oldSelectedID)
48963
+ {
48964
+ this.SaveCacheData(IChartPainting.CACHE_KEY.SELECTED, { ID:id } );
48965
+ result.Redraw=true;
48966
+ }
48967
+
48968
+ return result;
48969
+ }
48970
+ }
48971
+
48972
+ return null;
48973
+ }
48734
48974
  }
48735
48975
 
48736
48976
  // OX图 支持横屏
@@ -85400,6 +85640,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85400
85640
  frame.Canvas=this.Canvas;
85401
85641
  frame.MainFrame=subFrame.Frame;
85402
85642
  frame.ChartBorder=subFrame.Frame.ChartBorder;
85643
+ frame.GlobalOption=this.GlobalOption;
85403
85644
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
85404
85645
  if (obj.ShowRightText===true) frame.IsShow=true;
85405
85646
  else if (obj.ShowRightText===false) frame.IsShow=false;
@@ -126583,6 +126824,8 @@ function ScriptIndex(name,script,args,option)
126583
126824
  if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.EnableTooltip)) chart.EnableTooltip=varItem.Draw.DrawData.EnableTooltip;
126584
126825
  if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.IsDrawFirst)) chart.IsDrawFirst=varItem.Draw.DrawData.IsDrawFirst;
126585
126826
  if (IFrameSplitOperator.IsBool(varItem.Draw.EnalbeDetailNoOverlap)) chart.EnalbeDetailNoOverlap=varItem.Draw.EnalbeDetailNoOverlap;
126827
+ if (IFrameSplitOperator.IsBool(varItem.Draw.EnableClick)) chart.EnableClick=varItem.Draw.EnableClick;
126828
+
126586
126829
  if (varItem.Draw.BuildKeyCallback) chart.BuildKeyCallback=varItem.Draw.BuildKeyCallback;
126587
126830
  chart.Family=varItem.Draw.DrawData.Family;
126588
126831
  chart.TextFont=varItem.Draw.DrawData.TextFont;
@@ -126674,6 +126917,7 @@ function ScriptIndex(name,script,args,option)
126674
126917
  }
126675
126918
 
126676
126919
  chart.BuildCacheData();
126920
+ this.SetChartIndexName(chart);
126677
126921
  hqChart.ChartPaint.push(chart);
126678
126922
 
126679
126923
  var titleIndex=windowIndex+1;
@@ -126722,7 +126966,7 @@ function ScriptIndex(name,script,args,option)
126722
126966
  }
126723
126967
 
126724
126968
  chart.BuildCacheData();
126725
-
126969
+ this.SetChartIndexName(chart);
126726
126970
  hqChart.ChartPaint.push(chart);
126727
126971
  }
126728
126972
 
@@ -128495,6 +128739,7 @@ function OverlayScriptIndex(name,script,args,option)
128495
128739
  chart.Texts= varItem.Draw.DrawData.Data;
128496
128740
  if (varItem.Draw.AutoPosition) chart.AutoPosition=varItem.Draw.AutoPosition;
128497
128741
  if (IFrameSplitOperator.IsBool(varItem.Draw.EnalbeDetailNoOverlap)) chart.EnalbeDetailNoOverlap=varItem.Draw.EnalbeDetailNoOverlap;
128742
+ if (IFrameSplitOperator.IsBool(varItem.Draw.EnableClick)) chart.EnableClick=varItem.Draw.EnableClick;
128498
128743
 
128499
128744
  this.ReloadChartResource(hqChart, windowIndex, chart);
128500
128745
 
@@ -129702,6 +129947,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
129702
129947
  drawItem.DrawType=draw.DrawType;
129703
129948
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
129704
129949
  drawItem.EnalbeDetailNoOverlap=draw.EnalbeDetailNoOverlap;
129950
+ drawItem.EnableClick=draw.EnableClick;
129705
129951
  if (draw.BuildKeyCallback) drawItem.BuildKeyCallback=draw.BuildKeyCallback;
129706
129952
  drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont, EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
129707
129953
  outVarItem.Draw=drawItem;
@@ -130211,6 +130457,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
130211
130457
  drawItem.DrawType=draw.DrawType;
130212
130458
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
130213
130459
  drawItem.EnalbeDetailNoOverlap=draw.EnalbeDetailNoOverlap;
130460
+ drawItem.EnableClick=draw.EnableClick;
130214
130461
  if (draw.BuildKeyCallback) drawItem.BuildKeyCallback=draw.BuildKeyCallback;
130215
130462
  drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont , EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
130216
130463
  outVarItem.Draw=drawItem;
@@ -157273,7 +157520,7 @@ function HQChartScriptWorker()
157273
157520
 
157274
157521
 
157275
157522
 
157276
- var HQCHART_VERSION="1.1.14642";
157523
+ var HQCHART_VERSION="1.1.14650";
157277
157524
 
157278
157525
  function PrintHQChartVersion()
157279
157526
  {