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.
@@ -1348,6 +1348,16 @@ function JSFloatTooltip()
1348
1348
  this.TReportIconTooltip(data);
1349
1349
  }
1350
1350
  }
1351
+ else if (data.DataType==5) //成交笔数
1352
+ {
1353
+ var tooltipData=data.Tooltip;
1354
+ if (!tooltipData) return;
1355
+
1356
+ if (tooltipData.Type==2) //提示信息
1357
+ {
1358
+ this.DealItemTooltip(data);
1359
+ }
1360
+ }
1351
1361
  }
1352
1362
 
1353
1363
  this.UpdateRealtimeHQTooltip=function(data)
@@ -1639,6 +1649,18 @@ function JSFloatTooltip()
1639
1649
 
1640
1650
  this.ShowTooltip(data);
1641
1651
  }
1652
+
1653
+ this.DealItemTooltip=function(data)
1654
+ {
1655
+ var tooltipData=data.Tooltip;
1656
+ if (!tooltipData.Data || !IFrameSplitOperator.IsNonEmptyArray(tooltipData.Data.AryText)) return;
1657
+
1658
+ this.AryText=tooltipData.Data.AryText;
1659
+
1660
+ this.UpdateTableDOM();
1661
+
1662
+ this.ShowTooltip(data);
1663
+ }
1642
1664
 
1643
1665
  this.UpdateTableDOM=function()
1644
1666
  {
@@ -72,6 +72,7 @@ function JSDealChart(divElement)
72
72
  }
73
73
 
74
74
  if (option.MinuteChartTooltip && option.MinuteChartTooltip.Enable) chart.InitalMinuteChartTooltip(option.MinuteChartTooltip);
75
+ if (option.FloatTooltip && option.FloatTooltip.Enable) chart.InitalFloatTooltip(option.FloatTooltip); //提示信息
75
76
 
76
77
  if (!option.Symbol)
77
78
  {
@@ -100,6 +101,12 @@ function JSDealChart(divElement)
100
101
  if (option.AutoUpdateFrequency>0) chart.AutoUpdateFrequency=option.AutoUpdateFrequency;
101
102
  if (IFrameSplitOperator.IsBool(option.EnableFilter)) chart.EnableFilter=option.EnableFilter;
102
103
 
104
+ var dealChart=chart.GetDealChart();
105
+ if (dealChart)
106
+ {
107
+ if (IFrameSplitOperator.IsNumber(option.SelectedStyle)) dealChart.SelectedStyle=option.SelectedStyle;
108
+ }
109
+
103
110
  //注册事件
104
111
  if (option.EventCallback)
105
112
  {
@@ -215,6 +222,7 @@ function JSDealChartContainer(uielement)
215
222
  this.LoadDataSplashTitle="数据加载中"; //下载数据提示信息
216
223
 
217
224
  this.TooltipMinuteChart; //分时图
225
+ this.FloatTooltip; //提示浮框
218
226
 
219
227
  this.UIElement=uielement;
220
228
  this.LastPoint=new Point(); //鼠标位置
@@ -228,6 +236,9 @@ function JSDealChartContainer(uielement)
228
236
  {
229
237
  this.IsDestroy=true;
230
238
  this.StopAutoUpdate();
239
+
240
+ this.DestroyMinuteChartTooltip();
241
+ this.DestroyFloatTooltip();
231
242
  }
232
243
 
233
244
  this.EnableFilterData=false; //是否启动筛选
@@ -272,9 +283,55 @@ function JSDealChartContainer(uielement)
272
283
  this.TooltipMinuteChart.Hide();
273
284
  }
274
285
 
286
+ this.HideFloatTooltip=function()
287
+ {
288
+ if (!this.FloatTooltip) return;
289
+
290
+ this.FloatTooltip.Hide();
291
+ }
292
+
293
+ this.DestroyFloatTooltip=function()
294
+ {
295
+ if (!this.FloatTooltip) return;
296
+
297
+ this.FloatTooltip.Destroy();
298
+ this.FloatTooltip=null;
299
+ }
300
+
301
+ this.InitalFloatTooltip=function(option)
302
+ {
303
+ if (this.FloatTooltip) return;
304
+
305
+ this.FloatTooltip=new JSFloatTooltip();
306
+ this.FloatTooltip.Inital(this, option);
307
+ this.FloatTooltip.Create();
308
+ }
309
+
310
+ this.DrawFloatTooltip=function(point,toolTip)
311
+ {
312
+ if (!this.FloatTooltip) return;
313
+
314
+ this.UpdateFloatTooltip(point, toolTip)
315
+ }
316
+
317
+ this.UpdateFloatTooltip=function(point, toolTip)
318
+ {
319
+ if (!this.FloatTooltip) return;
320
+
321
+ var sendData=
322
+ {
323
+ Tooltip:toolTip,
324
+ Point:point,
325
+ DataType:5,
326
+ };
327
+
328
+ this.FloatTooltip.Update(sendData);
329
+ }
330
+
275
331
  this.HideAllTooltip=function()
276
332
  {
277
333
  this.HideMinuteChartTooltip();
334
+ this.HideFloatTooltip();
278
335
  }
279
336
 
280
337
  //筛选数据
@@ -386,6 +443,8 @@ function JSDealChartContainer(uielement)
386
443
  this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
387
444
  this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
388
445
  this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e);}
446
+ this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
447
+ this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
389
448
  }
390
449
 
391
450
  this.Draw=function()
@@ -584,12 +643,17 @@ function JSDealChartContainer(uielement)
584
643
  }
585
644
  }
586
645
 
646
+ this.GetDealChart=function()
647
+ {
648
+ return this.ChartPaint[0];
649
+ }
650
+
587
651
  this.RecvDealUpdateData=function(data)
588
652
  {
589
653
  var aryDeal=JSDealChartContainer.JsonDataToDealData(data);
590
654
  if (!IFrameSplitOperator.IsNonEmptyArray(aryDeal)) return;
591
655
 
592
- var chart=this.ChartPaint[0];
656
+ var chart=this.GetDealChart();
593
657
  if (!chart) return;
594
658
 
595
659
  if (data.UpdateType===1) //全量更新
@@ -660,7 +724,14 @@ function JSDealChartContainer(uielement)
660
724
 
661
725
  var self = this;
662
726
  var marketStatus=MARKET_SUFFIX_NAME.GetMarketStatus(this.Symbol);
663
- if (marketStatus==0 || marketStatus==3) return; //闭市,盘后
727
+ if (marketStatus==0 || marketStatus==3) //闭市,盘后
728
+ {
729
+ this.AutoUpdateTimer=setTimeout(function()
730
+ {
731
+ self.AutoUpdate();
732
+ },20000);
733
+ return;
734
+ }
664
735
 
665
736
  var frequency=this.AutoUpdateFrequency;
666
737
  if (marketStatus==1) //盘前
@@ -862,13 +933,12 @@ function JSDealChartContainer(uielement)
862
933
  chartTooltipData={ Symbol:tooltipData.Stock.OriginalSymbol, Rect:tooltipData.Rect };
863
934
  }
864
935
  }
936
+ */
865
937
  else
866
938
  {
867
939
  this.LastMouseStatus.TooltipStatus={ X:x, Y:y, Data:tooltipData, ClientX:e.clientX, ClientY:e.clientY };
868
940
  bDrawTooltip=true;
869
941
  }
870
- */
871
-
872
942
  }
873
943
  }
874
944
 
@@ -876,6 +946,17 @@ function JSDealChartContainer(uielement)
876
946
 
877
947
  if (bDraw) this.Draw();
878
948
 
949
+ if (this.LastMouseStatus.TooltipStatus)
950
+ {
951
+ var xTooltip = e.clientX-this.UIElement.getBoundingClientRect().left;
952
+ var yTooltip = e.clientY-this.UIElement.getBoundingClientRect().top;
953
+ this.DrawFloatTooltip({X:xTooltip, Y:yTooltip, YMove:20/pixelTatio},this.LastMouseStatus.TooltipStatus.Data);
954
+ }
955
+ else
956
+ {
957
+ this.HideFloatTooltip();
958
+ }
959
+
879
960
  if (!bShowMinuteTooltip) this.HideMinuteChartTooltip();
880
961
  if (bShowMinuteTooltip) this.ShowMinuteChartTooltip(null, null, chartTooltipData);
881
962
  }
@@ -895,6 +976,16 @@ function JSDealChartContainer(uielement)
895
976
  e.preventDefault();
896
977
  }
897
978
 
979
+ this.UIOnMounseOut=function(e)
980
+ {
981
+ this.HideAllTooltip();
982
+ }
983
+
984
+ this.UIOnMouseleave=function(e)
985
+ {
986
+ this.HideAllTooltip();
987
+ }
988
+
898
989
  this.GotoNextPage=function()
899
990
  {
900
991
  if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return false;
@@ -994,8 +1085,9 @@ JSDealChartContainer.JsonDataToDealData=function(data)
994
1085
  if (item[5]) dealItem.StrTime=item[5];
995
1086
  if (item[6]) dealItem.ID=item[6];
996
1087
 
997
- if (item[11]) dealItem.Symbol=item[11]; //股票代码
998
- if (item[12]) dealItem.Name=item[12]; //股票名称
1088
+ if (item[11]) dealItem.Symbol=item[11]; //股票代码
1089
+ if (item[12]) dealItem.Name=item[12]; //股票名称
1090
+ if (item[13]) dealItem.BGColor=item[13]; //整行颜色
999
1091
 
1000
1092
  if (item[100]) dealItem.Guid=item[100];
1001
1093
 
@@ -1211,7 +1303,8 @@ function ChartDealList()
1211
1303
 
1212
1304
  this.BorderColor=g_JSChartResource.DealList.BorderColor; //边框线
1213
1305
 
1214
- this.SelectedConfig={ BGColor:g_JSChartResource.DealList.Selected.BGColor };
1306
+ this.SelectedConfig={ BGColor:g_JSChartResource.DealList.Selected.BGColor, LineColor:g_JSChartResource.DealList.Selected.LineColor, LineWidth:g_JSChartResource.DealList.Selected.LineWidth };
1307
+ this.SelectedStyle=1; //选中行样式 1=整行填充 2=底部绘制直线
1215
1308
 
1216
1309
  //表头配置
1217
1310
  this.HeaderFontConfig={ Size:g_JSChartResource.DealList.Header.Font.Size, Name:g_JSChartResource.DealList.Header.Font.Name };
@@ -1533,6 +1626,7 @@ function ChartDealList()
1533
1626
  var left=this.RectClient.Left+this.HeaderMergin.Left;
1534
1627
  var dataCount=this.Data.Data.length;
1535
1628
  var index=this.Data.DataOffset;
1629
+ var selectedRowData=null;
1536
1630
 
1537
1631
  if (this.ShowOrder==1)
1538
1632
  {
@@ -1547,8 +1641,8 @@ function ChartDealList()
1547
1641
  for(j=0;j<this.RowCount && index>=0;++j, --index)
1548
1642
  {
1549
1643
  var dataItem=this.Data.Data[index];
1550
- this.DrawSelectedRow(dataItem, index, rtRow);
1551
-
1644
+ this.DrawSelectedRow(dataItem, index, rtRow)
1645
+
1552
1646
  this.DrawRow(dataItem, textLeft, textTop, index);
1553
1647
 
1554
1648
  textTop+=this.RowHeight;
@@ -1569,7 +1663,14 @@ function ChartDealList()
1569
1663
  rtRow.Right=rtRow.Left+rtRow.Width;
1570
1664
  rtRow.Bottom=rtRow.Top+rtRow.Height;
1571
1665
 
1572
- this.DrawSelectedRow(dataItem, index, rtRow);
1666
+ if (dataItem.BGColor)
1667
+ {
1668
+ this.Canvas.fillStyle=dataItem.BGColor;
1669
+ this.Canvas.fillRect(rtRow.Left,rtRow.Top, rtRow.Width, rtRow.Height);
1670
+ }
1671
+
1672
+ if (this.DrawSelectedRow(dataItem, index, rtRow))
1673
+ selectedRowData={ Rect:rtRow };
1573
1674
 
1574
1675
  this.DrawRow(dataItem, textLeft, textTop, index);
1575
1676
 
@@ -1578,6 +1679,14 @@ function ChartDealList()
1578
1679
  textTop+=this.RowHeight;
1579
1680
  }
1580
1681
  }
1682
+
1683
+ if (selectedRowData && this.SelectedStyle===2)
1684
+ {
1685
+ var rtBG=selectedRowData.Rect;
1686
+ this.Canvas.fillStyle=this.SelectedConfig.LineColor;
1687
+ var lineWidth=this.SelectedConfig.LineWidth;
1688
+ this.Canvas.fillRect(rtBG.Left,rtBG.Bottom-lineWidth,rtBG.Width,lineWidth);
1689
+ }
1581
1690
  }
1582
1691
  }
1583
1692
 
@@ -1699,14 +1808,22 @@ function ChartDealList()
1699
1808
 
1700
1809
  if (bDrawV2)
1701
1810
  {
1702
- this.DrawItemText(drawInfo.Text, drawInfo.TextColor, drawInfo.TextAlign, rtItem.Left, rtItem.Top, rtItem.Width, drawInfo.BGColor);
1811
+ //this.DrawItemText(drawInfo.Text, drawInfo.TextColor, drawInfo.TextAlign, rtItem.Left, rtItem.Top, rtItem.Width, drawInfo.BGColor);
1812
+ this.DrawItemTextV2(drawInfo, rtItem);
1703
1813
  }
1704
1814
  else
1705
1815
  {
1706
1816
  this.DrawItemText(text, textColor, textAlign, left, top, itemWidth);
1707
1817
  }
1708
1818
 
1709
- if (item.ChartTooltip && item.ChartTooltip.Enable && IFrameSplitOperator.IsNumber(item.ChartTooltip.Type)) //Type 20分时图 21K线图
1819
+
1820
+ if (drawInfo.Tooltip)
1821
+ {
1822
+ //Type:2=数据提示信息
1823
+ var tooltipData={ Rect:rtItem, Data:data, Index:dataIndex, Column:item, Type:drawInfo.Tooltip.Type, Data:drawInfo.Tooltip.Data };
1824
+ this.TooltipRect.push(tooltipData);
1825
+ }
1826
+ else if (item.ChartTooltip && item.ChartTooltip.Enable && IFrameSplitOperator.IsNumber(item.ChartTooltip.Type)) //Type 20分时图 21K线图
1710
1827
  {
1711
1828
  var tooltipData={ Rect:rtItem, Data:data, Index:dataIndex, Column:item, Type:item.ChartTooltip.Type };
1712
1829
  this.TooltipRect.push(tooltipData);
@@ -1779,6 +1896,15 @@ function ChartDealList()
1779
1896
  {
1780
1897
  drawInfo.Text=item;
1781
1898
  }
1899
+
1900
+ if (item && item.Tooltip && IFrameSplitOperator.IsNonEmptyArray(item.Tooltip.AryText))
1901
+ {
1902
+ drawInfo.Tooltip=
1903
+ {
1904
+ Type:2,
1905
+ Data:{ AryText:item.Tooltip.AryText }
1906
+ }
1907
+ }
1782
1908
  }
1783
1909
 
1784
1910
  this.GetUpDownColor=function(price, price2)
@@ -1796,12 +1922,17 @@ function ChartDealList()
1796
1922
 
1797
1923
  this.DrawSelectedRow=function(data, index, rtRow)
1798
1924
  {
1799
- if (!this.SelectedData) return;
1800
- if (!this.SelectedData.Enable) return;
1801
- if (!this.SelectedData.Guid || this.SelectedData.Guid!=data.Guid) return;
1925
+ if (!this.SelectedData) return false;
1926
+ if (!this.SelectedData.Enable) return false;
1927
+ if (!this.SelectedData.Guid || this.SelectedData.Guid!=data.Guid) return false;
1802
1928
 
1803
- this.Canvas.fillStyle=this.SelectedConfig.BGColor;
1804
- this.Canvas.fillRect(rtRow.Left,rtRow.Top, rtRow.Width, rtRow.Height);
1929
+ if ( this.SelectedStyle==1)
1930
+ {
1931
+ this.Canvas.fillStyle=this.SelectedConfig.BGColor;
1932
+ this.Canvas.fillRect(rtRow.Left,rtRow.Top, rtRow.Width, rtRow.Height);
1933
+ }
1934
+
1935
+ return true;
1805
1936
  }
1806
1937
 
1807
1938
  this.DrawItemText=function(text, textColor, textAlign, left, top, width)
@@ -1822,9 +1953,44 @@ function ChartDealList()
1822
1953
  this.Canvas.textAlign="left";
1823
1954
  }
1824
1955
 
1825
- this.Canvas.textBaseline="middle";
1956
+ this.Canvas.textBaseline="bottom";
1826
1957
  this.Canvas.fillStyle=textColor;
1827
- if (text) this.Canvas.fillText(text,x,top+this.RowHeight/2);
1958
+ if (text) this.Canvas.fillText(text,x,top+this.RowHeight-2);
1959
+ }
1960
+
1961
+ this.DrawItemTextV2=function(drawInfo, rtItem)
1962
+ {
1963
+ if (drawInfo.BGColor)
1964
+ {
1965
+ this.Canvas.fillStyle=drawInfo.BGColor;
1966
+ this.Canvas.fillRect(rtItem.Left,rtItem.Top,rtItem.Width,rtItem.Height);
1967
+ }
1968
+
1969
+ if (drawInfo.Text)
1970
+ {
1971
+ var text=drawInfo.Text;
1972
+ var x=rtItem.Left;
1973
+ if (drawInfo.TextAlign=='center')
1974
+ {
1975
+ x=rtItem.Left+rtItem.Width/2;
1976
+ this.Canvas.textAlign="center";
1977
+ }
1978
+ else if (drawInfo.TextAlign=='right')
1979
+ {
1980
+ x=rtItem.Left+rtItem.Width-2;
1981
+ this.Canvas.textAlign="right";
1982
+ }
1983
+ else
1984
+ {
1985
+ x+=2;
1986
+ this.Canvas.textAlign="left";
1987
+ }
1988
+
1989
+ var textWidth=this.Canvas.measureText(text).width+1;
1990
+ this.Canvas.textBaseline="bottom";
1991
+ this.Canvas.fillStyle=drawInfo.TextColor;
1992
+ this.Canvas.fillText(text,x,rtItem.Top+this.RowHeight-2);
1993
+ }
1828
1994
  }
1829
1995
 
1830
1996
  this.DrawMultiBar=function(colunmInfo, data, rtItem)
@@ -581,7 +581,7 @@ JSIndexScript.prototype.MACD=function()
581
581
  {
582
582
  let data=
583
583
  {
584
- Name:'MACD', Description:'平滑异同平均', IsMainIndex:false,
584
+ Name:'MACD', Description:'平滑异同平均', IsMainIndex:false,FloatPrecision:3,
585
585
  Args:[ { Name:'SHORT', Value:12}, { Name:'LONG', Value:26}, { Name:'MID', Value:9} ],
586
586
  Script: //脚本
587
587
  'DIF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);\n\
@@ -75617,6 +75617,8 @@ function JSChartResource()
75617
75617
  Selected:
75618
75618
  {
75619
75619
  BGColor:"rgb(180,240,240)",
75620
+ LineColor:"rgb(128,128,128)",
75621
+ LineWidth:2,
75620
75622
  }
75621
75623
  },
75622
75624
 
@@ -76736,6 +76738,8 @@ function JSChartResource()
76736
76738
  {
76737
76739
  var subItem=item.Selected;
76738
76740
  if (subItem.BGColor) this.DealList.Selected.BGColor=subItem.BGColor;
76741
+ if (subItem.LineColor) this.DealList.Selected.LineColor=subItem.LineColor;
76742
+ if (IFrameSplitOperator.IsPlusNumber(subItem.LineWidth)) this.DealList.Selected.LineWidth=subItem.LineWidth;
76739
76743
  }
76740
76744
  }
76741
76745
 
@@ -76750,7 +76754,7 @@ function JSChartResource()
76750
76754
  if (IFrameSplitOperator.IsNumber(item.Radius)) this.SelectedChart.Radius=item.Radius;
76751
76755
  if (IFrameSplitOperator.IsNumber(item.MinSpace)) this.SelectedChart.MinSpace=item.MinSpace;
76752
76756
  if (item.LineColor) this.SelectedChart.LineColor=item.LineColor;
76753
- if (item.LineColor) this.SelectedChart.BGColor=item.BGColor;
76757
+ if (item.BGColor) this.SelectedChart.BGColor=item.BGColor;
76754
76758
  }
76755
76759
 
76756
76760
  if (style.DragMovePaint)
@@ -490,6 +490,7 @@ function JSReportChartContainer(uielement)
490
490
  //
491
491
  this.TooltipMinuteChart; //分时图
492
492
  this.TooltipKLineChart; //分时图
493
+ this.FloatTooltip; //提示浮框
493
494
 
494
495
  //MouseOnStatus:{ RowIndex:行, ColumnIndex:列}
495
496
  this.LastMouseStatus={ MoveStatus:null, TooltipStatus:null, MouseOnStatus:null };
@@ -701,7 +701,8 @@ function GetBlackStyle()
701
701
 
702
702
  Selected:
703
703
  {
704
- BGColor:"rgb(49,48,56)",
704
+ BGColor:"rgba(49,48,56,0.7)",
705
+ LineColor:"rgb(220,220,220)",
705
706
  }
706
707
  },
707
708