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.
@@ -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)
8334
+ {
8335
+ if (clickCellData.Redraw===true) bRedraw=true;
8336
+ }
8337
+ else
8279
8338
  {
8280
- var selectChart=this.PtInChart(x,y);
8281
- if (selectChart)
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
  }
@@ -48309,7 +48441,9 @@ function ChartDrawSVG()
48309
48441
 
48310
48442
  if (this.IsRectOverlap(rtBorder)) continue;
48311
48443
 
48312
- 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);
48313
48447
 
48314
48448
  this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:drawItem.Data } );
48315
48449
  }
@@ -48474,6 +48608,12 @@ function ChartDrawSVG()
48474
48608
  }
48475
48609
  }
48476
48610
 
48611
+ this.IsSelectedItem=function(item)
48612
+ {
48613
+ if (!this.SelectedItemCache) return false;
48614
+ return this.SelectedItemCache.ID==item.ID;
48615
+ }
48616
+
48477
48617
  this.DrawSVGV2=function()
48478
48618
  {
48479
48619
  if (!this.IsShow || this.ChartFrame.IsMinSize) return;
@@ -48489,7 +48629,7 @@ function ChartDrawSVG()
48489
48629
  var distanceWidth=this.ChartFrame.DistanceWidth;
48490
48630
  var isMinute=this.IsMinuteFrame();
48491
48631
  var border=this.GetBorder();
48492
- var pixelRatio = GetDevicePixelRatio();
48632
+ this.PixelRatio=GetDevicePixelRatio();
48493
48633
 
48494
48634
  if (this.IsHScreen)
48495
48635
  {
@@ -48504,7 +48644,11 @@ function ChartDrawSVG()
48504
48644
  var bottom=border.BottomEx;
48505
48645
  }
48506
48646
 
48507
- 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;
48508
48652
  var setKey=new Set(); //已经画过的Key就不再用了
48509
48653
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
48510
48654
  {
@@ -48531,147 +48675,200 @@ function ChartDrawSVG()
48531
48675
  {
48532
48676
  var item=mapItem.Data[k];
48533
48677
 
48534
- if (item.Value=="Top") y=top;
48535
- else if (item.Value=="Bottom") y=bottom;
48536
- else
48678
+ if (this.IsSelectedItem(item))
48537
48679
  {
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);
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;
48542
48686
  }
48543
- if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
48544
48687
 
48545
- var svgItem=item.SVG;
48546
- if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
48688
+ this.DrawSVGItem(item, kItem, i, x, top, bottom);
48689
+ }
48547
48690
 
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
- }
48691
+ setKey.add(key);
48692
+ }
48693
+ }
48555
48694
 
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
48695
 
48574
- if (rtSVG.Top<0)
48575
- {
48576
- rtSVG.Top=0;
48577
- rtSVG.Bottom=svgItem.Size;
48578
- y=rtSVG.Bottom;
48579
- }
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;
48580
48704
 
48581
- this.Canvas.textBaseline=textBaseline;
48582
- this.Canvas.textAlign='center';
48583
- this.Canvas.fillStyle = svgItem.Color;
48584
- this.Canvas.fillText(svgItem.Symbol, x, y);
48705
+ var y=this.ChartFrame.GetYFromData(price, false);
48585
48706
 
48586
- this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
48707
+ return y;
48708
+ }
48587
48709
 
48588
- 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轴偏移
48589
48714
 
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
- }
48715
+ var svgItem=item.SVG;
48716
+ if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
48600
48717
 
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;
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
+ }
48623
48725
 
48624
- if (!IFrameSplitOperator.IsNumber(price)) continue;
48625
- yPrice=this.ChartFrame.GetYFromData(price);
48626
- }
48627
-
48628
- if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) continue;
48726
+ var bSelected=this.IsSelectedItem(item); //是否是选中点
48629
48727
 
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
- }
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
+ }
48649
48745
 
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();
48746
+ if (rtSVG.Top<0)
48747
+ {
48748
+ rtSVG.Top=0;
48749
+ rtSVG.Bottom=svgItem.Size;
48750
+ y=rtSVG.Bottom;
48751
+ }
48656
48752
 
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
- }
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;
48671
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
+ }
48672
48816
 
48673
- 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));
48674
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);
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);
48675
48872
  }
48676
48873
 
48677
48874
  this.GetMaxMin=function()
@@ -48710,8 +48907,9 @@ function ChartDrawSVG()
48710
48907
  this.GetTooltipData=function(x,y,tooltip)
48711
48908
  {
48712
48909
  if (!this.IsShow) return false;
48910
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipRect)) return;
48713
48911
 
48714
- for(var i=0;i<this.TooltipRect.length;++i)
48912
+ for(var i=this.TooltipRect.length-1; i>=0; --i)
48715
48913
  {
48716
48914
  var item=this.TooltipRect[i];
48717
48915
  if (!item.Rect) continue;
@@ -48731,6 +48929,38 @@ function ChartDrawSVG()
48731
48929
 
48732
48930
  return false;
48733
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
+ }
48734
48964
  }
48735
48965
 
48736
48966
  // OX图 支持横屏
@@ -85400,6 +85630,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85400
85630
  frame.Canvas=this.Canvas;
85401
85631
  frame.MainFrame=subFrame.Frame;
85402
85632
  frame.ChartBorder=subFrame.Frame.ChartBorder;
85633
+ frame.GlobalOption=this.GlobalOption;
85403
85634
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
85404
85635
  if (obj.ShowRightText===true) frame.IsShow=true;
85405
85636
  else if (obj.ShowRightText===false) frame.IsShow=false;
@@ -126583,6 +126814,8 @@ function ScriptIndex(name,script,args,option)
126583
126814
  if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.EnableTooltip)) chart.EnableTooltip=varItem.Draw.DrawData.EnableTooltip;
126584
126815
  if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.IsDrawFirst)) chart.IsDrawFirst=varItem.Draw.DrawData.IsDrawFirst;
126585
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
+
126586
126819
  if (varItem.Draw.BuildKeyCallback) chart.BuildKeyCallback=varItem.Draw.BuildKeyCallback;
126587
126820
  chart.Family=varItem.Draw.DrawData.Family;
126588
126821
  chart.TextFont=varItem.Draw.DrawData.TextFont;
@@ -126674,6 +126907,7 @@ function ScriptIndex(name,script,args,option)
126674
126907
  }
126675
126908
 
126676
126909
  chart.BuildCacheData();
126910
+ this.SetChartIndexName(chart);
126677
126911
  hqChart.ChartPaint.push(chart);
126678
126912
 
126679
126913
  var titleIndex=windowIndex+1;
@@ -126722,7 +126956,7 @@ function ScriptIndex(name,script,args,option)
126722
126956
  }
126723
126957
 
126724
126958
  chart.BuildCacheData();
126725
-
126959
+ this.SetChartIndexName(chart);
126726
126960
  hqChart.ChartPaint.push(chart);
126727
126961
  }
126728
126962
 
@@ -128495,6 +128729,7 @@ function OverlayScriptIndex(name,script,args,option)
128495
128729
  chart.Texts= varItem.Draw.DrawData.Data;
128496
128730
  if (varItem.Draw.AutoPosition) chart.AutoPosition=varItem.Draw.AutoPosition;
128497
128731
  if (IFrameSplitOperator.IsBool(varItem.Draw.EnalbeDetailNoOverlap)) chart.EnalbeDetailNoOverlap=varItem.Draw.EnalbeDetailNoOverlap;
128732
+ if (IFrameSplitOperator.IsBool(varItem.Draw.EnableClick)) chart.EnableClick=varItem.Draw.EnableClick;
128498
128733
 
128499
128734
  this.ReloadChartResource(hqChart, windowIndex, chart);
128500
128735
 
@@ -129702,6 +129937,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
129702
129937
  drawItem.DrawType=draw.DrawType;
129703
129938
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
129704
129939
  drawItem.EnalbeDetailNoOverlap=draw.EnalbeDetailNoOverlap;
129940
+ drawItem.EnableClick=draw.EnableClick;
129705
129941
  if (draw.BuildKeyCallback) drawItem.BuildKeyCallback=draw.BuildKeyCallback;
129706
129942
  drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont, EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
129707
129943
  outVarItem.Draw=drawItem;
@@ -130211,6 +130447,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
130211
130447
  drawItem.DrawType=draw.DrawType;
130212
130448
  if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
130213
130449
  drawItem.EnalbeDetailNoOverlap=draw.EnalbeDetailNoOverlap;
130450
+ drawItem.EnableClick=draw.EnableClick;
130214
130451
  if (draw.BuildKeyCallback) drawItem.BuildKeyCallback=draw.BuildKeyCallback;
130215
130452
  drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont , EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
130216
130453
  outVarItem.Draw=drawItem;
@@ -157273,7 +157510,7 @@ function HQChartScriptWorker()
157273
157510
 
157274
157511
 
157275
157512
 
157276
- var HQCHART_VERSION="1.1.14642";
157513
+ var HQCHART_VERSION="1.1.14647";
157277
157514
 
157278
157515
  function PrintHQChartVersion()
157279
157516
  {