hqchart 1.1.14778 → 1.1.14787

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.
@@ -637,7 +637,7 @@ JSIndexScript.prototype.MACD=function()
637
637
  {
638
638
  let data=
639
639
  {
640
- Name:'MACD', Description:'平滑异同平均', IsMainIndex:false,
640
+ Name:'MACD', Description:'平滑异同平均', IsMainIndex:false,FloatPrecision:3,
641
641
  Args:[ { Name:'SHORT', Value:12}, { Name:'LONG', Value:26}, { Name:'MID', Value:9} ],
642
642
  Script: //脚本
643
643
  'DIF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);\n\
@@ -79757,6 +79757,8 @@ function JSChartResource()
79757
79757
  Selected:
79758
79758
  {
79759
79759
  BGColor:"rgb(180,240,240)",
79760
+ LineColor:"rgb(128,128,128)",
79761
+ LineWidth:2,
79760
79762
  }
79761
79763
  },
79762
79764
 
@@ -80876,6 +80878,8 @@ function JSChartResource()
80876
80878
  {
80877
80879
  var subItem=item.Selected;
80878
80880
  if (subItem.BGColor) this.DealList.Selected.BGColor=subItem.BGColor;
80881
+ if (subItem.LineColor) this.DealList.Selected.LineColor=subItem.LineColor;
80882
+ if (IFrameSplitOperator.IsPlusNumber(subItem.LineWidth)) this.DealList.Selected.LineWidth=subItem.LineWidth;
80879
80883
  }
80880
80884
  }
80881
80885
 
@@ -80890,7 +80894,7 @@ function JSChartResource()
80890
80894
  if (IFrameSplitOperator.IsNumber(item.Radius)) this.SelectedChart.Radius=item.Radius;
80891
80895
  if (IFrameSplitOperator.IsNumber(item.MinSpace)) this.SelectedChart.MinSpace=item.MinSpace;
80892
80896
  if (item.LineColor) this.SelectedChart.LineColor=item.LineColor;
80893
- if (item.LineColor) this.SelectedChart.BGColor=item.BGColor;
80897
+ if (item.BGColor) this.SelectedChart.BGColor=item.BGColor;
80894
80898
  }
80895
80899
 
80896
80900
  if (style.DragMovePaint)
@@ -133551,7 +133555,8 @@ function GetBlackStyle()
133551
133555
 
133552
133556
  Selected:
133553
133557
  {
133554
- BGColor:"rgb(49,48,56)",
133558
+ BGColor:"rgba(49,48,56,0.7)",
133559
+ LineColor:"rgb(220,220,220)",
133555
133560
  }
133556
133561
  },
133557
133562
 
@@ -133924,6 +133929,7 @@ function JSDealChart(divElement)
133924
133929
  }
133925
133930
 
133926
133931
  if (option.MinuteChartTooltip && option.MinuteChartTooltip.Enable) chart.InitalMinuteChartTooltip(option.MinuteChartTooltip);
133932
+ if (option.FloatTooltip && option.FloatTooltip.Enable) chart.InitalFloatTooltip(option.FloatTooltip); //提示信息
133927
133933
 
133928
133934
  if (!option.Symbol)
133929
133935
  {
@@ -133952,6 +133958,12 @@ function JSDealChart(divElement)
133952
133958
  if (option.AutoUpdateFrequency>0) chart.AutoUpdateFrequency=option.AutoUpdateFrequency;
133953
133959
  if (IFrameSplitOperator.IsBool(option.EnableFilter)) chart.EnableFilter=option.EnableFilter;
133954
133960
 
133961
+ var dealChart=chart.GetDealChart();
133962
+ if (dealChart)
133963
+ {
133964
+ if (IFrameSplitOperator.IsNumber(option.SelectedStyle)) dealChart.SelectedStyle=option.SelectedStyle;
133965
+ }
133966
+
133955
133967
  //注册事件
133956
133968
  if (option.EventCallback)
133957
133969
  {
@@ -134067,6 +134079,7 @@ function JSDealChartContainer(uielement)
134067
134079
  this.LoadDataSplashTitle="数据加载中"; //下载数据提示信息
134068
134080
 
134069
134081
  this.TooltipMinuteChart; //分时图
134082
+ this.FloatTooltip; //提示浮框
134070
134083
 
134071
134084
  this.UIElement=uielement;
134072
134085
  this.LastPoint=new Point(); //鼠标位置
@@ -134080,6 +134093,9 @@ function JSDealChartContainer(uielement)
134080
134093
  {
134081
134094
  this.IsDestroy=true;
134082
134095
  this.StopAutoUpdate();
134096
+
134097
+ this.DestroyMinuteChartTooltip();
134098
+ this.DestroyFloatTooltip();
134083
134099
  }
134084
134100
 
134085
134101
  this.EnableFilterData=false; //是否启动筛选
@@ -134124,9 +134140,55 @@ function JSDealChartContainer(uielement)
134124
134140
  this.TooltipMinuteChart.Hide();
134125
134141
  }
134126
134142
 
134143
+ this.HideFloatTooltip=function()
134144
+ {
134145
+ if (!this.FloatTooltip) return;
134146
+
134147
+ this.FloatTooltip.Hide();
134148
+ }
134149
+
134150
+ this.DestroyFloatTooltip=function()
134151
+ {
134152
+ if (!this.FloatTooltip) return;
134153
+
134154
+ this.FloatTooltip.Destroy();
134155
+ this.FloatTooltip=null;
134156
+ }
134157
+
134158
+ this.InitalFloatTooltip=function(option)
134159
+ {
134160
+ if (this.FloatTooltip) return;
134161
+
134162
+ this.FloatTooltip=new JSFloatTooltip();
134163
+ this.FloatTooltip.Inital(this, option);
134164
+ this.FloatTooltip.Create();
134165
+ }
134166
+
134167
+ this.DrawFloatTooltip=function(point,toolTip)
134168
+ {
134169
+ if (!this.FloatTooltip) return;
134170
+
134171
+ this.UpdateFloatTooltip(point, toolTip)
134172
+ }
134173
+
134174
+ this.UpdateFloatTooltip=function(point, toolTip)
134175
+ {
134176
+ if (!this.FloatTooltip) return;
134177
+
134178
+ var sendData=
134179
+ {
134180
+ Tooltip:toolTip,
134181
+ Point:point,
134182
+ DataType:5,
134183
+ };
134184
+
134185
+ this.FloatTooltip.Update(sendData);
134186
+ }
134187
+
134127
134188
  this.HideAllTooltip=function()
134128
134189
  {
134129
134190
  this.HideMinuteChartTooltip();
134191
+ this.HideFloatTooltip();
134130
134192
  }
134131
134193
 
134132
134194
  //筛选数据
@@ -134238,6 +134300,8 @@ function JSDealChartContainer(uielement)
134238
134300
  this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
134239
134301
  this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
134240
134302
  this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e);}
134303
+ this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
134304
+ this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
134241
134305
  }
134242
134306
 
134243
134307
  this.Draw=function()
@@ -134436,12 +134500,17 @@ function JSDealChartContainer(uielement)
134436
134500
  }
134437
134501
  }
134438
134502
 
134503
+ this.GetDealChart=function()
134504
+ {
134505
+ return this.ChartPaint[0];
134506
+ }
134507
+
134439
134508
  this.RecvDealUpdateData=function(data)
134440
134509
  {
134441
134510
  var aryDeal=JSDealChartContainer.JsonDataToDealData(data);
134442
134511
  if (!IFrameSplitOperator.IsNonEmptyArray(aryDeal)) return;
134443
134512
 
134444
- var chart=this.ChartPaint[0];
134513
+ var chart=this.GetDealChart();
134445
134514
  if (!chart) return;
134446
134515
 
134447
134516
  if (data.UpdateType===1) //全量更新
@@ -134512,7 +134581,14 @@ function JSDealChartContainer(uielement)
134512
134581
 
134513
134582
  var self = this;
134514
134583
  var marketStatus=MARKET_SUFFIX_NAME.GetMarketStatus(this.Symbol);
134515
- if (marketStatus==0 || marketStatus==3) return; //闭市,盘后
134584
+ if (marketStatus==0 || marketStatus==3) //闭市,盘后
134585
+ {
134586
+ this.AutoUpdateTimer=setTimeout(function()
134587
+ {
134588
+ self.AutoUpdate();
134589
+ },20000);
134590
+ return;
134591
+ }
134516
134592
 
134517
134593
  var frequency=this.AutoUpdateFrequency;
134518
134594
  if (marketStatus==1) //盘前
@@ -134714,13 +134790,12 @@ function JSDealChartContainer(uielement)
134714
134790
  chartTooltipData={ Symbol:tooltipData.Stock.OriginalSymbol, Rect:tooltipData.Rect };
134715
134791
  }
134716
134792
  }
134793
+ */
134717
134794
  else
134718
134795
  {
134719
134796
  this.LastMouseStatus.TooltipStatus={ X:x, Y:y, Data:tooltipData, ClientX:e.clientX, ClientY:e.clientY };
134720
134797
  bDrawTooltip=true;
134721
134798
  }
134722
- */
134723
-
134724
134799
  }
134725
134800
  }
134726
134801
 
@@ -134728,6 +134803,17 @@ function JSDealChartContainer(uielement)
134728
134803
 
134729
134804
  if (bDraw) this.Draw();
134730
134805
 
134806
+ if (this.LastMouseStatus.TooltipStatus)
134807
+ {
134808
+ var xTooltip = e.clientX-this.UIElement.getBoundingClientRect().left;
134809
+ var yTooltip = e.clientY-this.UIElement.getBoundingClientRect().top;
134810
+ this.DrawFloatTooltip({X:xTooltip, Y:yTooltip, YMove:20/pixelTatio},this.LastMouseStatus.TooltipStatus.Data);
134811
+ }
134812
+ else
134813
+ {
134814
+ this.HideFloatTooltip();
134815
+ }
134816
+
134731
134817
  if (!bShowMinuteTooltip) this.HideMinuteChartTooltip();
134732
134818
  if (bShowMinuteTooltip) this.ShowMinuteChartTooltip(null, null, chartTooltipData);
134733
134819
  }
@@ -134747,6 +134833,16 @@ function JSDealChartContainer(uielement)
134747
134833
  e.preventDefault();
134748
134834
  }
134749
134835
 
134836
+ this.UIOnMounseOut=function(e)
134837
+ {
134838
+ this.HideAllTooltip();
134839
+ }
134840
+
134841
+ this.UIOnMouseleave=function(e)
134842
+ {
134843
+ this.HideAllTooltip();
134844
+ }
134845
+
134750
134846
  this.GotoNextPage=function()
134751
134847
  {
134752
134848
  if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return false;
@@ -134846,8 +134942,9 @@ JSDealChartContainer.JsonDataToDealData=function(data)
134846
134942
  if (item[5]) dealItem.StrTime=item[5];
134847
134943
  if (item[6]) dealItem.ID=item[6];
134848
134944
 
134849
- if (item[11]) dealItem.Symbol=item[11]; //股票代码
134850
- if (item[12]) dealItem.Name=item[12]; //股票名称
134945
+ if (item[11]) dealItem.Symbol=item[11]; //股票代码
134946
+ if (item[12]) dealItem.Name=item[12]; //股票名称
134947
+ if (item[13]) dealItem.BGColor=item[13]; //整行颜色
134851
134948
 
134852
134949
  if (item[100]) dealItem.Guid=item[100];
134853
134950
 
@@ -135063,7 +135160,8 @@ function ChartDealList()
135063
135160
 
135064
135161
  this.BorderColor=g_JSChartResource.DealList.BorderColor; //边框线
135065
135162
 
135066
- this.SelectedConfig={ BGColor:g_JSChartResource.DealList.Selected.BGColor };
135163
+ this.SelectedConfig={ BGColor:g_JSChartResource.DealList.Selected.BGColor, LineColor:g_JSChartResource.DealList.Selected.LineColor, LineWidth:g_JSChartResource.DealList.Selected.LineWidth };
135164
+ this.SelectedStyle=1; //选中行样式 1=整行填充 2=底部绘制直线
135067
135165
 
135068
135166
  //表头配置
135069
135167
  this.HeaderFontConfig={ Size:g_JSChartResource.DealList.Header.Font.Size, Name:g_JSChartResource.DealList.Header.Font.Name };
@@ -135385,6 +135483,7 @@ function ChartDealList()
135385
135483
  var left=this.RectClient.Left+this.HeaderMergin.Left;
135386
135484
  var dataCount=this.Data.Data.length;
135387
135485
  var index=this.Data.DataOffset;
135486
+ var selectedRowData=null;
135388
135487
 
135389
135488
  if (this.ShowOrder==1)
135390
135489
  {
@@ -135399,8 +135498,8 @@ function ChartDealList()
135399
135498
  for(j=0;j<this.RowCount && index>=0;++j, --index)
135400
135499
  {
135401
135500
  var dataItem=this.Data.Data[index];
135402
- this.DrawSelectedRow(dataItem, index, rtRow);
135403
-
135501
+ this.DrawSelectedRow(dataItem, index, rtRow)
135502
+
135404
135503
  this.DrawRow(dataItem, textLeft, textTop, index);
135405
135504
 
135406
135505
  textTop+=this.RowHeight;
@@ -135421,7 +135520,14 @@ function ChartDealList()
135421
135520
  rtRow.Right=rtRow.Left+rtRow.Width;
135422
135521
  rtRow.Bottom=rtRow.Top+rtRow.Height;
135423
135522
 
135424
- this.DrawSelectedRow(dataItem, index, rtRow);
135523
+ if (dataItem.BGColor)
135524
+ {
135525
+ this.Canvas.fillStyle=dataItem.BGColor;
135526
+ this.Canvas.fillRect(rtRow.Left,rtRow.Top, rtRow.Width, rtRow.Height);
135527
+ }
135528
+
135529
+ if (this.DrawSelectedRow(dataItem, index, rtRow))
135530
+ selectedRowData={ Rect:rtRow };
135425
135531
 
135426
135532
  this.DrawRow(dataItem, textLeft, textTop, index);
135427
135533
 
@@ -135430,6 +135536,14 @@ function ChartDealList()
135430
135536
  textTop+=this.RowHeight;
135431
135537
  }
135432
135538
  }
135539
+
135540
+ if (selectedRowData && this.SelectedStyle===2)
135541
+ {
135542
+ var rtBG=selectedRowData.Rect;
135543
+ this.Canvas.fillStyle=this.SelectedConfig.LineColor;
135544
+ var lineWidth=this.SelectedConfig.LineWidth;
135545
+ this.Canvas.fillRect(rtBG.Left,rtBG.Bottom-lineWidth,rtBG.Width,lineWidth);
135546
+ }
135433
135547
  }
135434
135548
  }
135435
135549
 
@@ -135551,14 +135665,22 @@ function ChartDealList()
135551
135665
 
135552
135666
  if (bDrawV2)
135553
135667
  {
135554
- this.DrawItemText(drawInfo.Text, drawInfo.TextColor, drawInfo.TextAlign, rtItem.Left, rtItem.Top, rtItem.Width, drawInfo.BGColor);
135668
+ //this.DrawItemText(drawInfo.Text, drawInfo.TextColor, drawInfo.TextAlign, rtItem.Left, rtItem.Top, rtItem.Width, drawInfo.BGColor);
135669
+ this.DrawItemTextV2(drawInfo, rtItem);
135555
135670
  }
135556
135671
  else
135557
135672
  {
135558
135673
  this.DrawItemText(text, textColor, textAlign, left, top, itemWidth);
135559
135674
  }
135560
135675
 
135561
- if (item.ChartTooltip && item.ChartTooltip.Enable && IFrameSplitOperator.IsNumber(item.ChartTooltip.Type)) //Type 20分时图 21K线图
135676
+
135677
+ if (drawInfo.Tooltip)
135678
+ {
135679
+ //Type:2=数据提示信息
135680
+ var tooltipData={ Rect:rtItem, Data:data, Index:dataIndex, Column:item, Type:drawInfo.Tooltip.Type, Data:drawInfo.Tooltip.Data };
135681
+ this.TooltipRect.push(tooltipData);
135682
+ }
135683
+ else if (item.ChartTooltip && item.ChartTooltip.Enable && IFrameSplitOperator.IsNumber(item.ChartTooltip.Type)) //Type 20分时图 21K线图
135562
135684
  {
135563
135685
  var tooltipData={ Rect:rtItem, Data:data, Index:dataIndex, Column:item, Type:item.ChartTooltip.Type };
135564
135686
  this.TooltipRect.push(tooltipData);
@@ -135631,6 +135753,15 @@ function ChartDealList()
135631
135753
  {
135632
135754
  drawInfo.Text=item;
135633
135755
  }
135756
+
135757
+ if (item && item.Tooltip && IFrameSplitOperator.IsNonEmptyArray(item.Tooltip.AryText))
135758
+ {
135759
+ drawInfo.Tooltip=
135760
+ {
135761
+ Type:2,
135762
+ Data:{ AryText:item.Tooltip.AryText }
135763
+ }
135764
+ }
135634
135765
  }
135635
135766
 
135636
135767
  this.GetUpDownColor=function(price, price2)
@@ -135648,12 +135779,17 @@ function ChartDealList()
135648
135779
 
135649
135780
  this.DrawSelectedRow=function(data, index, rtRow)
135650
135781
  {
135651
- if (!this.SelectedData) return;
135652
- if (!this.SelectedData.Enable) return;
135653
- if (!this.SelectedData.Guid || this.SelectedData.Guid!=data.Guid) return;
135782
+ if (!this.SelectedData) return false;
135783
+ if (!this.SelectedData.Enable) return false;
135784
+ if (!this.SelectedData.Guid || this.SelectedData.Guid!=data.Guid) return false;
135654
135785
 
135655
- this.Canvas.fillStyle=this.SelectedConfig.BGColor;
135656
- this.Canvas.fillRect(rtRow.Left,rtRow.Top, rtRow.Width, rtRow.Height);
135786
+ if ( this.SelectedStyle==1)
135787
+ {
135788
+ this.Canvas.fillStyle=this.SelectedConfig.BGColor;
135789
+ this.Canvas.fillRect(rtRow.Left,rtRow.Top, rtRow.Width, rtRow.Height);
135790
+ }
135791
+
135792
+ return true;
135657
135793
  }
135658
135794
 
135659
135795
  this.DrawItemText=function(text, textColor, textAlign, left, top, width)
@@ -135674,9 +135810,44 @@ function ChartDealList()
135674
135810
  this.Canvas.textAlign="left";
135675
135811
  }
135676
135812
 
135677
- this.Canvas.textBaseline="middle";
135813
+ this.Canvas.textBaseline="bottom";
135678
135814
  this.Canvas.fillStyle=textColor;
135679
- if (text) this.Canvas.fillText(text,x,top+this.RowHeight/2);
135815
+ if (text) this.Canvas.fillText(text,x,top+this.RowHeight-2);
135816
+ }
135817
+
135818
+ this.DrawItemTextV2=function(drawInfo, rtItem)
135819
+ {
135820
+ if (drawInfo.BGColor)
135821
+ {
135822
+ this.Canvas.fillStyle=drawInfo.BGColor;
135823
+ this.Canvas.fillRect(rtItem.Left,rtItem.Top,rtItem.Width,rtItem.Height);
135824
+ }
135825
+
135826
+ if (drawInfo.Text)
135827
+ {
135828
+ var text=drawInfo.Text;
135829
+ var x=rtItem.Left;
135830
+ if (drawInfo.TextAlign=='center')
135831
+ {
135832
+ x=rtItem.Left+rtItem.Width/2;
135833
+ this.Canvas.textAlign="center";
135834
+ }
135835
+ else if (drawInfo.TextAlign=='right')
135836
+ {
135837
+ x=rtItem.Left+rtItem.Width-2;
135838
+ this.Canvas.textAlign="right";
135839
+ }
135840
+ else
135841
+ {
135842
+ x+=2;
135843
+ this.Canvas.textAlign="left";
135844
+ }
135845
+
135846
+ var textWidth=this.Canvas.measureText(text).width+1;
135847
+ this.Canvas.textBaseline="bottom";
135848
+ this.Canvas.fillStyle=drawInfo.TextColor;
135849
+ this.Canvas.fillText(text,x,rtItem.Top+this.RowHeight-2);
135850
+ }
135680
135851
  }
135681
135852
 
135682
135853
  this.DrawMultiBar=function(colunmInfo, data, rtItem)
@@ -136393,6 +136564,7 @@ function JSReportChartContainer(uielement)
136393
136564
  //
136394
136565
  this.TooltipMinuteChart; //分时图
136395
136566
  this.TooltipKLineChart; //分时图
136567
+ this.FloatTooltip; //提示浮框
136396
136568
 
136397
136569
  //MouseOnStatus:{ RowIndex:行, ColumnIndex:列}
136398
136570
  this.LastMouseStatus={ MoveStatus:null, TooltipStatus:null, MouseOnStatus:null };
@@ -156719,6 +156891,16 @@ function JSFloatTooltip()
156719
156891
  this.TReportIconTooltip(data);
156720
156892
  }
156721
156893
  }
156894
+ else if (data.DataType==5) //成交笔数
156895
+ {
156896
+ var tooltipData=data.Tooltip;
156897
+ if (!tooltipData) return;
156898
+
156899
+ if (tooltipData.Type==2) //提示信息
156900
+ {
156901
+ this.DealItemTooltip(data);
156902
+ }
156903
+ }
156722
156904
  }
156723
156905
 
156724
156906
  this.UpdateRealtimeHQTooltip=function(data)
@@ -157010,6 +157192,18 @@ function JSFloatTooltip()
157010
157192
 
157011
157193
  this.ShowTooltip(data);
157012
157194
  }
157195
+
157196
+ this.DealItemTooltip=function(data)
157197
+ {
157198
+ var tooltipData=data.Tooltip;
157199
+ if (!tooltipData.Data || !IFrameSplitOperator.IsNonEmptyArray(tooltipData.Data.AryText)) return;
157200
+
157201
+ this.AryText=tooltipData.Data.AryText;
157202
+
157203
+ this.UpdateTableDOM();
157204
+
157205
+ this.ShowTooltip(data);
157206
+ }
157013
157207
 
157014
157208
  this.UpdateTableDOM=function()
157015
157209
  {
@@ -159888,7 +160082,7 @@ function HQChartScriptWorker()
159888
160082
 
159889
160083
 
159890
160084
 
159891
- var HQCHART_VERSION="1.1.14777";
160085
+ var HQCHART_VERSION="1.1.14786";
159892
160086
 
159893
160087
  function PrintHQChartVersion()
159894
160088
  {