hqchart 1.1.13206 → 1.1.13213

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.
@@ -6553,7 +6553,12 @@ var JSCHART_MENU_ID=
6553
6553
  CMD_SHOW_BEFORE_DATA_ID:24, //显示|隐藏集合竞价
6554
6554
 
6555
6555
  CMD_SELECTED_ZOOM_ID:25, //选中放大
6556
- CMD_SELECTED_SUMMARY_ID:26, //区间统计
6556
+ CMD_SELECTED_SUMMARY_ID:26, //区间统计
6557
+
6558
+ CMD_SHOW_INDEX_ID:27, //显示隐藏指标
6559
+ CMD_SHOW_OVERLAY_INDEX_ID:28, //显示隐藏叠加指标
6560
+ CMD_DELETE_OVERLAY_INDEX_ID:29, //删除叠加指标
6561
+ CMD_SHOW_OVERLAY_Y_AXIS_ID:30, //显示隐藏Y轴叠加指标
6557
6562
  }
6558
6563
 
6559
6564
 
@@ -11898,19 +11903,27 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11898
11903
  {
11899
11904
  this.ChartDrawPicture=[];
11900
11905
  if (this.ChartDrawStorage) this.ChartDrawStorage.Clear();
11901
-
11906
+ this.SelectChartDrawPicture=null;
11907
+
11902
11908
  if (option && option.Draw==false) bDraw=false;
11903
11909
  if (bDraw) this.Draw();
11904
11910
  }
11905
11911
  else
11906
11912
  {
11907
- for(var i in this.ChartDrawPicture)
11913
+ for(var i=0; i<this.ChartDrawPicture.length; ++i)
11908
11914
  {
11909
- if (this.ChartDrawPicture[i]==drawPicture)
11915
+ var item=this.ChartDrawPicture[i];
11916
+ if (item.Guid==drawPicture.Guid || item==drawPicture)
11910
11917
  {
11911
11918
  if (this.ChartDrawStorage) this.ChartDrawStorage.DeleteDrawData(drawPicture);
11912
11919
  this.ChartDrawPicture.splice(i,1);
11913
11920
 
11921
+ if (this.SelectChartDrawPicture) //去掉选中
11922
+ {
11923
+ if (this.SelectChartDrawPicture.Guid==drawPicture.Guid || this.SelectChartDrawPicture==drawPicture)
11924
+ this.SelectChartDrawPicture=null;
11925
+ }
11926
+
11914
11927
  if (option && option.Draw==false) bDraw=false;
11915
11928
  if (bDraw) this.Draw();
11916
11929
  }
@@ -12112,6 +12125,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
12112
12125
  if (IFrameSplitOperator.IsNumber(item.OverlayIndexType.Position)) frame.OverlayIndexType.Position=item.OverlayIndexType.Position;
12113
12126
  if (IFrameSplitOperator.IsNumber(item.OverlayIndexType.LineSpace)) frame.OverlayIndexType.LineSpace=item.OverlayIndexType.LineSpace;
12114
12127
  }
12128
+
12129
+ if (IFrameSplitOperator.IsNonEmptyArray(item.CustomToolbar)) //自定义工具按钮
12130
+ {
12131
+ frame.CustomToolbar=item.CustomToolbar.slice();
12132
+ }
12115
12133
  }
12116
12134
 
12117
12135
  if (IFrameSplitOperator.IsNumber(option.SplitCount)) subFrame.Frame.YSplitOperator.SplitCount=option.SplitCount;
@@ -13148,9 +13166,92 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
13148
13166
  var dlg=new KLineSelectRectDialog(this.DivElement);
13149
13167
  dlg.DoModal(srcParam);
13150
13168
  break;
13169
+
13170
+ case JSCHART_MENU_ID.CMD_SHOW_INDEX_ID: //显示隐藏指标 [0]=windowIndex [1]=0=自动 1=隐藏 2=显示
13171
+ if (param==null || !IFrameSplitOperator.IsNumber(aryArgs[1])) return false;
13172
+ var windowIndex=param, showType=aryArgs[1];
13173
+ var script=this.WindowIndex[windowIndex];
13174
+ if (!script) return false;
13175
+
13176
+ if (showType==1) script.IsShow=false;
13177
+ else if (showType==2) script.IsShow=true;
13178
+ else script.IsShow=!script.IsShow;
13179
+
13180
+ this.UpdateWindowIndex(windowIndex);
13181
+ break;
13182
+
13183
+ case JSCHART_MENU_ID.CMD_SHOW_OVERLAY_INDEX_ID: //显示隐藏叠加指标 [0]=indexGuid [1]=0=自动 1=隐藏 2=显示
13184
+ if (!srcParam || !IFrameSplitOperator.IsNumber(aryArgs[1])) return false;
13185
+ var indexGuid=srcParam,showType=aryArgs[1];
13186
+
13187
+ var overlay=this.GetOverlayIndexByIdentify(indexGuid);
13188
+ if (!overlay || !overlay.OverlayItem || !overlay.OverlayItem.Script) return false;
13189
+
13190
+ var script=overlay.OverlayItem.Script;
13191
+
13192
+ if (showType==1) script.IsShow=false;
13193
+ else if (showType==2) script.IsShow==true;
13194
+ else script.IsShow=!script.IsShow;
13195
+
13196
+ this.UpdateOverlayIndex(indexGuid);
13197
+ break;
13198
+ case JSCHART_MENU_ID.CMD_DELETE_OVERLAY_INDEX_ID:
13199
+ if (srcParam && this.DeleteOverlayWindowsIndex)
13200
+ this.DeleteOverlayWindowsIndex(srcParam);
13201
+ break;
13202
+ case JSCHART_MENU_ID.CMD_SHOW_OVERLAY_Y_AXIS_ID:
13203
+ if (!srcParam || !IFrameSplitOperator.IsNumber(aryArgs[1])) return false;
13204
+ if (!this.GetOverlayIndexByIdentify) return false;
13205
+
13206
+ var indexGuid=srcParam,showType=aryArgs[1];
13207
+ var finder=this.GetOverlayIndexByIdentify(indexGuid);
13208
+ if (!finder || !finder.OverlayItem) return false;
13209
+
13210
+ var frame=finder.OverlayItem.Frame;
13211
+ if (showType==1) frame.IsShow=false;
13212
+ else if (showType==2) frame.IsShow==true;
13213
+ else frame.IsShow=!frame.IsShow;
13214
+
13215
+ this.UpdataDataoffset(); //更新数据偏移
13216
+ this.UpdateFrameMaxMin(); //调整坐标最大 最小值
13217
+ this.Draw();
13218
+
13219
+ break;
13151
13220
  }
13152
13221
  }
13153
13222
 
13223
+ this.GetShowIndexMenuData=function(windowIndex, showType)
13224
+ {
13225
+ var script=this.WindowIndex[windowIndex];
13226
+ if (!script) return null;
13227
+
13228
+ var data= { Name:script.IsShow?"隐藏指标":"显示指标", Data:{ ID: JSCHART_MENU_ID.CMD_SHOW_INDEX_ID, Args:[windowIndex, 0] } };
13229
+
13230
+ return data;
13231
+ }
13232
+
13233
+ this.GetShowOverlayIndexMenuData=function(indexGuid, showType)
13234
+ {
13235
+ var overlay=this.GetOverlayIndexByIdentify(indexGuid);
13236
+ if (!overlay || !overlay.OverlayItem || !overlay.OverlayItem.Script) return null;
13237
+
13238
+ var script=overlay.OverlayItem.Script;
13239
+ var data= { Name:script.IsShow?"隐藏指标":"显示指标", Data:{ ID: JSCHART_MENU_ID.CMD_SHOW_OVERLAY_INDEX_ID, Args:[indexGuid, 0] } };
13240
+
13241
+ return data;
13242
+ }
13243
+
13244
+ this.GetShowOverlayIndexYAxisMenuData=function(indexGuid, showType)
13245
+ {
13246
+ var overlay=this.GetOverlayIndexByIdentify(indexGuid);
13247
+ if (!overlay || !overlay.OverlayItem || !overlay.OverlayItem.Script) return null;
13248
+
13249
+ var frame=overlay.OverlayItem.Frame;
13250
+ var data= { Name:frame.IsShow?"隐藏Y轴":"显示Y轴", Data:{ ID: JSCHART_MENU_ID.CMD_SHOW_OVERLAY_Y_AXIS_ID, Args:[indexGuid, 0] } };
13251
+
13252
+ return data;
13253
+ }
13254
+
13154
13255
  //点击右键菜单
13155
13256
  this.OnClickRightMenu=function(data)
13156
13257
  {
@@ -57655,7 +57756,7 @@ function DynamicChartTitlePainting()
57655
57756
  var rtButton={ Left:left, YCenter:yCenter };
57656
57757
  this.DrawButton(item, rtButton, moveonPoint, mouseStatus);
57657
57758
 
57658
- this.Buttons.push({ ID:item.ID, Rect:rtButton, FrameID:this.Frame.Identify, Type:1, OverlayID:toolbarInfo.ID, Title:overlayItem.Title });
57759
+ this.Buttons.push({ ID:item.ID, Rect:rtButton, FrameID:this.Frame.Identify, Type:1, OverlayID:toolbarInfo.ID, Title:overlayItem.Title, Data:item.Data });
57659
57760
 
57660
57761
  left=rtButton.Right;
57661
57762
 
@@ -59885,11 +59986,14 @@ function ChartDrawHLine()
59885
59986
 
59886
59987
  this.Button=
59887
59988
  {
59888
- CloseIcon: { Text:'\ue62b', Color:'rgb(255,255,255)', Family:"iconfont", Size:16, ID:JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE, TooltipText:null },
59889
- SettingIcon: { Text:'\ue623',Color:'rgb(255,255,255)', Family:"iconfont", Size:16, ID:JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING, TooltipText:null }
59989
+ CloseIcon: { Text:'\ue62b', Color:'rgb(255,255,255)', Family:"iconfont", Size:16, ID:JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE, TooltipText:null, Margin:{ Left:2, Right:2 } },
59990
+ SettingIcon: { Text:'\ue623',Color:'rgb(255,255,255)', Family:"iconfont", Size:16, ID:JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING, TooltipText:null, Margin:{ Left:2, Right:2 } }
59890
59991
  //修改ID, Text , TooltipText 可以外部定制按钮
59891
59992
  }
59892
59993
 
59994
+ this.CustomButton=[]; //自定义的按钮 { Text:'\ue62b', Color:'rgb(255,255,255)', Family:"iconfont", Size:16, ID:JSCHART_BUTTON_ID.DRAW_PICTURE_BUTTON_1, TooltipText:null }
59995
+
59996
+ this.AryShowButton=[]; //需要显示的按钮 { Data:, Width }
59893
59997
  this.AryButton=[];
59894
59998
  this.ExtendData; //扩展数据
59895
59999
  this.ShowPriceTextConfig=
@@ -59995,8 +60099,32 @@ function ChartDrawHLine()
59995
60099
  this.Draw();
59996
60100
  }
59997
60101
 
60102
+ //获取需要显示的按钮 系统按钮+自定义按钮
60103
+ this.GetShowButton=function()
60104
+ {
60105
+ var aryButton=[];
60106
+
60107
+ var item=this.Button.SettingIcon;
60108
+ if (item && item.Text) aryButton.push({ Data:item, Width:null });
60109
+
60110
+ item=this.Button.CloseIcon;
60111
+ if (item && item.Text) aryButton.push({ Data:item, Width:null });
60112
+
60113
+ if (IFrameSplitOperator.IsNonEmptyArray(this.CustomButton))
60114
+ {
60115
+ for(var i=0;i<this.CustomButton.length;++i)
60116
+ {
60117
+ item=this.CustomButton[i];
60118
+ if (item && item.Text) aryButton.push({ Data:item, Width:null });
60119
+ }
60120
+ }
60121
+
60122
+ return aryButton;
60123
+ }
60124
+
59998
60125
  this.Draw=function(moveonPoint, mouseStatus)
59999
60126
  {
60127
+ this.AryShowButton=[];
60000
60128
  this.LinePoint=[];
60001
60129
  this.AryButton=[];
60002
60130
  this.ColseButtonSize=0;
@@ -60072,6 +60200,8 @@ function ChartDrawHLine()
60072
60200
  var labInfo;
60073
60201
  if (this.GetLabelCallback) labInfo=this.GetLabelCallback(this);
60074
60202
 
60203
+ this.AryShowButton=this.GetShowButton(); //获取按钮
60204
+
60075
60205
  //描述信息
60076
60206
  if (labInfo)
60077
60207
  this.DrawLab(labInfo, drawPoint[0].Y);
@@ -60375,42 +60505,33 @@ function ChartDrawHLine()
60375
60505
  {
60376
60506
  var pixelRatio=GetDevicePixelRatio();
60377
60507
 
60378
- if (this.Button.SettingIcon)
60379
- {
60380
- var icon=this.Button.SettingIcon;
60381
- var font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60382
- this.Canvas.font=font;
60383
- var width=this.Canvas.measureText(icon.Text).width;
60384
- this.SettingButtonSize=width;
60385
- }
60508
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton)) return;
60386
60509
 
60387
- if (this.Button.CloseIcon)
60510
+ var totalWidth=0;
60511
+ for(var i=0;i<this.AryShowButton.length;++i)
60388
60512
  {
60389
- var icon=this.Button.CloseIcon;
60513
+ var item=this.AryShowButton[i];
60514
+ var icon=item.Data;
60390
60515
  var font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60391
60516
  this.Canvas.font=font;
60392
- var width=this.Canvas.measureText(icon.Text).width;
60393
- this.ColseButtonSize=width;
60394
- }
60517
+ item.Width=this.Canvas.measureText(icon.Text).width+2;
60395
60518
 
60396
- if (this.ColseButtonSize<=0 && this.SettingButtonSize<=0) return;
60519
+ if (icon.Margin)
60520
+ {
60521
+ var margin=icon.Margin;
60522
+ if (IFrameSplitOperator.IsNumber(margin.Left)) item.Width+=margin.Left;
60523
+ if (IFrameSplitOperator.IsNumber(margin.Right)) item.Width+=margin.Right;
60524
+ }
60397
60525
 
60398
- var buttonWidth=0
60399
- if (this.SettingButtonSize>0) buttonWidth+=this.SettingButtonSize;
60400
- if (this.ColseButtonSize>0)
60401
- {
60402
- if (buttonWidth>0) buttonWidth+=this.ButtonSpace;
60403
- buttonWidth+=this.ColseButtonSize;
60526
+ totalWidth+=item.Width;
60404
60527
  }
60405
60528
 
60406
- buttonWidth+=4;
60407
-
60408
- this.ButtonBGWidth=buttonWidth;
60529
+ this.ButtonBGWidth=totalWidth;
60409
60530
  }
60410
60531
 
60411
60532
  this.DrawButton=function(drawTop, drawLeft, drawHeight, rtDraw)
60412
60533
  {
60413
- if (this.ColseButtonSize<=0 && this.SettingButtonSize<=0) return;
60534
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton)) return;
60414
60535
 
60415
60536
  if (this.ButtonPosition==1) drawTop-=drawHeight;
60416
60537
 
@@ -60422,61 +60543,29 @@ function ChartDrawHLine()
60422
60543
  this.Canvas.fillStyle=this.ButtonBGColor;
60423
60544
  this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top), ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));
60424
60545
 
60425
- left+=1;
60426
60546
  var pixelRatio=GetDevicePixelRatio();
60427
- if (this.Button.SettingIcon && this.Button.SettingIcon.Text)
60547
+ for(var i=0;i<this.AryShowButton.length;++i)
60428
60548
  {
60429
- var rtButton={Left:left, Top:drawTop, Width:this.SettingButtonSize, Height:drawHeight };
60430
- rtButton.Right=rtButton.Left+rtButton.Width;
60431
- rtButton.Bottom=rtButton.Top+rtButton.Height;
60432
- var yCenter=rtButton.Top+rtButton.Height/2;
60433
- var xCenter=rtButton.Left+rtButton.Width/2;
60549
+ var item=this.AryShowButton[i];
60550
+ var icon=item.Data;
60434
60551
 
60435
- var icon=this.Button.SettingIcon;
60436
- this.Canvas.font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60437
- this.Canvas.textAlign="center";
60438
- this.Canvas.textBaseline="middle";
60439
- this.Canvas.fillStyle=icon.Color;
60440
- this.Canvas.fillText(this.Button.SettingIcon.Text,xCenter,yCenter);
60441
-
60442
- this.AryButton.push({Rect:rtButton, ID:icon.ID, TooltipText:icon.TooltipText});
60443
-
60444
- /*
60445
- if (this.ColseButtonSize>0)
60446
- {
60447
- var xLine=rtButton.Right+this.ButtonSpace/2;
60448
- xLine=ToFixedPoint(xLine);
60449
- this.Canvas.strokeStyle=this.ButtonSplitLineColor;
60450
- this.Canvas.beginPath();
60451
- this.Canvas.moveTo(xLine,rtButton.Top);
60452
- this.Canvas.lineTo(xLine,rtButton.Bottom);
60453
- this.Canvas.stroke();
60454
- }
60455
- */
60456
-
60457
- left=rtButton.Right+this.ButtonSpace;
60458
- }
60459
-
60460
- if (this.Button.CloseIcon && this.Button.CloseIcon.Text)
60461
- {
60462
- var rtButton={Left:left, Top:drawTop, Width:this.ColseButtonSize, Height:drawHeight };
60552
+ var rtButton={Left:left, Top:drawTop, Width:item.Width, Height:drawHeight };
60463
60553
  rtButton.Right=rtButton.Left+rtButton.Width;
60464
60554
  rtButton.Bottom=rtButton.Top+rtButton.Height;
60465
60555
  var yCenter=rtButton.Top+rtButton.Height/2;
60466
60556
  var xCenter=rtButton.Left+rtButton.Width/2;
60467
- var icon=this.Button.CloseIcon;
60468
- this.Canvas.font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60557
+
60558
+ var font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60559
+ this.Canvas.font=font;
60469
60560
  this.Canvas.textAlign="center";
60470
60561
  this.Canvas.textBaseline="middle";
60471
60562
  this.Canvas.fillStyle=icon.Color;
60472
- this.Canvas.fillText(this.Button.CloseIcon.Text,xCenter,yCenter);
60563
+ this.Canvas.fillText(icon.Text,xCenter,yCenter);
60473
60564
 
60474
60565
  this.AryButton.push({Rect:rtButton,ID:icon.ID, TooltipText:icon.TooltipText });
60475
60566
 
60476
60567
  left=rtButton.Right;
60477
60568
  }
60478
-
60479
- rtDraw.Right=rtBG.Right;
60480
60569
  }
60481
60570
 
60482
60571
  this.PtInButtons=function(x,y)
@@ -116973,6 +117062,7 @@ function OverlayScriptIndex(name,script,args,option)
116973
117062
 
116974
117063
  titlePaint.OverlayIndex.get(overlayIndex.Identify).Data[id]=new DynamicTitleData(chart.Data,varItem.Name,clrTitle);
116975
117064
 
117065
+ this.SetChartIndexName(chart);
116976
117066
  frame.ChartPaint.push(chart);
116977
117067
  }
116978
117068
 
@@ -117327,6 +117417,7 @@ function OverlayScriptIndex(name,script,args,option)
117327
117417
 
117328
117418
  //var titleIndex=windowIndex+1;
117329
117419
  //hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(bar.Data,varItem.Name,bar.Color);
117420
+ this.SetChartIndexName(chart);
117330
117421
  frame.ChartPaint.push(chart);
117331
117422
  }
117332
117423
 
@@ -131875,7 +131966,7 @@ function ScrollBarBGChart()
131875
131966
 
131876
131967
 
131877
131968
 
131878
- var HQCHART_VERSION="1.1.13205";
131969
+ var HQCHART_VERSION="1.1.13209";
131879
131970
 
131880
131971
  function PrintHQChartVersion()
131881
131972
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13205";
8
+ var HQCHART_VERSION="1.1.13209";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {