hqchart 1.1.14643 → 1.1.14648

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)
8290
+ {
8291
+ if (clickCellData.Redraw===true) bRedraw=true;
8292
+ }
8293
+ else
8235
8294
  {
8236
- var selectChart=this.PtInChart(x,y);
8237
- if (selectChart)
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
  {
@@ -14113,6 +14175,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
14113
14175
  frame.Canvas=this.Canvas;
14114
14176
  frame.MainFrame=subFrame.Frame;
14115
14177
  frame.ChartBorder=subFrame.Frame.ChartBorder;
14178
+ frame.GlobalOption=this.GlobalOption;
14116
14179
  if (findOverlayItem) frame.IsShow=findOverlayItem.Frame.IsShow;
14117
14180
  //if (obj.IsShareY===true) frame.IsShareY=true;
14118
14181
  frame.YSplitOperator=new FrameSplitY();
@@ -29581,6 +29644,59 @@ function IChartPainting()
29581
29644
  else return item.Date;
29582
29645
  }
29583
29646
 
29647
+ //保存图形状态
29648
+ this.SaveCacheData=function(name, value)
29649
+ {
29650
+ if (!this.ChartFrame || !this.ChartFrame.GlobalOption) return false;
29651
+ var mapIndexCache=this.ChartFrame.GlobalOption.MapIndexChartCache;
29652
+ if (!mapIndexCache) return false;
29653
+
29654
+ if (!this.Script || !this.Script.Guid) return false;
29655
+ if (!this.Name) return false;
29656
+
29657
+ var id=this.Script.Guid; //指标ID;
29658
+ if (!mapIndexCache.has(id))
29659
+ {
29660
+ mapIndexCache.set(id, { MapData:new Map() });
29661
+ }
29662
+
29663
+ var mapItem=mapIndexCache.get(id);
29664
+ var key=`${this.Name}-${name}`;
29665
+ mapItem.MapData.set(key, value);
29666
+
29667
+ return true;
29668
+ }
29669
+
29670
+ //获取缓存数据 返回数据 out:{ Data, Key, IndexGuid }
29671
+ this.GetCacheData=function(name, out)
29672
+ {
29673
+ if (!this.ChartFrame || !this.ChartFrame.GlobalOption) return false;
29674
+ var mapIndexCache=this.ChartFrame.GlobalOption.MapIndexChartCache;
29675
+ if (!mapIndexCache) return false;
29676
+
29677
+ if (!this.Script || !this.Script.Guid) return false;
29678
+ if (!this.Name) return false;
29679
+
29680
+ var id=this.Script.Guid; //指标ID;
29681
+ if (!mapIndexCache.has(id)) return false;
29682
+
29683
+ var mapItem=mapIndexCache.get(id);
29684
+ var key=`${this.Name}-${name}`;
29685
+
29686
+ if (!mapItem.MapData.has(key)) return false;
29687
+
29688
+ var value=mapItem.MapData.get(key);
29689
+ if (out)
29690
+ {
29691
+ out.Data=value;
29692
+ out.Key=key;
29693
+ out.IndexGuid=id;
29694
+ }
29695
+
29696
+ return true;
29697
+ }
29698
+
29699
+
29584
29700
  //数据导出 数据格式 [{ Title:数据名称, Data:[] }]
29585
29701
  //this.ExportData=function(aryKData) { }
29586
29702
 
@@ -30294,6 +30410,12 @@ function IChartPainting()
30294
30410
  }
30295
30411
  }
30296
30412
 
30413
+ //缓存键值
30414
+ IChartPainting.CACHE_KEY=
30415
+ {
30416
+ SELECTED:"_Selected_Key_", //图形元素选中(单选)
30417
+ }
30418
+
30297
30419
 
30298
30420
  //缩放因子
30299
30421
  /*
@@ -36699,7 +36821,7 @@ function ChartKLineTable()
36699
36821
  this.newMethod();
36700
36822
  delete this.newMethod;
36701
36823
 
36702
- this.ClassName='ChartKlineTable'; //类名
36824
+ this.ClassName='ChartKLineTable'; //类名
36703
36825
  this.Data;
36704
36826
  this.RowName;
36705
36827
  this.RowNamePosition=1; //0=不显示 1=左边内部 2=左边外部 3=右边外部
@@ -48096,8 +48218,11 @@ function ChartDrawSVG()
48096
48218
  this.BuildKeyCallback=null;
48097
48219
  this.MapCache=null; //key=date/date-time value={ Data:[] }
48098
48220
 
48099
- this.AryDrawDetail=[]; //需要绘制的文字信息
48100
- this.EnalbeDetailNoOverlap=false; //详情重叠不显示
48221
+ this.AryDrawDetail=[]; //需要绘制的文字信息
48222
+ this.EnalbeDetailNoOverlap=false; //详情重叠不显示
48223
+ this.EnableClick=false; //是否支持点击
48224
+ this.PixelRatio=GetDevicePixelRatio();
48225
+ this.SelectedItemCache=null;
48101
48226
 
48102
48227
  this.BuildKey=function(item)
48103
48228
  {
@@ -48135,6 +48260,7 @@ function ChartDrawSVG()
48135
48260
  this.AryDrawRect=[];
48136
48261
  this.AryDrawDetail=[];
48137
48262
  this.AutoYOffset=0;
48263
+ this.SelectedItemCache=null;
48138
48264
 
48139
48265
  if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
48140
48266
  if (this.IsShowIndexTitleOnly()) return;
@@ -48145,13 +48271,17 @@ function ChartDrawSVG()
48145
48271
 
48146
48272
  if (this.EnalbeDetailNoOverlap) this.DrawOnVerlapDetail();
48147
48273
 
48274
+ this.DrawSelectedItem();
48275
+
48148
48276
  this.AryDrawDetail=[];
48277
+ this.SelectedItemCache=null;
48149
48278
  }
48150
48279
 
48151
48280
  this.DrawDetail=function(rtSVG, data, svgItem)
48152
48281
  {
48153
48282
  if (!IFrameSplitOperator.IsNonEmptyArray(data.Content)) return;
48154
48283
 
48284
+ var bSelected=this.IsSelectedItem(svgItem); //是否是选中点
48155
48285
  var lefMargin=2;
48156
48286
  var rightMargin=2;
48157
48287
  var itemSpace=2;
@@ -48212,13 +48342,15 @@ function ChartDrawSVG()
48212
48342
  }
48213
48343
  }
48214
48344
 
48345
+ if (bSelected) this.SelectedItemCache.Detail={ AryText:aryText, Rect:rtBorder, Data:svgItem };
48346
+
48215
48347
  if (this.EnalbeDetailNoOverlap) //启动重叠不会 先不画只计算位置, 后面统一画
48216
48348
  {
48217
48349
  this.AryDrawDetail.push({ Rect:rtBorder, AryText:aryText, Data:svgItem });
48218
48350
  return;
48219
48351
  }
48220
48352
 
48221
- this.DrawDetailText(data,aryText,rtBorder);
48353
+ if (!bSelected) this.DrawDetailText(data,aryText,rtBorder);
48222
48354
 
48223
48355
  this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:svgItem } );
48224
48356
  }
@@ -48265,7 +48397,9 @@ function ChartDrawSVG()
48265
48397
 
48266
48398
  if (this.IsRectOverlap(rtBorder)) continue;
48267
48399
 
48268
- this.DrawDetailText(drawItem.Data.Detail, drawItem.AryText, rtBorder);
48400
+ var bSelected=this.IsSelectedItem(drawItem.Data); //是否是选中点
48401
+
48402
+ if (!bSelected) this.DrawDetailText(drawItem.Data.Detail, drawItem.AryText, rtBorder);
48269
48403
 
48270
48404
  this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:drawItem.Data } );
48271
48405
  }
@@ -48430,6 +48564,12 @@ function ChartDrawSVG()
48430
48564
  }
48431
48565
  }
48432
48566
 
48567
+ this.IsSelectedItem=function(item)
48568
+ {
48569
+ if (!this.SelectedItemCache) return false;
48570
+ return this.SelectedItemCache.ID==item.ID;
48571
+ }
48572
+
48433
48573
  this.DrawSVGV2=function()
48434
48574
  {
48435
48575
  if (!this.IsShow || this.ChartFrame.IsMinSize) return;
@@ -48445,7 +48585,7 @@ function ChartDrawSVG()
48445
48585
  var distanceWidth=this.ChartFrame.DistanceWidth;
48446
48586
  var isMinute=this.IsMinuteFrame();
48447
48587
  var border=this.GetBorder();
48448
- var pixelRatio = GetDevicePixelRatio();
48588
+ this.PixelRatio=GetDevicePixelRatio();
48449
48589
 
48450
48590
  if (this.IsHScreen)
48451
48591
  {
@@ -48460,7 +48600,11 @@ function ChartDrawSVG()
48460
48600
  var bottom=border.BottomEx;
48461
48601
  }
48462
48602
 
48463
- var x,y,price;
48603
+ var selectedData={ };
48604
+ if (this.GetCacheData(IChartPainting.CACHE_KEY.SELECTED, selectedData)) //选中图标
48605
+ this.SelectedItemCache={ ID:selectedData.Data.ID };
48606
+
48607
+ var x;
48464
48608
  var setKey=new Set(); //已经画过的Key就不再用了
48465
48609
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
48466
48610
  {
@@ -48487,147 +48631,200 @@ function ChartDrawSVG()
48487
48631
  {
48488
48632
  var item=mapItem.Data[k];
48489
48633
 
48490
- if (item.Value=="Top") y=top;
48491
- else if (item.Value=="Bottom") y=bottom;
48492
- else
48634
+ if (this.IsSelectedItem(item))
48493
48635
  {
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);
48636
+ this.SelectedItemCache.Item=item;
48637
+ this.SelectedItemCache.KItem=kItem;
48638
+ this.SelectedItemCache.Index=i;
48639
+ this.SelectedItemCache.X=x;
48640
+ this.SelectedItemCache.Top=top;
48641
+ this.SelectedItemCache.Bottom=bottom;
48498
48642
  }
48499
- if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
48500
48643
 
48501
- var svgItem=item.SVG;
48502
- if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
48644
+ this.DrawSVGItem(item, kItem, i, x, top, bottom);
48645
+ }
48503
48646
 
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
- }
48647
+ setKey.add(key);
48648
+ }
48649
+ }
48511
48650
 
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
48651
 
48530
- if (rtSVG.Top<0)
48531
- {
48532
- rtSVG.Top=0;
48533
- rtSVG.Bottom=svgItem.Size;
48534
- y=rtSVG.Bottom;
48535
- }
48652
+ this.GetYFromData=function(value, kItem, top, bottom)
48653
+ {
48654
+ if (value=="Top") return top;
48655
+ if (value=="Bottom") return bottom;
48656
+
48657
+ var price;
48658
+ if (IFrameSplitOperator.IsString(value)) price=this.GetKValue(kItem,value);
48659
+ else price=value;
48536
48660
 
48537
- this.Canvas.textBaseline=textBaseline;
48538
- this.Canvas.textAlign='center';
48539
- this.Canvas.fillStyle = svgItem.Color;
48540
- this.Canvas.fillText(svgItem.Symbol, x, y);
48661
+ var y=this.ChartFrame.GetYFromData(price, false);
48541
48662
 
48542
- this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
48663
+ return y;
48664
+ }
48543
48665
 
48544
- if (this.EnableTooltip) this.TooltipRect.push({ Rect:rtSVG, Index:i, Item:item });
48666
+ this.DrawSVGItem=function(item, kItem, index, x, top, bottom)
48667
+ {
48668
+ var y=this.GetYFromData(item.Value, kItem, top, bottom);
48669
+ if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
48545
48670
 
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
- }
48671
+ var svgItem=item.SVG;
48672
+ if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
48556
48673
 
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;
48674
+ if (this.AutoPosition)
48675
+ {
48676
+ var pt={ X:x, Y:y };
48677
+ this.CalculateShowPosition(item, pt); //重新计算位置
48678
+ x=pt.X;
48679
+ y=pt.Y;
48680
+ }
48579
48681
 
48580
- if (!IFrameSplitOperator.IsNumber(price)) continue;
48581
- yPrice=this.ChartFrame.GetYFromData(price);
48582
- }
48583
-
48584
- if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) continue;
48682
+ var bSelected=this.IsSelectedItem(item); //是否是选中点
48585
48683
 
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
- }
48684
+ var fontSVG=`${svgItem.Size}px ${this.Family}`;
48685
+ this.Canvas.font=fontSVG;
48686
+ var halfSize=svgItem.Size/2;
48687
+ var textBaseline='bottom';
48688
+ var rtSVG={ Left:x-halfSize, Right:x+halfSize, Top:y-svgItem.Size, Bottom:y, Height:svgItem.Size, Width:svgItem.Size };
48689
+ if (svgItem.VAlign===0)
48690
+ {
48691
+ textBaseline="top";
48692
+ rtSVG.Top=y;
48693
+ rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48694
+ }
48695
+ else if (svgItem.VAlign===1)
48696
+ {
48697
+ textBaseline='middle';
48698
+ rtSVG.Top=y-svgItem.Size/2;
48699
+ rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48700
+ }
48605
48701
 
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();
48702
+ if (rtSVG.Top<0)
48703
+ {
48704
+ rtSVG.Top=0;
48705
+ rtSVG.Bottom=svgItem.Size;
48706
+ y=rtSVG.Bottom;
48707
+ }
48612
48708
 
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
- }
48709
+ if (!bSelected)
48710
+ {
48711
+ this.Canvas.textBaseline=textBaseline;
48712
+ this.Canvas.textAlign='center';
48713
+ this.Canvas.fillStyle = svgItem.Color;
48714
+ this.Canvas.fillText(svgItem.Symbol, x, y);
48715
+ }
48716
+ else
48717
+ {
48718
+ this.SelectedItemCache.RectSVG=rtSVG; //保存图标的位置
48719
+ this.SelectedItemCache.SVGConfig={ Font:fontSVG, TextBaseline:textBaseline, X:x, Y:y };
48720
+ }
48721
+
48722
+ this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
48723
+
48724
+ if (this.EnableTooltip) this.TooltipRect.push({ Rect:rtSVG, Index:index, Item:item });
48725
+
48726
+ //图标内的文字
48727
+ if (!bSelected && item.Text && item.Text.Content && this.TextFont)
48728
+ {
48729
+ var textItem=item.Text;
48730
+ this.Canvas.font=this.TextFont;
48731
+ this.Canvas.fillStyle=textItem.Color;
48732
+ var yText=y;
48733
+ if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
48734
+ this.Canvas.fillText(textItem.Content, x, yText);
48735
+ }
48736
+
48737
+ //图标左右两边文字
48738
+ if (item.Detail) this.DrawDetail(rtSVG, item.Detail, item);
48739
+
48740
+ //连线
48741
+ if (!bSelected && item.Line) this.DrawVerticalLine(item,kItem,x, rtSVG, top, bottom);
48742
+ }
48743
+
48744
+ //绘制垂直连线
48745
+ this.DrawVerticalLine=function(item, kItem, x, rtSVG, top, bottom)
48746
+ {
48747
+ if (!item.Line) return;
48748
+
48749
+ var lineItem=item.Line;
48750
+ var yPrice=this.GetYFromData(lineItem.Value, kItem, top, bottom)
48751
+ if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) return;
48752
+
48753
+ var yText;
48754
+ if (yPrice<rtSVG.Top)
48755
+ {
48756
+ yText=rtSVG.Top;
48757
+ if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48758
+ {
48759
+ //yPrice+=lineItem.Blank;
48760
+ yText-=lineItem.SVGBlank;
48627
48761
  }
48762
+ }
48763
+ else
48764
+ {
48765
+ yText=rtSVG.Bottom;
48766
+ if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48767
+ {
48768
+ //yPrice-=lineItem.Blank;
48769
+ yText+=lineItem.SVGBlank;
48770
+ }
48771
+ }
48628
48772
 
48629
- setKey.add(key);
48773
+ if (lineItem.Dash) this.Canvas.setLineDash(lineItem.Dash); //虚线
48774
+ var lineWidth=1*this.PixelRatio;
48775
+ if (lineItem.Width>0) lineWidth=lineItem.Width*this.PixelRatio;
48776
+ this.Canvas.lineWidth=lineWidth; //线宽
48777
+ this.Canvas.strokeStyle = lineItem.Color;
48778
+ this.Canvas.beginPath();
48779
+
48780
+ if (this.IsHScreen)
48781
+ {
48782
+ this.Canvas.moveTo(yText, ToFixedPoint(x));
48783
+ this.Canvas.lineTo(yPrice,ToFixedPoint(x));
48630
48784
  }
48785
+ else
48786
+ {
48787
+ this.Canvas.moveTo(ToFixedPoint2(lineWidth,x),yText);
48788
+ this.Canvas.lineTo(ToFixedPoint2(lineWidth,x),yPrice);
48789
+ }
48790
+
48791
+ this.Canvas.stroke();
48792
+ this.Canvas.setLineDash([]);
48793
+ }
48794
+
48795
+ this.DrawSelectedItem=function()
48796
+ {
48797
+ if (!this.SelectedItemCache || !this.SelectedItemCache.Item) return;
48798
+
48799
+ var selecteItem=this.SelectedItemCache;
48800
+ var item=selecteItem.Item;
48801
+ var kItem=selecteItem.KItem;
48802
+ var top=selecteItem.Top;
48803
+ var bottom=selecteItem.Bottom;
48804
+ var rtSVG=selecteItem.RectSVG;
48805
+ var svgItem=item.SVG;
48806
+ var config=selecteItem.SVGConfig;
48807
+
48808
+ var x=config.X, y=config.Y;
48809
+ this.Canvas.font=config.Font;
48810
+ this.Canvas.textBaseline=config.TextBaseline;
48811
+ this.Canvas.textAlign='center';
48812
+ this.Canvas.fillStyle = svgItem.Color;
48813
+ this.Canvas.fillText(svgItem.Symbol, config.X, config.Y);
48814
+
48815
+ if (item.Text && item.Text.Content && this.TextFont)
48816
+ {
48817
+ var textItem=item.Text;
48818
+ this.Canvas.font=this.TextFont;
48819
+ this.Canvas.fillStyle=textItem.Color;
48820
+ var yText=y;
48821
+ if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
48822
+ this.Canvas.fillText(textItem.Content, x, yText);
48823
+ }
48824
+
48825
+ if (item.Line) this.DrawVerticalLine(item, kItem, x, rtSVG, top, bottom);
48826
+
48827
+ if (selecteItem.Detail) this.DrawDetailText(selecteItem.Item.Detail, selecteItem.Detail.AryText, selecteItem.Detail.Rect);
48631
48828
  }
48632
48829
 
48633
48830
  this.GetMaxMin=function()
@@ -48666,8 +48863,9 @@ function ChartDrawSVG()
48666
48863
  this.GetTooltipData=function(x,y,tooltip)
48667
48864
  {
48668
48865
  if (!this.IsShow) return false;
48866
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipRect)) return;
48669
48867
 
48670
- for(var i=0;i<this.TooltipRect.length;++i)
48868
+ for(var i=this.TooltipRect.length-1; i>=0; --i)
48671
48869
  {
48672
48870
  var item=this.TooltipRect[i];
48673
48871
  if (!item.Rect) continue;
@@ -48687,6 +48885,38 @@ function ChartDrawSVG()
48687
48885
 
48688
48886
  return false;
48689
48887
  }
48888
+
48889
+ this.ClickCell=function(x,y,e)
48890
+ {
48891
+ if (!this.IsShow) return null;
48892
+ if (!this.EnableClick) return null;
48893
+
48894
+ for(var i=this.TooltipRect.length-1; i>=0; --i)
48895
+ {
48896
+ var item=this.TooltipRect[i];
48897
+ if (!item.Rect) continue;
48898
+
48899
+ var rect=item.Rect;
48900
+ if (x>=rect.Left && x<=rect.Right && y>=rect.Top && y<=rect.Bottom)
48901
+ {
48902
+ var svgItem=item.Item;
48903
+ var id=svgItem.ID;
48904
+ var result={ Data:svgItem, Redraw:false, ChartPaint:this };
48905
+ var oldSelectedID=null;
48906
+ var out={ };
48907
+ if (this.GetCacheData(IChartPainting.CACHE_KEY.SELECTED, out)) oldSelectedID=out.Data.ID;
48908
+ if (id!=oldSelectedID)
48909
+ {
48910
+ this.SaveCacheData(IChartPainting.CACHE_KEY.SELECTED, { ID:id } );
48911
+ result.Redraw=true;
48912
+ }
48913
+
48914
+ return result;
48915
+ }
48916
+ }
48917
+
48918
+ return null;
48919
+ }
48690
48920
  }
48691
48921
 
48692
48922
  // OX图 支持横屏
@@ -85356,6 +85586,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85356
85586
  frame.Canvas=this.Canvas;
85357
85587
  frame.MainFrame=subFrame.Frame;
85358
85588
  frame.ChartBorder=subFrame.Frame.ChartBorder;
85589
+ frame.GlobalOption=this.GlobalOption;
85359
85590
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
85360
85591
  if (obj.ShowRightText===true) frame.IsShow=true;
85361
85592
  else if (obj.ShowRightText===false) frame.IsShow=false;
@@ -126539,6 +126770,8 @@ function ScriptIndex(name,script,args,option)
126539
126770
  if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.EnableTooltip)) chart.EnableTooltip=varItem.Draw.DrawData.EnableTooltip;
126540
126771
  if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.IsDrawFirst)) chart.IsDrawFirst=varItem.Draw.DrawData.IsDrawFirst;
126541
126772
  if (IFrameSplitOperator.IsBool(varItem.Draw.EnalbeDetailNoOverlap)) chart.EnalbeDetailNoOverlap=varItem.Draw.EnalbeDetailNoOverlap;
126773
+ if (IFrameSplitOperator.IsBool(varItem.Draw.EnableClick)) chart.EnableClick=varItem.Draw.EnableClick;
126774
+
126542
126775
  if (varItem.Draw.BuildKeyCallback) chart.BuildKeyCallback=varItem.Draw.BuildKeyCallback;
126543
126776
  chart.Family=varItem.Draw.DrawData.Family;
126544
126777
  chart.TextFont=varItem.Draw.DrawData.TextFont;
@@ -126630,6 +126863,7 @@ function ScriptIndex(name,script,args,option)
126630
126863
  }
126631
126864
 
126632
126865
  chart.BuildCacheData();
126866
+ this.SetChartIndexName(chart);
126633
126867
  hqChart.ChartPaint.push(chart);
126634
126868
 
126635
126869
  var titleIndex=windowIndex+1;
@@ -126678,7 +126912,7 @@ function ScriptIndex(name,script,args,option)
126678
126912
  }
126679
126913
 
126680
126914
  chart.BuildCacheData();
126681
-
126915
+ this.SetChartIndexName(chart);
126682
126916
  hqChart.ChartPaint.push(chart);
126683
126917
  }
126684
126918
 
@@ -128451,6 +128685,7 @@ function OverlayScriptIndex(name,script,args,option)
128451
128685
  chart.Texts= varItem.Draw.DrawData.Data;
128452
128686
  if (varItem.Draw.AutoPosition) chart.AutoPosition=varItem.Draw.AutoPosition;
128453
128687
  if (IFrameSplitOperator.IsBool(varItem.Draw.EnalbeDetailNoOverlap)) chart.EnalbeDetailNoOverlap=varItem.Draw.EnalbeDetailNoOverlap;
128688
+ if (IFrameSplitOperator.IsBool(varItem.Draw.EnableClick)) chart.EnableClick=varItem.Draw.EnableClick;
128454
128689
 
128455
128690
  this.ReloadChartResource(hqChart, windowIndex, chart);
128456
128691
 
@@ -129658,6 +129893,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
129658
129893
  drawItem.DrawType=draw.DrawType;
129659
129894
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
129660
129895
  drawItem.EnalbeDetailNoOverlap=draw.EnalbeDetailNoOverlap;
129896
+ drawItem.EnableClick=draw.EnableClick;
129661
129897
  if (draw.BuildKeyCallback) drawItem.BuildKeyCallback=draw.BuildKeyCallback;
129662
129898
  drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont, EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
129663
129899
  outVarItem.Draw=drawItem;
@@ -130167,6 +130403,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
130167
130403
  drawItem.DrawType=draw.DrawType;
130168
130404
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
130169
130405
  drawItem.EnalbeDetailNoOverlap=draw.EnalbeDetailNoOverlap;
130406
+ drawItem.EnableClick=draw.EnableClick;
130170
130407
  if (draw.BuildKeyCallback) drawItem.BuildKeyCallback=draw.BuildKeyCallback;
130171
130408
  drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont , EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
130172
130409
  outVarItem.Draw=drawItem;
@@ -146551,7 +146788,7 @@ function ScrollBarBGChart()
146551
146788
 
146552
146789
 
146553
146790
 
146554
- var HQCHART_VERSION="1.1.14642";
146791
+ var HQCHART_VERSION="1.1.14647";
146555
146792
 
146556
146793
  function PrintHQChartVersion()
146557
146794
  {