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.
@@ -6597,7 +6597,12 @@ var JSCHART_MENU_ID=
6597
6597
  CMD_SHOW_BEFORE_DATA_ID:24, //显示|隐藏集合竞价
6598
6598
 
6599
6599
  CMD_SELECTED_ZOOM_ID:25, //选中放大
6600
- CMD_SELECTED_SUMMARY_ID:26, //区间统计
6600
+ CMD_SELECTED_SUMMARY_ID:26, //区间统计
6601
+
6602
+ CMD_SHOW_INDEX_ID:27, //显示隐藏指标
6603
+ CMD_SHOW_OVERLAY_INDEX_ID:28, //显示隐藏叠加指标
6604
+ CMD_DELETE_OVERLAY_INDEX_ID:29, //删除叠加指标
6605
+ CMD_SHOW_OVERLAY_Y_AXIS_ID:30, //显示隐藏Y轴叠加指标
6601
6606
  }
6602
6607
 
6603
6608
 
@@ -11942,19 +11947,27 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11942
11947
  {
11943
11948
  this.ChartDrawPicture=[];
11944
11949
  if (this.ChartDrawStorage) this.ChartDrawStorage.Clear();
11945
-
11950
+ this.SelectChartDrawPicture=null;
11951
+
11946
11952
  if (option && option.Draw==false) bDraw=false;
11947
11953
  if (bDraw) this.Draw();
11948
11954
  }
11949
11955
  else
11950
11956
  {
11951
- for(var i in this.ChartDrawPicture)
11957
+ for(var i=0; i<this.ChartDrawPicture.length; ++i)
11952
11958
  {
11953
- if (this.ChartDrawPicture[i]==drawPicture)
11959
+ var item=this.ChartDrawPicture[i];
11960
+ if (item.Guid==drawPicture.Guid || item==drawPicture)
11954
11961
  {
11955
11962
  if (this.ChartDrawStorage) this.ChartDrawStorage.DeleteDrawData(drawPicture);
11956
11963
  this.ChartDrawPicture.splice(i,1);
11957
11964
 
11965
+ if (this.SelectChartDrawPicture) //去掉选中
11966
+ {
11967
+ if (this.SelectChartDrawPicture.Guid==drawPicture.Guid || this.SelectChartDrawPicture==drawPicture)
11968
+ this.SelectChartDrawPicture=null;
11969
+ }
11970
+
11958
11971
  if (option && option.Draw==false) bDraw=false;
11959
11972
  if (bDraw) this.Draw();
11960
11973
  }
@@ -12156,6 +12169,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
12156
12169
  if (IFrameSplitOperator.IsNumber(item.OverlayIndexType.Position)) frame.OverlayIndexType.Position=item.OverlayIndexType.Position;
12157
12170
  if (IFrameSplitOperator.IsNumber(item.OverlayIndexType.LineSpace)) frame.OverlayIndexType.LineSpace=item.OverlayIndexType.LineSpace;
12158
12171
  }
12172
+
12173
+ if (IFrameSplitOperator.IsNonEmptyArray(item.CustomToolbar)) //自定义工具按钮
12174
+ {
12175
+ frame.CustomToolbar=item.CustomToolbar.slice();
12176
+ }
12159
12177
  }
12160
12178
 
12161
12179
  if (IFrameSplitOperator.IsNumber(option.SplitCount)) subFrame.Frame.YSplitOperator.SplitCount=option.SplitCount;
@@ -13192,9 +13210,92 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
13192
13210
  var dlg=new KLineSelectRectDialog(this.DivElement);
13193
13211
  dlg.DoModal(srcParam);
13194
13212
  break;
13213
+
13214
+ case JSCHART_MENU_ID.CMD_SHOW_INDEX_ID: //显示隐藏指标 [0]=windowIndex [1]=0=自动 1=隐藏 2=显示
13215
+ if (param==null || !IFrameSplitOperator.IsNumber(aryArgs[1])) return false;
13216
+ var windowIndex=param, showType=aryArgs[1];
13217
+ var script=this.WindowIndex[windowIndex];
13218
+ if (!script) return false;
13219
+
13220
+ if (showType==1) script.IsShow=false;
13221
+ else if (showType==2) script.IsShow=true;
13222
+ else script.IsShow=!script.IsShow;
13223
+
13224
+ this.UpdateWindowIndex(windowIndex);
13225
+ break;
13226
+
13227
+ case JSCHART_MENU_ID.CMD_SHOW_OVERLAY_INDEX_ID: //显示隐藏叠加指标 [0]=indexGuid [1]=0=自动 1=隐藏 2=显示
13228
+ if (!srcParam || !IFrameSplitOperator.IsNumber(aryArgs[1])) return false;
13229
+ var indexGuid=srcParam,showType=aryArgs[1];
13230
+
13231
+ var overlay=this.GetOverlayIndexByIdentify(indexGuid);
13232
+ if (!overlay || !overlay.OverlayItem || !overlay.OverlayItem.Script) return false;
13233
+
13234
+ var script=overlay.OverlayItem.Script;
13235
+
13236
+ if (showType==1) script.IsShow=false;
13237
+ else if (showType==2) script.IsShow==true;
13238
+ else script.IsShow=!script.IsShow;
13239
+
13240
+ this.UpdateOverlayIndex(indexGuid);
13241
+ break;
13242
+ case JSCHART_MENU_ID.CMD_DELETE_OVERLAY_INDEX_ID:
13243
+ if (srcParam && this.DeleteOverlayWindowsIndex)
13244
+ this.DeleteOverlayWindowsIndex(srcParam);
13245
+ break;
13246
+ case JSCHART_MENU_ID.CMD_SHOW_OVERLAY_Y_AXIS_ID:
13247
+ if (!srcParam || !IFrameSplitOperator.IsNumber(aryArgs[1])) return false;
13248
+ if (!this.GetOverlayIndexByIdentify) return false;
13249
+
13250
+ var indexGuid=srcParam,showType=aryArgs[1];
13251
+ var finder=this.GetOverlayIndexByIdentify(indexGuid);
13252
+ if (!finder || !finder.OverlayItem) return false;
13253
+
13254
+ var frame=finder.OverlayItem.Frame;
13255
+ if (showType==1) frame.IsShow=false;
13256
+ else if (showType==2) frame.IsShow==true;
13257
+ else frame.IsShow=!frame.IsShow;
13258
+
13259
+ this.UpdataDataoffset(); //更新数据偏移
13260
+ this.UpdateFrameMaxMin(); //调整坐标最大 最小值
13261
+ this.Draw();
13262
+
13263
+ break;
13195
13264
  }
13196
13265
  }
13197
13266
 
13267
+ this.GetShowIndexMenuData=function(windowIndex, showType)
13268
+ {
13269
+ var script=this.WindowIndex[windowIndex];
13270
+ if (!script) return null;
13271
+
13272
+ var data= { Name:script.IsShow?"隐藏指标":"显示指标", Data:{ ID: JSCHART_MENU_ID.CMD_SHOW_INDEX_ID, Args:[windowIndex, 0] } };
13273
+
13274
+ return data;
13275
+ }
13276
+
13277
+ this.GetShowOverlayIndexMenuData=function(indexGuid, showType)
13278
+ {
13279
+ var overlay=this.GetOverlayIndexByIdentify(indexGuid);
13280
+ if (!overlay || !overlay.OverlayItem || !overlay.OverlayItem.Script) return null;
13281
+
13282
+ var script=overlay.OverlayItem.Script;
13283
+ var data= { Name:script.IsShow?"隐藏指标":"显示指标", Data:{ ID: JSCHART_MENU_ID.CMD_SHOW_OVERLAY_INDEX_ID, Args:[indexGuid, 0] } };
13284
+
13285
+ return data;
13286
+ }
13287
+
13288
+ this.GetShowOverlayIndexYAxisMenuData=function(indexGuid, showType)
13289
+ {
13290
+ var overlay=this.GetOverlayIndexByIdentify(indexGuid);
13291
+ if (!overlay || !overlay.OverlayItem || !overlay.OverlayItem.Script) return null;
13292
+
13293
+ var frame=overlay.OverlayItem.Frame;
13294
+ var data= { Name:frame.IsShow?"隐藏Y轴":"显示Y轴", Data:{ ID: JSCHART_MENU_ID.CMD_SHOW_OVERLAY_Y_AXIS_ID, Args:[indexGuid, 0] } };
13295
+
13296
+ return data;
13297
+ }
13298
+
13198
13299
  //点击右键菜单
13199
13300
  this.OnClickRightMenu=function(data)
13200
13301
  {
@@ -57699,7 +57800,7 @@ function DynamicChartTitlePainting()
57699
57800
  var rtButton={ Left:left, YCenter:yCenter };
57700
57801
  this.DrawButton(item, rtButton, moveonPoint, mouseStatus);
57701
57802
 
57702
- this.Buttons.push({ ID:item.ID, Rect:rtButton, FrameID:this.Frame.Identify, Type:1, OverlayID:toolbarInfo.ID, Title:overlayItem.Title });
57803
+ this.Buttons.push({ ID:item.ID, Rect:rtButton, FrameID:this.Frame.Identify, Type:1, OverlayID:toolbarInfo.ID, Title:overlayItem.Title, Data:item.Data });
57703
57804
 
57704
57805
  left=rtButton.Right;
57705
57806
 
@@ -59929,11 +60030,14 @@ function ChartDrawHLine()
59929
60030
 
59930
60031
  this.Button=
59931
60032
  {
59932
- CloseIcon: { Text:'\ue62b', Color:'rgb(255,255,255)', Family:"iconfont", Size:16, ID:JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE, TooltipText:null },
59933
- SettingIcon: { Text:'\ue623',Color:'rgb(255,255,255)', Family:"iconfont", Size:16, ID:JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING, TooltipText:null }
60033
+ 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 } },
60034
+ 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 } }
59934
60035
  //修改ID, Text , TooltipText 可以外部定制按钮
59935
60036
  }
59936
60037
 
60038
+ this.CustomButton=[]; //自定义的按钮 { Text:'\ue62b', Color:'rgb(255,255,255)', Family:"iconfont", Size:16, ID:JSCHART_BUTTON_ID.DRAW_PICTURE_BUTTON_1, TooltipText:null }
60039
+
60040
+ this.AryShowButton=[]; //需要显示的按钮 { Data:, Width }
59937
60041
  this.AryButton=[];
59938
60042
  this.ExtendData; //扩展数据
59939
60043
  this.ShowPriceTextConfig=
@@ -60039,8 +60143,32 @@ function ChartDrawHLine()
60039
60143
  this.Draw();
60040
60144
  }
60041
60145
 
60146
+ //获取需要显示的按钮 系统按钮+自定义按钮
60147
+ this.GetShowButton=function()
60148
+ {
60149
+ var aryButton=[];
60150
+
60151
+ var item=this.Button.SettingIcon;
60152
+ if (item && item.Text) aryButton.push({ Data:item, Width:null });
60153
+
60154
+ item=this.Button.CloseIcon;
60155
+ if (item && item.Text) aryButton.push({ Data:item, Width:null });
60156
+
60157
+ if (IFrameSplitOperator.IsNonEmptyArray(this.CustomButton))
60158
+ {
60159
+ for(var i=0;i<this.CustomButton.length;++i)
60160
+ {
60161
+ item=this.CustomButton[i];
60162
+ if (item && item.Text) aryButton.push({ Data:item, Width:null });
60163
+ }
60164
+ }
60165
+
60166
+ return aryButton;
60167
+ }
60168
+
60042
60169
  this.Draw=function(moveonPoint, mouseStatus)
60043
60170
  {
60171
+ this.AryShowButton=[];
60044
60172
  this.LinePoint=[];
60045
60173
  this.AryButton=[];
60046
60174
  this.ColseButtonSize=0;
@@ -60116,6 +60244,8 @@ function ChartDrawHLine()
60116
60244
  var labInfo;
60117
60245
  if (this.GetLabelCallback) labInfo=this.GetLabelCallback(this);
60118
60246
 
60247
+ this.AryShowButton=this.GetShowButton(); //获取按钮
60248
+
60119
60249
  //描述信息
60120
60250
  if (labInfo)
60121
60251
  this.DrawLab(labInfo, drawPoint[0].Y);
@@ -60419,42 +60549,33 @@ function ChartDrawHLine()
60419
60549
  {
60420
60550
  var pixelRatio=GetDevicePixelRatio();
60421
60551
 
60422
- if (this.Button.SettingIcon)
60423
- {
60424
- var icon=this.Button.SettingIcon;
60425
- var font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60426
- this.Canvas.font=font;
60427
- var width=this.Canvas.measureText(icon.Text).width;
60428
- this.SettingButtonSize=width;
60429
- }
60552
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton)) return;
60430
60553
 
60431
- if (this.Button.CloseIcon)
60554
+ var totalWidth=0;
60555
+ for(var i=0;i<this.AryShowButton.length;++i)
60432
60556
  {
60433
- var icon=this.Button.CloseIcon;
60557
+ var item=this.AryShowButton[i];
60558
+ var icon=item.Data;
60434
60559
  var font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60435
60560
  this.Canvas.font=font;
60436
- var width=this.Canvas.measureText(icon.Text).width;
60437
- this.ColseButtonSize=width;
60438
- }
60561
+ item.Width=this.Canvas.measureText(icon.Text).width+2;
60439
60562
 
60440
- if (this.ColseButtonSize<=0 && this.SettingButtonSize<=0) return;
60563
+ if (icon.Margin)
60564
+ {
60565
+ var margin=icon.Margin;
60566
+ if (IFrameSplitOperator.IsNumber(margin.Left)) item.Width+=margin.Left;
60567
+ if (IFrameSplitOperator.IsNumber(margin.Right)) item.Width+=margin.Right;
60568
+ }
60441
60569
 
60442
- var buttonWidth=0
60443
- if (this.SettingButtonSize>0) buttonWidth+=this.SettingButtonSize;
60444
- if (this.ColseButtonSize>0)
60445
- {
60446
- if (buttonWidth>0) buttonWidth+=this.ButtonSpace;
60447
- buttonWidth+=this.ColseButtonSize;
60570
+ totalWidth+=item.Width;
60448
60571
  }
60449
60572
 
60450
- buttonWidth+=4;
60451
-
60452
- this.ButtonBGWidth=buttonWidth;
60573
+ this.ButtonBGWidth=totalWidth;
60453
60574
  }
60454
60575
 
60455
60576
  this.DrawButton=function(drawTop, drawLeft, drawHeight, rtDraw)
60456
60577
  {
60457
- if (this.ColseButtonSize<=0 && this.SettingButtonSize<=0) return;
60578
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton)) return;
60458
60579
 
60459
60580
  if (this.ButtonPosition==1) drawTop-=drawHeight;
60460
60581
 
@@ -60466,61 +60587,29 @@ function ChartDrawHLine()
60466
60587
  this.Canvas.fillStyle=this.ButtonBGColor;
60467
60588
  this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top), ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));
60468
60589
 
60469
- left+=1;
60470
60590
  var pixelRatio=GetDevicePixelRatio();
60471
- if (this.Button.SettingIcon && this.Button.SettingIcon.Text)
60591
+ for(var i=0;i<this.AryShowButton.length;++i)
60472
60592
  {
60473
- var rtButton={Left:left, Top:drawTop, Width:this.SettingButtonSize, Height:drawHeight };
60474
- rtButton.Right=rtButton.Left+rtButton.Width;
60475
- rtButton.Bottom=rtButton.Top+rtButton.Height;
60476
- var yCenter=rtButton.Top+rtButton.Height/2;
60477
- var xCenter=rtButton.Left+rtButton.Width/2;
60593
+ var item=this.AryShowButton[i];
60594
+ var icon=item.Data;
60478
60595
 
60479
- var icon=this.Button.SettingIcon;
60480
- this.Canvas.font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60481
- this.Canvas.textAlign="center";
60482
- this.Canvas.textBaseline="middle";
60483
- this.Canvas.fillStyle=icon.Color;
60484
- this.Canvas.fillText(this.Button.SettingIcon.Text,xCenter,yCenter);
60485
-
60486
- this.AryButton.push({Rect:rtButton, ID:icon.ID, TooltipText:icon.TooltipText});
60487
-
60488
- /*
60489
- if (this.ColseButtonSize>0)
60490
- {
60491
- var xLine=rtButton.Right+this.ButtonSpace/2;
60492
- xLine=ToFixedPoint(xLine);
60493
- this.Canvas.strokeStyle=this.ButtonSplitLineColor;
60494
- this.Canvas.beginPath();
60495
- this.Canvas.moveTo(xLine,rtButton.Top);
60496
- this.Canvas.lineTo(xLine,rtButton.Bottom);
60497
- this.Canvas.stroke();
60498
- }
60499
- */
60500
-
60501
- left=rtButton.Right+this.ButtonSpace;
60502
- }
60503
-
60504
- if (this.Button.CloseIcon && this.Button.CloseIcon.Text)
60505
- {
60506
- var rtButton={Left:left, Top:drawTop, Width:this.ColseButtonSize, Height:drawHeight };
60596
+ var rtButton={Left:left, Top:drawTop, Width:item.Width, Height:drawHeight };
60507
60597
  rtButton.Right=rtButton.Left+rtButton.Width;
60508
60598
  rtButton.Bottom=rtButton.Top+rtButton.Height;
60509
60599
  var yCenter=rtButton.Top+rtButton.Height/2;
60510
60600
  var xCenter=rtButton.Left+rtButton.Width/2;
60511
- var icon=this.Button.CloseIcon;
60512
- this.Canvas.font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60601
+
60602
+ var font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60603
+ this.Canvas.font=font;
60513
60604
  this.Canvas.textAlign="center";
60514
60605
  this.Canvas.textBaseline="middle";
60515
60606
  this.Canvas.fillStyle=icon.Color;
60516
- this.Canvas.fillText(this.Button.CloseIcon.Text,xCenter,yCenter);
60607
+ this.Canvas.fillText(icon.Text,xCenter,yCenter);
60517
60608
 
60518
60609
  this.AryButton.push({Rect:rtButton,ID:icon.ID, TooltipText:icon.TooltipText });
60519
60610
 
60520
60611
  left=rtButton.Right;
60521
60612
  }
60522
-
60523
- rtDraw.Right=rtBG.Right;
60524
60613
  }
60525
60614
 
60526
60615
  this.PtInButtons=function(x,y)
@@ -117017,6 +117106,7 @@ function OverlayScriptIndex(name,script,args,option)
117017
117106
 
117018
117107
  titlePaint.OverlayIndex.get(overlayIndex.Identify).Data[id]=new DynamicTitleData(chart.Data,varItem.Name,clrTitle);
117019
117108
 
117109
+ this.SetChartIndexName(chart);
117020
117110
  frame.ChartPaint.push(chart);
117021
117111
  }
117022
117112
 
@@ -117371,6 +117461,7 @@ function OverlayScriptIndex(name,script,args,option)
117371
117461
 
117372
117462
  //var titleIndex=windowIndex+1;
117373
117463
  //hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(bar.Data,varItem.Name,bar.Color);
117464
+ this.SetChartIndexName(chart);
117374
117465
  frame.ChartPaint.push(chart);
117375
117466
  }
117376
117467
 
@@ -134788,7 +134879,7 @@ function HQChartScriptWorker()
134788
134879
 
134789
134880
 
134790
134881
 
134791
- var HQCHART_VERSION="1.1.13205";
134882
+ var HQCHART_VERSION="1.1.13209";
134792
134883
 
134793
134884
  function PrintHQChartVersion()
134794
134885
  {