hqchart 1.1.14641 → 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)
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
  {
@@ -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
  }
@@ -48227,6 +48359,11 @@ function ChartDrawSVG()
48227
48359
  {
48228
48360
  if (!data) return;
48229
48361
 
48362
+ if (data.Font) this.Canvas.font=data.Font;
48363
+ else this.Canvas.font=this.TextFont;
48364
+ this.Canvas.textBaseline='bottom';
48365
+ this.Canvas.textAlign='left';
48366
+
48230
48367
  if (data.BGColor)
48231
48368
  {
48232
48369
  this.Canvas.fillStyle=data.BGColor;
@@ -48260,7 +48397,9 @@ function ChartDrawSVG()
48260
48397
 
48261
48398
  if (this.IsRectOverlap(rtBorder)) continue;
48262
48399
 
48263
- 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);
48264
48403
 
48265
48404
  this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:drawItem.Data } );
48266
48405
  }
@@ -48425,6 +48564,12 @@ function ChartDrawSVG()
48425
48564
  }
48426
48565
  }
48427
48566
 
48567
+ this.IsSelectedItem=function(item)
48568
+ {
48569
+ if (!this.SelectedItemCache) return false;
48570
+ return this.SelectedItemCache.ID==item.ID;
48571
+ }
48572
+
48428
48573
  this.DrawSVGV2=function()
48429
48574
  {
48430
48575
  if (!this.IsShow || this.ChartFrame.IsMinSize) return;
@@ -48440,7 +48585,7 @@ function ChartDrawSVG()
48440
48585
  var distanceWidth=this.ChartFrame.DistanceWidth;
48441
48586
  var isMinute=this.IsMinuteFrame();
48442
48587
  var border=this.GetBorder();
48443
- var pixelRatio = GetDevicePixelRatio();
48588
+ this.PixelRatio=GetDevicePixelRatio();
48444
48589
 
48445
48590
  if (this.IsHScreen)
48446
48591
  {
@@ -48455,7 +48600,11 @@ function ChartDrawSVG()
48455
48600
  var bottom=border.BottomEx;
48456
48601
  }
48457
48602
 
48458
- 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;
48459
48608
  var setKey=new Set(); //已经画过的Key就不再用了
48460
48609
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
48461
48610
  {
@@ -48482,147 +48631,200 @@ function ChartDrawSVG()
48482
48631
  {
48483
48632
  var item=mapItem.Data[k];
48484
48633
 
48485
- if (item.Value=="Top") y=top;
48486
- else if (item.Value=="Bottom") y=bottom;
48487
- else
48634
+ if (this.IsSelectedItem(item))
48488
48635
  {
48489
- if (IFrameSplitOperator.IsString(item.Value)) price=this.GetKValue(kItem,item.Value);
48490
- else price=item.Value;
48491
-
48492
- 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;
48493
48642
  }
48494
- if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
48495
48643
 
48496
- var svgItem=item.SVG;
48497
- if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
48644
+ this.DrawSVGItem(item, kItem, i, x, top, bottom);
48645
+ }
48498
48646
 
48499
- if (this.AutoPosition)
48500
- {
48501
- var pt={ X:x, Y:y };
48502
- this.CalculateShowPosition(item, pt); //重新计算位置
48503
- x=pt.X;
48504
- y=pt.Y;
48505
- }
48647
+ setKey.add(key);
48648
+ }
48649
+ }
48506
48650
 
48507
- var fontSVG=`${svgItem.Size}px ${this.Family}`;
48508
- this.Canvas.font=fontSVG;
48509
- var halfSize=svgItem.Size/2;
48510
- var textBaseline='bottom';
48511
- var rtSVG={ Left:x-halfSize, Right:x+halfSize, Top:y-svgItem.Size, Bottom:y, Height:svgItem.Size, Width:svgItem.Size };
48512
- if (svgItem.VAlign===0)
48513
- {
48514
- textBaseline="top";
48515
- rtSVG.Top=y;
48516
- rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48517
- }
48518
- else if (svgItem.VAlign===1)
48519
- {
48520
- textBaseline='middle';
48521
- rtSVG.Top=y-svgItem.Size/2;
48522
- rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48523
- }
48524
48651
 
48525
- if (rtSVG.Top<0)
48526
- {
48527
- rtSVG.Top=0;
48528
- rtSVG.Bottom=svgItem.Size;
48529
- y=rtSVG.Bottom;
48530
- }
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;
48531
48660
 
48532
- this.Canvas.textBaseline=textBaseline;
48533
- this.Canvas.textAlign='center';
48534
- this.Canvas.fillStyle = svgItem.Color;
48535
- this.Canvas.fillText(svgItem.Symbol, x, y);
48661
+ var y=this.ChartFrame.GetYFromData(price, false);
48536
48662
 
48537
- this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
48663
+ return y;
48664
+ }
48538
48665
 
48539
- 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轴偏移
48540
48670
 
48541
- //文字
48542
- if (item.Text && item.Text.Content && this.TextFont)
48543
- {
48544
- var textItem=item.Text;
48545
- this.Canvas.font=this.TextFont;
48546
- this.Canvas.fillStyle=textItem.Color;
48547
- var yText=y;
48548
- if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
48549
- this.Canvas.fillText(textItem.Content, x, yText);
48550
- }
48671
+ var svgItem=item.SVG;
48672
+ if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
48551
48673
 
48552
- if (item.Detail)
48553
- {
48554
- this.DrawDetail(rtSVG,item.Detail, item);
48555
- }
48556
-
48557
- //连线
48558
- if (item.Line)
48559
- {
48560
- var lineItem=item.Line;
48561
- var price=null, yPrice=null;
48562
- if (lineItem.Value=="Bottom")
48563
- {
48564
- yPrice=bottom;
48565
- }
48566
- else if (lineItem.Value=="Top")
48567
- {
48568
- yPrice=top;
48569
- }
48570
- else
48571
- {
48572
- if (IFrameSplitOperator.IsString(lineItem.Value)) price=this.GetKValue(kItem,lineItem.Value);
48573
- 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
+ }
48574
48681
 
48575
- if (!IFrameSplitOperator.IsNumber(price)) continue;
48576
- yPrice=this.ChartFrame.GetYFromData(price);
48577
- }
48578
-
48579
- if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) continue;
48682
+ var bSelected=this.IsSelectedItem(item); //是否是选中点
48580
48683
 
48581
- var yText;
48582
- if (yPrice<rtSVG.Top)
48583
- {
48584
- yText=rtSVG.Top;
48585
- if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48586
- {
48587
- //yPrice+=lineItem.Blank;
48588
- yText-=lineItem.SVGBlank;
48589
- }
48590
- }
48591
- else
48592
- {
48593
- yText=rtSVG.Bottom;
48594
- if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48595
- {
48596
- //yPrice-=lineItem.Blank;
48597
- yText+=lineItem.SVGBlank;
48598
- }
48599
- }
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
+ }
48600
48701
 
48601
- if (lineItem.Dash) this.Canvas.setLineDash(lineItem.Dash); //虚线
48602
- var lineWidth=1*pixelRatio;
48603
- if (lineItem.Width>0) lineWidth=lineItem.Width*pixelRatio;
48604
- this.Canvas.lineWidth=lineWidth; //线宽
48605
- this.Canvas.strokeStyle = lineItem.Color;
48606
- this.Canvas.beginPath();
48702
+ if (rtSVG.Top<0)
48703
+ {
48704
+ rtSVG.Top=0;
48705
+ rtSVG.Bottom=svgItem.Size;
48706
+ y=rtSVG.Bottom;
48707
+ }
48607
48708
 
48608
- if (this.IsHScreen)
48609
- {
48610
- this.Canvas.moveTo(yText, ToFixedPoint(x));
48611
- this.Canvas.lineTo(yPrice,ToFixedPoint(x));
48612
- }
48613
- else
48614
- {
48615
- this.Canvas.moveTo(ToFixedPoint2(lineWidth,x),yText);
48616
- this.Canvas.lineTo(ToFixedPoint2(lineWidth,x),yPrice);
48617
- }
48618
-
48619
- this.Canvas.stroke();
48620
- this.Canvas.setLineDash([]);
48621
- }
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;
48622
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
+ }
48623
48772
 
48624
- 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));
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);
48625
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);
48626
48828
  }
48627
48829
 
48628
48830
  this.GetMaxMin=function()
@@ -48661,8 +48863,9 @@ function ChartDrawSVG()
48661
48863
  this.GetTooltipData=function(x,y,tooltip)
48662
48864
  {
48663
48865
  if (!this.IsShow) return false;
48866
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipRect)) return;
48664
48867
 
48665
- for(var i=0;i<this.TooltipRect.length;++i)
48868
+ for(var i=this.TooltipRect.length-1; i>=0; --i)
48666
48869
  {
48667
48870
  var item=this.TooltipRect[i];
48668
48871
  if (!item.Rect) continue;
@@ -48682,6 +48885,38 @@ function ChartDrawSVG()
48682
48885
 
48683
48886
  return false;
48684
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
+ }
48685
48920
  }
48686
48921
 
48687
48922
  // OX图 支持横屏
@@ -85351,6 +85586,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85351
85586
  frame.Canvas=this.Canvas;
85352
85587
  frame.MainFrame=subFrame.Frame;
85353
85588
  frame.ChartBorder=subFrame.Frame.ChartBorder;
85589
+ frame.GlobalOption=this.GlobalOption;
85354
85590
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
85355
85591
  if (obj.ShowRightText===true) frame.IsShow=true;
85356
85592
  else if (obj.ShowRightText===false) frame.IsShow=false;
@@ -126534,6 +126770,8 @@ function ScriptIndex(name,script,args,option)
126534
126770
  if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.EnableTooltip)) chart.EnableTooltip=varItem.Draw.DrawData.EnableTooltip;
126535
126771
  if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.IsDrawFirst)) chart.IsDrawFirst=varItem.Draw.DrawData.IsDrawFirst;
126536
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
+
126537
126775
  if (varItem.Draw.BuildKeyCallback) chart.BuildKeyCallback=varItem.Draw.BuildKeyCallback;
126538
126776
  chart.Family=varItem.Draw.DrawData.Family;
126539
126777
  chart.TextFont=varItem.Draw.DrawData.TextFont;
@@ -126625,6 +126863,7 @@ function ScriptIndex(name,script,args,option)
126625
126863
  }
126626
126864
 
126627
126865
  chart.BuildCacheData();
126866
+ this.SetChartIndexName(chart);
126628
126867
  hqChart.ChartPaint.push(chart);
126629
126868
 
126630
126869
  var titleIndex=windowIndex+1;
@@ -126673,7 +126912,7 @@ function ScriptIndex(name,script,args,option)
126673
126912
  }
126674
126913
 
126675
126914
  chart.BuildCacheData();
126676
-
126915
+ this.SetChartIndexName(chart);
126677
126916
  hqChart.ChartPaint.push(chart);
126678
126917
  }
126679
126918
 
@@ -128446,6 +128685,7 @@ function OverlayScriptIndex(name,script,args,option)
128446
128685
  chart.Texts= varItem.Draw.DrawData.Data;
128447
128686
  if (varItem.Draw.AutoPosition) chart.AutoPosition=varItem.Draw.AutoPosition;
128448
128687
  if (IFrameSplitOperator.IsBool(varItem.Draw.EnalbeDetailNoOverlap)) chart.EnalbeDetailNoOverlap=varItem.Draw.EnalbeDetailNoOverlap;
128688
+ if (IFrameSplitOperator.IsBool(varItem.Draw.EnableClick)) chart.EnableClick=varItem.Draw.EnableClick;
128449
128689
 
128450
128690
  this.ReloadChartResource(hqChart, windowIndex, chart);
128451
128691
 
@@ -129653,6 +129893,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
129653
129893
  drawItem.DrawType=draw.DrawType;
129654
129894
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
129655
129895
  drawItem.EnalbeDetailNoOverlap=draw.EnalbeDetailNoOverlap;
129896
+ drawItem.EnableClick=draw.EnableClick;
129656
129897
  if (draw.BuildKeyCallback) drawItem.BuildKeyCallback=draw.BuildKeyCallback;
129657
129898
  drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont, EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
129658
129899
  outVarItem.Draw=drawItem;
@@ -130162,6 +130403,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
130162
130403
  drawItem.DrawType=draw.DrawType;
130163
130404
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
130164
130405
  drawItem.EnalbeDetailNoOverlap=draw.EnalbeDetailNoOverlap;
130406
+ drawItem.EnableClick=draw.EnableClick;
130165
130407
  if (draw.BuildKeyCallback) drawItem.BuildKeyCallback=draw.BuildKeyCallback;
130166
130408
  drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont , EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
130167
130409
  outVarItem.Draw=drawItem;
@@ -146546,7 +146788,7 @@ function ScrollBarBGChart()
146546
146788
 
146547
146789
 
146548
146790
 
146549
- var HQCHART_VERSION="1.1.14640";
146791
+ var HQCHART_VERSION="1.1.14647";
146550
146792
 
146551
146793
  function PrintHQChartVersion()
146552
146794
  {