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.
@@ -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
  {
@@ -14157,6 +14219,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
14157
14219
  frame.Canvas=this.Canvas;
14158
14220
  frame.MainFrame=subFrame.Frame;
14159
14221
  frame.ChartBorder=subFrame.Frame.ChartBorder;
14222
+ frame.GlobalOption=this.GlobalOption;
14160
14223
  if (findOverlayItem) frame.IsShow=findOverlayItem.Frame.IsShow;
14161
14224
  //if (obj.IsShareY===true) frame.IsShareY=true;
14162
14225
  frame.YSplitOperator=new FrameSplitY();
@@ -29625,6 +29688,59 @@ function IChartPainting()
29625
29688
  else return item.Date;
29626
29689
  }
29627
29690
 
29691
+ //保存图形状态
29692
+ this.SaveCacheData=function(name, value)
29693
+ {
29694
+ if (!this.ChartFrame || !this.ChartFrame.GlobalOption) return false;
29695
+ var mapIndexCache=this.ChartFrame.GlobalOption.MapIndexChartCache;
29696
+ if (!mapIndexCache) return false;
29697
+
29698
+ if (!this.Script || !this.Script.Guid) return false;
29699
+ if (!this.Name) return false;
29700
+
29701
+ var id=this.Script.Guid; //指标ID;
29702
+ if (!mapIndexCache.has(id))
29703
+ {
29704
+ mapIndexCache.set(id, { MapData:new Map() });
29705
+ }
29706
+
29707
+ var mapItem=mapIndexCache.get(id);
29708
+ var key=`${this.Name}-${name}`;
29709
+ mapItem.MapData.set(key, value);
29710
+
29711
+ return true;
29712
+ }
29713
+
29714
+ //获取缓存数据 返回数据 out:{ Data, Key, IndexGuid }
29715
+ this.GetCacheData=function(name, out)
29716
+ {
29717
+ if (!this.ChartFrame || !this.ChartFrame.GlobalOption) return false;
29718
+ var mapIndexCache=this.ChartFrame.GlobalOption.MapIndexChartCache;
29719
+ if (!mapIndexCache) return false;
29720
+
29721
+ if (!this.Script || !this.Script.Guid) return false;
29722
+ if (!this.Name) return false;
29723
+
29724
+ var id=this.Script.Guid; //指标ID;
29725
+ if (!mapIndexCache.has(id)) return false;
29726
+
29727
+ var mapItem=mapIndexCache.get(id);
29728
+ var key=`${this.Name}-${name}`;
29729
+
29730
+ if (!mapItem.MapData.has(key)) return false;
29731
+
29732
+ var value=mapItem.MapData.get(key);
29733
+ if (out)
29734
+ {
29735
+ out.Data=value;
29736
+ out.Key=key;
29737
+ out.IndexGuid=id;
29738
+ }
29739
+
29740
+ return true;
29741
+ }
29742
+
29743
+
29628
29744
  //数据导出 数据格式 [{ Title:数据名称, Data:[] }]
29629
29745
  //this.ExportData=function(aryKData) { }
29630
29746
 
@@ -30338,6 +30454,12 @@ function IChartPainting()
30338
30454
  }
30339
30455
  }
30340
30456
 
30457
+ //缓存键值
30458
+ IChartPainting.CACHE_KEY=
30459
+ {
30460
+ SELECTED:"_Selected_Key_", //图形元素选中(单选)
30461
+ }
30462
+
30341
30463
 
30342
30464
  //缩放因子
30343
30465
  /*
@@ -36743,7 +36865,7 @@ function ChartKLineTable()
36743
36865
  this.newMethod();
36744
36866
  delete this.newMethod;
36745
36867
 
36746
- this.ClassName='ChartKlineTable'; //类名
36868
+ this.ClassName='ChartKLineTable'; //类名
36747
36869
  this.Data;
36748
36870
  this.RowName;
36749
36871
  this.RowNamePosition=1; //0=不显示 1=左边内部 2=左边外部 3=右边外部
@@ -48140,8 +48262,11 @@ function ChartDrawSVG()
48140
48262
  this.BuildKeyCallback=null;
48141
48263
  this.MapCache=null; //key=date/date-time value={ Data:[] }
48142
48264
 
48143
- this.AryDrawDetail=[]; //需要绘制的文字信息
48144
- this.EnalbeDetailNoOverlap=false; //详情重叠不显示
48265
+ this.AryDrawDetail=[]; //需要绘制的文字信息
48266
+ this.EnalbeDetailNoOverlap=false; //详情重叠不显示
48267
+ this.EnableClick=false; //是否支持点击
48268
+ this.PixelRatio=GetDevicePixelRatio();
48269
+ this.SelectedItemCache=null;
48145
48270
 
48146
48271
  this.BuildKey=function(item)
48147
48272
  {
@@ -48179,6 +48304,7 @@ function ChartDrawSVG()
48179
48304
  this.AryDrawRect=[];
48180
48305
  this.AryDrawDetail=[];
48181
48306
  this.AutoYOffset=0;
48307
+ this.SelectedItemCache=null;
48182
48308
 
48183
48309
  if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
48184
48310
  if (this.IsShowIndexTitleOnly()) return;
@@ -48189,13 +48315,17 @@ function ChartDrawSVG()
48189
48315
 
48190
48316
  if (this.EnalbeDetailNoOverlap) this.DrawOnVerlapDetail();
48191
48317
 
48318
+ this.DrawSelectedItem();
48319
+
48192
48320
  this.AryDrawDetail=[];
48321
+ this.SelectedItemCache=null;
48193
48322
  }
48194
48323
 
48195
48324
  this.DrawDetail=function(rtSVG, data, svgItem)
48196
48325
  {
48197
48326
  if (!IFrameSplitOperator.IsNonEmptyArray(data.Content)) return;
48198
48327
 
48328
+ var bSelected=this.IsSelectedItem(svgItem); //是否是选中点
48199
48329
  var lefMargin=2;
48200
48330
  var rightMargin=2;
48201
48331
  var itemSpace=2;
@@ -48256,13 +48386,15 @@ function ChartDrawSVG()
48256
48386
  }
48257
48387
  }
48258
48388
 
48389
+ if (bSelected) this.SelectedItemCache.Detail={ AryText:aryText, Rect:rtBorder, Data:svgItem };
48390
+
48259
48391
  if (this.EnalbeDetailNoOverlap) //启动重叠不会 先不画只计算位置, 后面统一画
48260
48392
  {
48261
48393
  this.AryDrawDetail.push({ Rect:rtBorder, AryText:aryText, Data:svgItem });
48262
48394
  return;
48263
48395
  }
48264
48396
 
48265
- this.DrawDetailText(data,aryText,rtBorder);
48397
+ if (!bSelected) this.DrawDetailText(data,aryText,rtBorder);
48266
48398
 
48267
48399
  this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:svgItem } );
48268
48400
  }
@@ -48271,6 +48403,11 @@ function ChartDrawSVG()
48271
48403
  {
48272
48404
  if (!data) return;
48273
48405
 
48406
+ if (data.Font) this.Canvas.font=data.Font;
48407
+ else this.Canvas.font=this.TextFont;
48408
+ this.Canvas.textBaseline='bottom';
48409
+ this.Canvas.textAlign='left';
48410
+
48274
48411
  if (data.BGColor)
48275
48412
  {
48276
48413
  this.Canvas.fillStyle=data.BGColor;
@@ -48304,7 +48441,9 @@ function ChartDrawSVG()
48304
48441
 
48305
48442
  if (this.IsRectOverlap(rtBorder)) continue;
48306
48443
 
48307
- this.DrawDetailText(drawItem.Data.Detail, drawItem.AryText, rtBorder);
48444
+ var bSelected=this.IsSelectedItem(drawItem.Data); //是否是选中点
48445
+
48446
+ if (!bSelected) this.DrawDetailText(drawItem.Data.Detail, drawItem.AryText, rtBorder);
48308
48447
 
48309
48448
  this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:drawItem.Data } );
48310
48449
  }
@@ -48469,6 +48608,12 @@ function ChartDrawSVG()
48469
48608
  }
48470
48609
  }
48471
48610
 
48611
+ this.IsSelectedItem=function(item)
48612
+ {
48613
+ if (!this.SelectedItemCache) return false;
48614
+ return this.SelectedItemCache.ID==item.ID;
48615
+ }
48616
+
48472
48617
  this.DrawSVGV2=function()
48473
48618
  {
48474
48619
  if (!this.IsShow || this.ChartFrame.IsMinSize) return;
@@ -48484,7 +48629,7 @@ function ChartDrawSVG()
48484
48629
  var distanceWidth=this.ChartFrame.DistanceWidth;
48485
48630
  var isMinute=this.IsMinuteFrame();
48486
48631
  var border=this.GetBorder();
48487
- var pixelRatio = GetDevicePixelRatio();
48632
+ this.PixelRatio=GetDevicePixelRatio();
48488
48633
 
48489
48634
  if (this.IsHScreen)
48490
48635
  {
@@ -48499,7 +48644,11 @@ function ChartDrawSVG()
48499
48644
  var bottom=border.BottomEx;
48500
48645
  }
48501
48646
 
48502
- var x,y,price;
48647
+ var selectedData={ };
48648
+ if (this.GetCacheData(IChartPainting.CACHE_KEY.SELECTED, selectedData)) //选中图标
48649
+ this.SelectedItemCache={ ID:selectedData.Data.ID };
48650
+
48651
+ var x;
48503
48652
  var setKey=new Set(); //已经画过的Key就不再用了
48504
48653
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
48505
48654
  {
@@ -48526,147 +48675,200 @@ function ChartDrawSVG()
48526
48675
  {
48527
48676
  var item=mapItem.Data[k];
48528
48677
 
48529
- if (item.Value=="Top") y=top;
48530
- else if (item.Value=="Bottom") y=bottom;
48531
- else
48678
+ if (this.IsSelectedItem(item))
48532
48679
  {
48533
- if (IFrameSplitOperator.IsString(item.Value)) price=this.GetKValue(kItem,item.Value);
48534
- else price=item.Value;
48535
-
48536
- y=this.ChartFrame.GetYFromData(price, false);
48680
+ this.SelectedItemCache.Item=item;
48681
+ this.SelectedItemCache.KItem=kItem;
48682
+ this.SelectedItemCache.Index=i;
48683
+ this.SelectedItemCache.X=x;
48684
+ this.SelectedItemCache.Top=top;
48685
+ this.SelectedItemCache.Bottom=bottom;
48537
48686
  }
48538
- if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
48539
48687
 
48540
- var svgItem=item.SVG;
48541
- if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
48688
+ this.DrawSVGItem(item, kItem, i, x, top, bottom);
48689
+ }
48542
48690
 
48543
- if (this.AutoPosition)
48544
- {
48545
- var pt={ X:x, Y:y };
48546
- this.CalculateShowPosition(item, pt); //重新计算位置
48547
- x=pt.X;
48548
- y=pt.Y;
48549
- }
48691
+ setKey.add(key);
48692
+ }
48693
+ }
48550
48694
 
48551
- var fontSVG=`${svgItem.Size}px ${this.Family}`;
48552
- this.Canvas.font=fontSVG;
48553
- var halfSize=svgItem.Size/2;
48554
- var textBaseline='bottom';
48555
- var rtSVG={ Left:x-halfSize, Right:x+halfSize, Top:y-svgItem.Size, Bottom:y, Height:svgItem.Size, Width:svgItem.Size };
48556
- if (svgItem.VAlign===0)
48557
- {
48558
- textBaseline="top";
48559
- rtSVG.Top=y;
48560
- rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48561
- }
48562
- else if (svgItem.VAlign===1)
48563
- {
48564
- textBaseline='middle';
48565
- rtSVG.Top=y-svgItem.Size/2;
48566
- rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48567
- }
48568
48695
 
48569
- if (rtSVG.Top<0)
48570
- {
48571
- rtSVG.Top=0;
48572
- rtSVG.Bottom=svgItem.Size;
48573
- y=rtSVG.Bottom;
48574
- }
48696
+ this.GetYFromData=function(value, kItem, top, bottom)
48697
+ {
48698
+ if (value=="Top") return top;
48699
+ if (value=="Bottom") return bottom;
48700
+
48701
+ var price;
48702
+ if (IFrameSplitOperator.IsString(value)) price=this.GetKValue(kItem,value);
48703
+ else price=value;
48575
48704
 
48576
- this.Canvas.textBaseline=textBaseline;
48577
- this.Canvas.textAlign='center';
48578
- this.Canvas.fillStyle = svgItem.Color;
48579
- this.Canvas.fillText(svgItem.Symbol, x, y);
48705
+ var y=this.ChartFrame.GetYFromData(price, false);
48580
48706
 
48581
- this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
48707
+ return y;
48708
+ }
48582
48709
 
48583
- if (this.EnableTooltip) this.TooltipRect.push({ Rect:rtSVG, Index:i, Item:item });
48710
+ this.DrawSVGItem=function(item, kItem, index, x, top, bottom)
48711
+ {
48712
+ var y=this.GetYFromData(item.Value, kItem, top, bottom);
48713
+ if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
48584
48714
 
48585
- //文字
48586
- if (item.Text && item.Text.Content && this.TextFont)
48587
- {
48588
- var textItem=item.Text;
48589
- this.Canvas.font=this.TextFont;
48590
- this.Canvas.fillStyle=textItem.Color;
48591
- var yText=y;
48592
- if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
48593
- this.Canvas.fillText(textItem.Content, x, yText);
48594
- }
48715
+ var svgItem=item.SVG;
48716
+ if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
48595
48717
 
48596
- if (item.Detail)
48597
- {
48598
- this.DrawDetail(rtSVG,item.Detail, item);
48599
- }
48600
-
48601
- //连线
48602
- if (item.Line)
48603
- {
48604
- var lineItem=item.Line;
48605
- var price=null, yPrice=null;
48606
- if (lineItem.Value=="Bottom")
48607
- {
48608
- yPrice=bottom;
48609
- }
48610
- else if (lineItem.Value=="Top")
48611
- {
48612
- yPrice=top;
48613
- }
48614
- else
48615
- {
48616
- if (IFrameSplitOperator.IsString(lineItem.Value)) price=this.GetKValue(kItem,lineItem.Value);
48617
- else if (IFrameSplitOperator.IsNumber(lineItem.Value)) price=lineItem.Value;
48718
+ if (this.AutoPosition)
48719
+ {
48720
+ var pt={ X:x, Y:y };
48721
+ this.CalculateShowPosition(item, pt); //重新计算位置
48722
+ x=pt.X;
48723
+ y=pt.Y;
48724
+ }
48618
48725
 
48619
- if (!IFrameSplitOperator.IsNumber(price)) continue;
48620
- yPrice=this.ChartFrame.GetYFromData(price);
48621
- }
48622
-
48623
- if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) continue;
48726
+ var bSelected=this.IsSelectedItem(item); //是否是选中点
48624
48727
 
48625
- var yText;
48626
- if (yPrice<rtSVG.Top)
48627
- {
48628
- yText=rtSVG.Top;
48629
- if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48630
- {
48631
- //yPrice+=lineItem.Blank;
48632
- yText-=lineItem.SVGBlank;
48633
- }
48634
- }
48635
- else
48636
- {
48637
- yText=rtSVG.Bottom;
48638
- if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48639
- {
48640
- //yPrice-=lineItem.Blank;
48641
- yText+=lineItem.SVGBlank;
48642
- }
48643
- }
48728
+ var fontSVG=`${svgItem.Size}px ${this.Family}`;
48729
+ this.Canvas.font=fontSVG;
48730
+ var halfSize=svgItem.Size/2;
48731
+ var textBaseline='bottom';
48732
+ var rtSVG={ Left:x-halfSize, Right:x+halfSize, Top:y-svgItem.Size, Bottom:y, Height:svgItem.Size, Width:svgItem.Size };
48733
+ if (svgItem.VAlign===0)
48734
+ {
48735
+ textBaseline="top";
48736
+ rtSVG.Top=y;
48737
+ rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48738
+ }
48739
+ else if (svgItem.VAlign===1)
48740
+ {
48741
+ textBaseline='middle';
48742
+ rtSVG.Top=y-svgItem.Size/2;
48743
+ rtSVG.Bottom=rtSVG.Top+svgItem.Size;
48744
+ }
48644
48745
 
48645
- if (lineItem.Dash) this.Canvas.setLineDash(lineItem.Dash); //虚线
48646
- var lineWidth=1*pixelRatio;
48647
- if (lineItem.Width>0) lineWidth=lineItem.Width*pixelRatio;
48648
- this.Canvas.lineWidth=lineWidth; //线宽
48649
- this.Canvas.strokeStyle = lineItem.Color;
48650
- this.Canvas.beginPath();
48746
+ if (rtSVG.Top<0)
48747
+ {
48748
+ rtSVG.Top=0;
48749
+ rtSVG.Bottom=svgItem.Size;
48750
+ y=rtSVG.Bottom;
48751
+ }
48651
48752
 
48652
- if (this.IsHScreen)
48653
- {
48654
- this.Canvas.moveTo(yText, ToFixedPoint(x));
48655
- this.Canvas.lineTo(yPrice,ToFixedPoint(x));
48656
- }
48657
- else
48658
- {
48659
- this.Canvas.moveTo(ToFixedPoint2(lineWidth,x),yText);
48660
- this.Canvas.lineTo(ToFixedPoint2(lineWidth,x),yPrice);
48661
- }
48662
-
48663
- this.Canvas.stroke();
48664
- this.Canvas.setLineDash([]);
48665
- }
48753
+ if (!bSelected)
48754
+ {
48755
+ this.Canvas.textBaseline=textBaseline;
48756
+ this.Canvas.textAlign='center';
48757
+ this.Canvas.fillStyle = svgItem.Color;
48758
+ this.Canvas.fillText(svgItem.Symbol, x, y);
48759
+ }
48760
+ else
48761
+ {
48762
+ this.SelectedItemCache.RectSVG=rtSVG; //保存图标的位置
48763
+ this.SelectedItemCache.SVGConfig={ Font:fontSVG, TextBaseline:textBaseline, X:x, Y:y };
48764
+ }
48765
+
48766
+ this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
48767
+
48768
+ if (this.EnableTooltip) this.TooltipRect.push({ Rect:rtSVG, Index:index, Item:item });
48769
+
48770
+ //图标内的文字
48771
+ if (!bSelected && item.Text && item.Text.Content && this.TextFont)
48772
+ {
48773
+ var textItem=item.Text;
48774
+ this.Canvas.font=this.TextFont;
48775
+ this.Canvas.fillStyle=textItem.Color;
48776
+ var yText=y;
48777
+ if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
48778
+ this.Canvas.fillText(textItem.Content, x, yText);
48779
+ }
48780
+
48781
+ //图标左右两边文字
48782
+ if (item.Detail) this.DrawDetail(rtSVG, item.Detail, item);
48783
+
48784
+ //连线
48785
+ if (!bSelected && item.Line) this.DrawVerticalLine(item,kItem,x, rtSVG, top, bottom);
48786
+ }
48787
+
48788
+ //绘制垂直连线
48789
+ this.DrawVerticalLine=function(item, kItem, x, rtSVG, top, bottom)
48790
+ {
48791
+ if (!item.Line) return;
48792
+
48793
+ var lineItem=item.Line;
48794
+ var yPrice=this.GetYFromData(lineItem.Value, kItem, top, bottom)
48795
+ if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) return;
48796
+
48797
+ var yText;
48798
+ if (yPrice<rtSVG.Top)
48799
+ {
48800
+ yText=rtSVG.Top;
48801
+ if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48802
+ {
48803
+ //yPrice+=lineItem.Blank;
48804
+ yText-=lineItem.SVGBlank;
48666
48805
  }
48806
+ }
48807
+ else
48808
+ {
48809
+ yText=rtSVG.Bottom;
48810
+ if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
48811
+ {
48812
+ //yPrice-=lineItem.Blank;
48813
+ yText+=lineItem.SVGBlank;
48814
+ }
48815
+ }
48667
48816
 
48668
- setKey.add(key);
48817
+ if (lineItem.Dash) this.Canvas.setLineDash(lineItem.Dash); //虚线
48818
+ var lineWidth=1*this.PixelRatio;
48819
+ if (lineItem.Width>0) lineWidth=lineItem.Width*this.PixelRatio;
48820
+ this.Canvas.lineWidth=lineWidth; //线宽
48821
+ this.Canvas.strokeStyle = lineItem.Color;
48822
+ this.Canvas.beginPath();
48823
+
48824
+ if (this.IsHScreen)
48825
+ {
48826
+ this.Canvas.moveTo(yText, ToFixedPoint(x));
48827
+ this.Canvas.lineTo(yPrice,ToFixedPoint(x));
48828
+ }
48829
+ else
48830
+ {
48831
+ this.Canvas.moveTo(ToFixedPoint2(lineWidth,x),yText);
48832
+ this.Canvas.lineTo(ToFixedPoint2(lineWidth,x),yPrice);
48833
+ }
48834
+
48835
+ this.Canvas.stroke();
48836
+ this.Canvas.setLineDash([]);
48837
+ }
48838
+
48839
+ this.DrawSelectedItem=function()
48840
+ {
48841
+ if (!this.SelectedItemCache || !this.SelectedItemCache.Item) return;
48842
+
48843
+ var selecteItem=this.SelectedItemCache;
48844
+ var item=selecteItem.Item;
48845
+ var kItem=selecteItem.KItem;
48846
+ var top=selecteItem.Top;
48847
+ var bottom=selecteItem.Bottom;
48848
+ var rtSVG=selecteItem.RectSVG;
48849
+ var svgItem=item.SVG;
48850
+ var config=selecteItem.SVGConfig;
48851
+
48852
+ var x=config.X, y=config.Y;
48853
+ this.Canvas.font=config.Font;
48854
+ this.Canvas.textBaseline=config.TextBaseline;
48855
+ this.Canvas.textAlign='center';
48856
+ this.Canvas.fillStyle = svgItem.Color;
48857
+ this.Canvas.fillText(svgItem.Symbol, config.X, config.Y);
48858
+
48859
+ if (item.Text && item.Text.Content && this.TextFont)
48860
+ {
48861
+ var textItem=item.Text;
48862
+ this.Canvas.font=this.TextFont;
48863
+ this.Canvas.fillStyle=textItem.Color;
48864
+ var yText=y;
48865
+ if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
48866
+ this.Canvas.fillText(textItem.Content, x, yText);
48669
48867
  }
48868
+
48869
+ if (item.Line) this.DrawVerticalLine(item, kItem, x, rtSVG, top, bottom);
48870
+
48871
+ if (selecteItem.Detail) this.DrawDetailText(selecteItem.Item.Detail, selecteItem.Detail.AryText, selecteItem.Detail.Rect);
48670
48872
  }
48671
48873
 
48672
48874
  this.GetMaxMin=function()
@@ -48705,8 +48907,9 @@ function ChartDrawSVG()
48705
48907
  this.GetTooltipData=function(x,y,tooltip)
48706
48908
  {
48707
48909
  if (!this.IsShow) return false;
48910
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipRect)) return;
48708
48911
 
48709
- for(var i=0;i<this.TooltipRect.length;++i)
48912
+ for(var i=this.TooltipRect.length-1; i>=0; --i)
48710
48913
  {
48711
48914
  var item=this.TooltipRect[i];
48712
48915
  if (!item.Rect) continue;
@@ -48726,6 +48929,38 @@ function ChartDrawSVG()
48726
48929
 
48727
48930
  return false;
48728
48931
  }
48932
+
48933
+ this.ClickCell=function(x,y,e)
48934
+ {
48935
+ if (!this.IsShow) return null;
48936
+ if (!this.EnableClick) return null;
48937
+
48938
+ for(var i=this.TooltipRect.length-1; i>=0; --i)
48939
+ {
48940
+ var item=this.TooltipRect[i];
48941
+ if (!item.Rect) continue;
48942
+
48943
+ var rect=item.Rect;
48944
+ if (x>=rect.Left && x<=rect.Right && y>=rect.Top && y<=rect.Bottom)
48945
+ {
48946
+ var svgItem=item.Item;
48947
+ var id=svgItem.ID;
48948
+ var result={ Data:svgItem, Redraw:false, ChartPaint:this };
48949
+ var oldSelectedID=null;
48950
+ var out={ };
48951
+ if (this.GetCacheData(IChartPainting.CACHE_KEY.SELECTED, out)) oldSelectedID=out.Data.ID;
48952
+ if (id!=oldSelectedID)
48953
+ {
48954
+ this.SaveCacheData(IChartPainting.CACHE_KEY.SELECTED, { ID:id } );
48955
+ result.Redraw=true;
48956
+ }
48957
+
48958
+ return result;
48959
+ }
48960
+ }
48961
+
48962
+ return null;
48963
+ }
48729
48964
  }
48730
48965
 
48731
48966
  // OX图 支持横屏
@@ -85395,6 +85630,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85395
85630
  frame.Canvas=this.Canvas;
85396
85631
  frame.MainFrame=subFrame.Frame;
85397
85632
  frame.ChartBorder=subFrame.Frame.ChartBorder;
85633
+ frame.GlobalOption=this.GlobalOption;
85398
85634
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
85399
85635
  if (obj.ShowRightText===true) frame.IsShow=true;
85400
85636
  else if (obj.ShowRightText===false) frame.IsShow=false;
@@ -126578,6 +126814,8 @@ function ScriptIndex(name,script,args,option)
126578
126814
  if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.EnableTooltip)) chart.EnableTooltip=varItem.Draw.DrawData.EnableTooltip;
126579
126815
  if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.IsDrawFirst)) chart.IsDrawFirst=varItem.Draw.DrawData.IsDrawFirst;
126580
126816
  if (IFrameSplitOperator.IsBool(varItem.Draw.EnalbeDetailNoOverlap)) chart.EnalbeDetailNoOverlap=varItem.Draw.EnalbeDetailNoOverlap;
126817
+ if (IFrameSplitOperator.IsBool(varItem.Draw.EnableClick)) chart.EnableClick=varItem.Draw.EnableClick;
126818
+
126581
126819
  if (varItem.Draw.BuildKeyCallback) chart.BuildKeyCallback=varItem.Draw.BuildKeyCallback;
126582
126820
  chart.Family=varItem.Draw.DrawData.Family;
126583
126821
  chart.TextFont=varItem.Draw.DrawData.TextFont;
@@ -126669,6 +126907,7 @@ function ScriptIndex(name,script,args,option)
126669
126907
  }
126670
126908
 
126671
126909
  chart.BuildCacheData();
126910
+ this.SetChartIndexName(chart);
126672
126911
  hqChart.ChartPaint.push(chart);
126673
126912
 
126674
126913
  var titleIndex=windowIndex+1;
@@ -126717,7 +126956,7 @@ function ScriptIndex(name,script,args,option)
126717
126956
  }
126718
126957
 
126719
126958
  chart.BuildCacheData();
126720
-
126959
+ this.SetChartIndexName(chart);
126721
126960
  hqChart.ChartPaint.push(chart);
126722
126961
  }
126723
126962
 
@@ -128490,6 +128729,7 @@ function OverlayScriptIndex(name,script,args,option)
128490
128729
  chart.Texts= varItem.Draw.DrawData.Data;
128491
128730
  if (varItem.Draw.AutoPosition) chart.AutoPosition=varItem.Draw.AutoPosition;
128492
128731
  if (IFrameSplitOperator.IsBool(varItem.Draw.EnalbeDetailNoOverlap)) chart.EnalbeDetailNoOverlap=varItem.Draw.EnalbeDetailNoOverlap;
128732
+ if (IFrameSplitOperator.IsBool(varItem.Draw.EnableClick)) chart.EnableClick=varItem.Draw.EnableClick;
128493
128733
 
128494
128734
  this.ReloadChartResource(hqChart, windowIndex, chart);
128495
128735
 
@@ -129697,6 +129937,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
129697
129937
  drawItem.DrawType=draw.DrawType;
129698
129938
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
129699
129939
  drawItem.EnalbeDetailNoOverlap=draw.EnalbeDetailNoOverlap;
129940
+ drawItem.EnableClick=draw.EnableClick;
129700
129941
  if (draw.BuildKeyCallback) drawItem.BuildKeyCallback=draw.BuildKeyCallback;
129701
129942
  drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont, EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
129702
129943
  outVarItem.Draw=drawItem;
@@ -130206,6 +130447,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
130206
130447
  drawItem.DrawType=draw.DrawType;
130207
130448
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
130208
130449
  drawItem.EnalbeDetailNoOverlap=draw.EnalbeDetailNoOverlap;
130450
+ drawItem.EnableClick=draw.EnableClick;
130209
130451
  if (draw.BuildKeyCallback) drawItem.BuildKeyCallback=draw.BuildKeyCallback;
130210
130452
  drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont , EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
130211
130453
  outVarItem.Draw=drawItem;
@@ -157268,7 +157510,7 @@ function HQChartScriptWorker()
157268
157510
 
157269
157511
 
157270
157512
 
157271
- var HQCHART_VERSION="1.1.14640";
157513
+ var HQCHART_VERSION="1.1.14647";
157272
157514
 
157273
157515
  function PrintHQChartVersion()
157274
157516
  {