hqchart 1.1.15451 → 1.1.15455

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.
@@ -60966,6 +60966,8 @@ function FrameSplitKLinePriceY()
60966
60966
  isLast=pageInfo.IsLast;
60967
60967
  }
60968
60968
  }
60969
+
60970
+ if (!latestItem || !IFrameSplitOperator.IsNumber(latestItem.Close)) return null;
60969
60971
 
60970
60972
  var info=new CoordinateInfo();
60971
60973
  info.Type=0;
@@ -84068,7 +84070,7 @@ function JSChartResource()
84068
84070
  TitleColor:"rgb(90,90,90)",
84069
84071
  VolColor:"rgb(90,90,90)",
84070
84072
  Margin:{ Left:0, Top:0, Bottom:0, Right:0 },
84071
- CellMargin:{ Top:5, Bottom:5, Left:5, Right:5, YOffset:0 },
84073
+ CellMargin:{ Top:3*GetDevicePixelRatio(), Bottom:3*GetDevicePixelRatio(), Left:5*GetDevicePixelRatio(), Right:5*GetDevicePixelRatio(), YOffset:1*GetDevicePixelRatio() },
84072
84074
  BottomLine:{ Enable:true, Color:"rgb(192,192,192)"}, //底部分割线
84073
84075
  TopLine:{ Enable:false, Color:"rgb(192,192,192)"}, //底部分割线
84074
84076
 
@@ -84084,10 +84086,12 @@ function JSChartResource()
84084
84086
  Font:14*GetDevicePixelRatio() +'px 微软雅黑',
84085
84087
  TitleColor:"rgb(90,90,90)",
84086
84088
  TextColor:"rgb(90,90,90)",
84087
- Margin:{ Left:0, Top:0, Bottom:0, Right:0 },
84088
- CellMargin:{ Top:5, Bottom:5, Left:5, Right:5, YOffset:0 },
84089
+ Margin:{ Left:0, Top:2*GetDevicePixelRatio(), Bottom:0, Right:0 },
84090
+ CellMargin:{ Top:3*GetDevicePixelRatio(), Bottom:3*GetDevicePixelRatio(), Left:5, Right:5, YOffset:1*GetDevicePixelRatio() },
84089
84091
  },
84090
84092
 
84093
+ MouseOn:{ BGColor:"rgb(169,169,169)" },
84094
+
84091
84095
  UpTextColor:"rgb(238,21,21)", //上涨文字颜色
84092
84096
  DownTextColor:"rgb(25,158,0)", //下跌文字颜色
84093
84097
  UnchangeTextColor:"rgb(90,90,90)", //平盘文字颜色
@@ -85290,6 +85294,12 @@ function JSChartResource()
85290
85294
  }
85291
85295
  }
85292
85296
 
85297
+ if (style.MouseOn)
85298
+ {
85299
+ var item=style.MouseOn;
85300
+ if (item.BGColor) dest.MouseOn.BGColor=item.BGColor;
85301
+ }
85302
+
85293
85303
  if (style.UpTextColor) dest.UpTextColor=style.UpTextColor;
85294
85304
  if (style.DownTextColor) dest.DownTextColor=style.DownTextColor;
85295
85305
  if (style.UnchangeTextColor) dest.UnchangeTextColor=style.UnchangeTextColor;
@@ -140114,6 +140124,8 @@ function GetBlackStyle()
140114
140124
  //CellMargin:{ Top:5, Bottom:5, YOffset:0, Left:5, Right:5, YOffset:-5 },
140115
140125
  },
140116
140126
 
140127
+ MouseOn:{ BGColor:"rgb(54,54,54)" },
140128
+
140117
140129
  UpTextColor:"rgb(238,21,21)", //上涨文字颜色
140118
140130
  DownTextColor:"rgb(25,158,0)", //下跌文字颜色
140119
140131
  UnchangeTextColor:"rgb(90,90,90)", //平盘文字颜色
@@ -169057,6 +169069,7 @@ function JSStatusBarChartContainer(uielement)
169057
169069
  this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
169058
169070
  this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e); }
169059
169071
  this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
169072
+ this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
169060
169073
 
169061
169074
  /*
169062
169075
  this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
@@ -169064,7 +169077,7 @@ function JSStatusBarChartContainer(uielement)
169064
169077
 
169065
169078
 
169066
169079
  this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
169067
- this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
169080
+
169068
169081
  */
169069
169082
 
169070
169083
  var frequency=500;
@@ -169081,8 +169094,21 @@ function JSStatusBarChartContainer(uielement)
169081
169094
  var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
169082
169095
  var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
169083
169096
 
169084
- var ptClick={ X:this.ClickDownPoint.X, Y:this.ClickDownPoint.Y };
169085
- this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICK_STATUSBAR_ITEM, ptClick, e);
169097
+ if (e && e.button==0) //左键点击
169098
+ {
169099
+ var ptClick={ X:this.ClickDownPoint.X, Y:this.ClickDownPoint.Y };
169100
+ this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICK_STATUSBAR_ITEM, ptClick, e);
169101
+ }
169102
+ }
169103
+
169104
+ this.UIOnContextMenu=function(e)
169105
+ {
169106
+ if (e) //去掉系统右键菜单
169107
+ {
169108
+ if (e.preventDefault) e.preventDefault();
169109
+ if (e.stopPropagation) e.stopPropagation();
169110
+ e.returnValue=false;
169111
+ }
169086
169112
  }
169087
169113
 
169088
169114
  this.GetChartTooltipData=function(x,y,option)
@@ -169925,6 +169951,8 @@ function JSStockInfoChart(divElement)
169925
169951
 
169926
169952
  if (IFrameSplitOperator.IsNonEmptyArray(option.Column)) chart.SetColumn(option.Column);
169927
169953
  if (IFrameSplitOperator.IsNonEmptyArray(option.HeaderColumn)) chart.SetHeaderColumn(option.HeaderColumn);
169954
+ if (IFrameSplitOperator.IsNonEmptyArray(option.MouseOnKey)) chart.SetMouseOnKey(option.MouseOnKey);
169955
+
169928
169956
  //是否自动更新
169929
169957
  if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
169930
169958
 
@@ -170153,6 +170181,7 @@ function JSStockInfoChartContainer(uielement)
170153
170181
  {
170154
170182
  if (IFrameSplitOperator.IsNonEmptyArray(option.Column)) this.SetColumn(option.Column);
170155
170183
  if (IFrameSplitOperator.IsNumber(option.BuySellCount)) this.SetBuySellCount(option.BuySellCount);
170184
+ if (IFrameSplitOperator.IsNonEmptyArray(option.MouseOnKey)) this.SetMouseOnKey(option.MouseOnKey);
170156
170185
  }
170157
170186
 
170158
170187
  this.Draw();
@@ -170300,17 +170329,95 @@ function JSStockInfoChartContainer(uielement)
170300
170329
  }
170301
170330
 
170302
170331
 
170303
-
170304
- /*
170305
- this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
170332
+ this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
170306
170333
  this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
170307
170334
  this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e);}
170308
170335
  this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
170309
170336
  this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
170310
- this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
170337
+ /*
170338
+ this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
170339
+
170311
170340
  */
170312
170341
  }
170313
170342
 
170343
+ this.UIOnMouseDown=function(e)
170344
+ {
170345
+ var pixelTatio = GetDevicePixelRatio();
170346
+ this.ClickDownPoint={ X:e.clientX, Y:e.clientY };
170347
+ var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
170348
+ var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
170349
+ }
170350
+
170351
+ this.UIOnContextMenu=function(e)
170352
+ {
170353
+ if (e) //去掉系统右键菜单
170354
+ {
170355
+ if (e.preventDefault) e.preventDefault();
170356
+ if (e.stopPropagation) e.stopPropagation();
170357
+ e.returnValue=false;
170358
+ }
170359
+ }
170360
+
170361
+ this.UIOnMouseMove=function(e)
170362
+ {
170363
+ var pixelTatio = GetDevicePixelRatio();
170364
+ var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
170365
+ var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
170366
+
170367
+ var option={ Update:false };
170368
+
170369
+ this.OnChartMouseMove(x,y,e,option);
170370
+
170371
+ if (option.Update===true) this.Draw();
170372
+ }
170373
+
170374
+ this.OnChartMouseMove=function(x, y, e, option)
170375
+ {
170376
+ for(var i=0;i<this.ChartPaint.length;++i)
170377
+ {
170378
+ var item=this.ChartPaint[i];
170379
+ if (item && item.OnMouseMove)
170380
+ {
170381
+ if (item.OnMouseMove(x,y,e,option)) return true;
170382
+ }
170383
+ }
170384
+
170385
+ return false;
170386
+ }
170387
+
170388
+ this.UIOnMouseleave=function(e)
170389
+ {
170390
+ var option={ Update:false }
170391
+
170392
+ this.ChartClearMouseOnData(option);
170393
+
170394
+ if (option.Update===true) this.Draw();
170395
+ }
170396
+
170397
+ this.UIOnMounseOut=function(e)
170398
+ {
170399
+ var option={ Update:false }
170400
+
170401
+ this.ChartClearMouseOnData(option);
170402
+
170403
+ if (option.Update===true) this.Draw();
170404
+
170405
+ //this.HideAllTooltip();
170406
+ }
170407
+
170408
+ this.ChartClearMouseOnData=function(option)
170409
+ {
170410
+ for(var i=0;i<this.ChartPaint.length;++i)
170411
+ {
170412
+ var item=this.ChartPaint[i];
170413
+ if (item && item.ClearMouseOnData)
170414
+ {
170415
+ item.ClearMouseOnData(option);
170416
+ }
170417
+ }
170418
+ }
170419
+
170420
+
170314
170421
  this.Draw=function()
170315
170422
  {
170316
170423
  if (this.UIElement.width<=0 || this.UIElement.height<=0) return;
@@ -170396,6 +170503,14 @@ function JSStockInfoChartContainer(uielement)
170396
170503
 
170397
170504
  if (option && option.Redraw) this.Draw();
170398
170505
  }
170506
+
170507
+ this.SetMouseOnKey=function(aryKey)
170508
+ {
170509
+ var chart=this.ChartPaint[0];
170510
+ if (!chart) return;
170511
+
170512
+ chart.SetMouseOnKey(aryKey);
170513
+ }
170399
170514
  }
170400
170515
 
170401
170516
  function JSStockInfoFrame()
@@ -170527,7 +170642,15 @@ function ChartStockData()
170527
170642
  [{ Name:"内盘", Key:"InVol", ColorType:4, FloatPrecision:0 }, { Name:"外盘", Key:"OutVol",ColorType:5, FloatPrecision:0 }],
170528
170643
  [{ Name:"TTM", Key:"PE_TTM", FloatPrecision:2 }, { Name:"市净率", Key:"PB", FloatPrecision:2 }],
170529
170644
  [{ Name:"流通市值", Key:"FlowMarketValue", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }, { Name:"总市值", Key:"TotalMarketValue", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }],
170530
- ]
170645
+ ];
170646
+
170647
+ this.AryCellRect=[];
170648
+ this.MouseOnItem=null; //{ Key:, Rect: }
170649
+ //this.MouseOnItem={ Key:"SELL_PRICE_0" };
170650
+ this.MouseOnConfig=CloneData(g_JSChartResource.StockInfo.MouseOn);
170651
+
170652
+ this.MapMouseOnKey=new Map();
170653
+
170531
170654
 
170532
170655
  this.ReloadResource=function(resource)
170533
170656
  {
@@ -170541,6 +170664,17 @@ function ChartStockData()
170541
170664
  this.BuySellConfig=CloneData(g_JSChartResource.StockInfo.BuySell);
170542
170665
 
170543
170666
  this.TableConfig=CloneData(g_JSChartResource.StockInfo.Table);
170667
+
170668
+ this.MouseOnConfig=CloneData(g_JSChartResource.StockInfo.MouseOn);
170669
+ }
170670
+
170671
+ this.ClearMouseOnData=function(option)
170672
+ {
170673
+ if (!this.MouseOnItem)
170674
+ {
170675
+ this.MouseOnItem=null;
170676
+ if (option) option.Update=true; //需要更新
170677
+ }
170544
170678
  }
170545
170679
 
170546
170680
  this.SetColumn=function(aryColumn)
@@ -170569,8 +170703,55 @@ function ChartStockData()
170569
170703
  }
170570
170704
  }
170571
170705
 
170706
+ this.SetMouseOnKey=function(aryKey)
170707
+ {
170708
+ this.MapMouseOnKey.clear();
170709
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryKey)) return;
170710
+
170711
+ for(var i=0;i<aryKey.length;++i)
170712
+ {
170713
+ var key=aryKey[i];
170714
+ if (!key) continue;
170715
+
170716
+ this.MapMouseOnKey.set(key, { Key:key });
170717
+ }
170718
+
170719
+ }
170720
+
170721
+ this.OnMouseMove=function(x, y, e, option)
170722
+ {
170723
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryCellRect)) return false;
170724
+
170725
+ if (this.MouseOnItem && this.MouseOnItem.Rect)
170726
+ {
170727
+ var rect=this.MouseOnItem.Rect;
170728
+ if (Path2DHelper.PtInRect(x,y,rect )) return true;
170729
+ }
170730
+
170731
+ for(var i=0;i<this.AryCellRect.length;++i)
170732
+ {
170733
+ var item=this.AryCellRect[i];
170734
+ var rect=item.Rect;
170735
+ if (Path2DHelper.PtInRect(x,y, rect))
170736
+ {
170737
+ this.MouseOnItem={ Key:item.Data.Key, Rect:rect };
170738
+ if (option) option.Update=true;
170739
+ return true;
170740
+ }
170741
+ }
170742
+
170743
+ if (this.MouseOnItem)
170744
+ {
170745
+ this.MouseOnItem=null;
170746
+ if (option) option.Update=true;
170747
+ }
170748
+
170749
+ return false;
170750
+ }
170751
+
170572
170752
  this.Draw=function()
170573
170753
  {
170754
+ this.AryCellRect=[];
170574
170755
  this.Decimal=GetfloatPrecision(this.Data.Symbol);
170575
170756
  var border=this.ChartBorder.GetBorder();
170576
170757
  var position = { Left:border.Left, Right:border.Right, Top:border.Top, Width:border.Right-border.Left, Border:border };
@@ -170688,11 +170869,13 @@ function ChartStockData()
170688
170869
  {
170689
170870
  var xLeft=position.Border.Left, xRight=position.Border.Right;
170690
170871
  this.Canvas.strokeStyle=config.BottomLine.Color;
170691
- this.Canvas.lineWidth=1*GetDevicePixelRatio();
170872
+ var lineWidth=1*GetDevicePixelRatio();;
170873
+ this.Canvas.lineWidth=lineWidth;
170692
170874
  this.Canvas.beginPath();
170693
170875
  this.Canvas.moveTo(xLeft,ToFixedPoint(yText));
170694
170876
  this.Canvas.lineTo(xRight,ToFixedPoint(yText));
170695
170877
  this.Canvas.stroke();
170878
+ position.Top=ToFixedPoint(yText);
170696
170879
  }
170697
170880
  }
170698
170881
 
@@ -170719,7 +170902,7 @@ function ChartStockData()
170719
170902
  {
170720
170903
  xText=left;
170721
170904
  var item=this.Data.Sells[i];
170722
- this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight);
170905
+ this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight, { Type:1, Index:i});
170723
170906
  if (IFrameSplitOperator.IsNumber(item.Vol)) sellVol+=item.Vol;
170724
170907
  yText+=cellHeight;
170725
170908
  }
@@ -170738,7 +170921,7 @@ function ChartStockData()
170738
170921
  {
170739
170922
  xText=left;
170740
170923
  var item=this.Data.Buys[i];
170741
- this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight);
170924
+ this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight, { Type:2, Index:i});
170742
170925
  if (IFrameSplitOperator.IsNumber(item.Vol)) buyVol+=item.Vol;
170743
170926
  yText+=cellHeight;
170744
170927
  }
@@ -170803,7 +170986,8 @@ function ChartStockData()
170803
170986
  }
170804
170987
  }
170805
170988
 
170806
- this.DrawBuySellItem=function(item, left, top, cellWidth, cellHeight)
170989
+ //itemInfo={ Type:2(1=买 2=卖), Index:数据索引 }
170990
+ this.DrawBuySellItem=function(item, left, top, cellWidth, cellHeight, itemInfo)
170807
170991
  {
170808
170992
  var config=this.BuySellConfig;
170809
170993
  var xText=left;
@@ -170818,11 +171002,22 @@ function ChartStockData()
170818
171002
 
170819
171003
  if (IFrameSplitOperator.IsNumber(item.Price))
170820
171004
  {
171005
+ var key=`${itemInfo.Type==1?"BUY":"SELL"}_PRICE_${itemInfo.Index}`;
171006
+ var mouseOnItem=this.IsMouseOn(key);
171007
+
170821
171008
  var text=item.Price.toFixed(this.Decimal);
170822
171009
  var textWidth=this.Canvas.measureText(text).width;
170823
171010
  var x=xText+cellWidth-textWidth-config.CellMargin.Right;
171011
+ var rtCell={ Left:xText, Width:cellWidth, Top:top, Height:cellHeight };
171012
+ rtCell.Right=rtCell.Left+rtCell.Width;
171013
+ rtCell.Bottom=rtCell.Top+rtCell.Height;
171014
+ if (mouseOnItem) this.DrawMouseOnRect(rtCell);
171015
+
170824
171016
  this.Canvas.fillStyle=this.GetPriceColor(item.Price);
170825
171017
  this.Canvas.fillText(text,x,yBottom);
171018
+
171019
+ if (this.MapMouseOnKey.has(key))
171020
+ this.AryCellRect.push({ Rect:rtCell, Data:{ Type:1, Key:key, Value:item.Price }});
170826
171021
  }
170827
171022
  xText+=cellWidth;
170828
171023
 
@@ -170838,6 +171033,25 @@ function ChartStockData()
170838
171033
  }
170839
171034
  }
170840
171035
 
171036
+ this.IsMouseOn=function(key)
171037
+ {
171038
+ if (!this.MouseOnItem) return null;
171039
+
171040
+ if (this.MouseOnItem.Key===key) return this.MouseOnItem;
171041
+
171042
+ return null;
171043
+ }
171044
+
171045
+ this.DrawMouseOnRect=function(rect)
171046
+ {
171047
+ if (!this.MouseOnItem) return;
171048
+
171049
+ this.Canvas.fillStyle=this.MouseOnConfig.BGColor;
171050
+ this.Canvas.fillRect(rect.Left, rect.Top, rect.Width, rect.Height);
171051
+
171052
+ this.MouseOnItem.Rect=rect;
171053
+ }
171054
+
170841
171055
 
170842
171056
  this.DrawTable=function(position)
170843
171057
  {
@@ -170907,18 +171121,36 @@ function ChartStockData()
170907
171121
  {
170908
171122
  if (i==0 && item.ShowType==1) //整行显示
170909
171123
  {
171124
+ var mouseOnItem=this.IsMouseOn(item.Key);
170910
171125
  var textWidth=this.Canvas.measureText(text).width;
170911
171126
  var x=xText+(cellWidth*3)-textWidth-config.CellMargin.Right;
171127
+ var rtCell={ Left:xText+cellWidth, Top:top, Width:cellWidth*2, Height:cellHeight};
171128
+ rtCell.Right=rtCell.Left+rtCell.Width;
171129
+ rtCell.Bottom=rtCell.Top+rtCell.Height;
171130
+ if (mouseOnItem) this.DrawMouseOnRect(rtCell);
171131
+
170912
171132
  this.Canvas.fillStyle=color;
170913
171133
  this.Canvas.fillText(text,x,yBottom);
171134
+
171135
+ if (this.MapMouseOnKey.has(item.Key))
171136
+ this.AryCellRect.push({ Rect:rtCell, Data:{ Type:2, Key:item.Key, Value:dataItem }});
170914
171137
  break;
170915
171138
  }
170916
171139
  else
170917
171140
  {
171141
+ var mouseOnItem=this.IsMouseOn(item.Key);
170918
171142
  var textWidth=this.Canvas.measureText(text).width;
170919
171143
  var x=xText+cellWidth-textWidth-config.CellMargin.Right;
171144
+ var rtCell={ Left:xText, Top:top, Width:cellWidth, Height:cellHeight};
171145
+ rtCell.Right=rtCell.Left+rtCell.Width;
171146
+ rtCell.Bottom=rtCell.Top+rtCell.Height;
171147
+ if (mouseOnItem) this.DrawMouseOnRect(rtCell);
171148
+
170920
171149
  this.Canvas.fillStyle=color;
170921
171150
  this.Canvas.fillText(text,x,yBottom);
171151
+
171152
+ if (this.MapMouseOnKey.has(item.Key))
171153
+ this.AryCellRect.push({ Rect:rtCell, Data:{ Type:2, Key:item.Key, Value:dataItem }});
170922
171154
  }
170923
171155
 
170924
171156
  }
@@ -171018,7 +171250,7 @@ function ChartStockData()
171018
171250
 
171019
171251
 
171020
171252
 
171021
- var HQCHART_VERSION="1.1.15450";
171253
+ var HQCHART_VERSION="1.1.15454";
171022
171254
 
171023
171255
  function PrintHQChartVersion()
171024
171256
  {