hqchart 1.1.14165 → 1.1.14179

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.
@@ -5999,16 +5999,6 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5999
5999
  }
6000
6000
  }
6001
6001
 
6002
- //历史分钟数据 更改日期
6003
- this.ChangeTradeDate=function(tradeDate)
6004
- {
6005
- if(this.JSChartContainer && typeof(this.JSChartContainer.ChangeTradeDate)=='function')
6006
- {
6007
- JSConsole.Chart.Log('[JSChart:ChangeTradeDate] date', tradeDate);
6008
- this.JSChartContainer.ChangeTradeDate(tradeDate);
6009
- }
6010
- }
6011
-
6012
6002
  //多日走势图
6013
6003
  this.ChangeDayCount=function(count, option)
6014
6004
  {
@@ -6211,6 +6201,15 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
6211
6201
  return this.JSChartContainer.PopupMenuByDrapdown(menuData, rtButton);
6212
6202
  }
6213
6203
  }
6204
+
6205
+ this.ExecuteMenuCommand=function(cmdID, aryArgs)
6206
+ {
6207
+ if(this.JSChartContainer && typeof(this.JSChartContainer.ExecuteMenuCommand)=='function')
6208
+ {
6209
+ JSConsole.Chart.Log('[JSChart:ExecuteMenuCommand] ');
6210
+ return this.JSChartContainer.ExecuteMenuCommand(cmdID, aryArgs);
6211
+ }
6212
+ }
6214
6213
  }
6215
6214
 
6216
6215
  JSChart.LastVersion=null; //最新的版本号
@@ -7008,9 +7007,14 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7008
7007
  {
7009
7008
  IsValueFullRange:false ,
7010
7009
  IsDisplayLatest:false,
7011
- SelectedBorder:{ Mode:0, SelFrame:0 }, //边框选中模式 Mode:0=禁用 1=右侧标记选中 2=指标窗口标记选中
7012
- SelectedXBorder: { Mode:0, Date:null } //X边框选中模式 Mode:0=禁用 分时图图有效
7010
+ SelectedBorder:{ Mode:0, SelFrame:0 }, //边框选中模式 Mode:0=禁用 1=右侧标记选中 2=指标窗口标记选中
7011
+ SelectedXBorder: { Mode:0, Date:null }, //X边框选中模式 Mode:0=禁用 分时图图有效
7013
7012
  //XDateFormat (多日分时图x轴底部日期格式)
7013
+ RightHorizontal:
7014
+ {
7015
+ //Show:true,
7016
+ //Width:5
7017
+ } //右侧框架外部坐标和间距
7014
7018
  };
7015
7019
 
7016
7020
  this.VerticalDrag; //通过X轴左右拖动数据(手势才有)
@@ -13880,22 +13884,19 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
13880
13884
  this.ShowDrawToolDialog();
13881
13885
  break;
13882
13886
  case JSCHART_MENU_ID.CMD_SHOW_STOCKCHIP_ID:
13883
- var option={Name:'筹码分布', ShowType:1, Width:230 };
13884
- var extendChart=this.CreateExtendChart(option.Name, option); //创建扩展图形
13885
- this.SetSizeChange(true);
13886
- this.Draw();
13887
- break;
13888
- case JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:
13889
- var StockChip=this.GetExtendChartByClassName('StockChip');
13890
- if (StockChip)
13887
+ //var option={Name:'筹码分布', ShowType:1, Width:230 };
13888
+ var stockChip=this.GetStockChipChart();
13889
+ if (stockChip) return;
13890
+ if (srcParam)
13891
13891
  {
13892
- var chipWidth=StockChip.Chart.Width;
13893
- this.DeleteExtendChart(StockChip);
13894
- this.Frame.ChartBorder.Right-=chipWidth;
13892
+ var extendChart=this.CreateExtendChart(srcParam, aryArgs[1]); //创建扩展图形
13895
13893
  this.SetSizeChange(true);
13896
13894
  this.Draw();
13897
13895
  }
13898
13896
  break;
13897
+ case JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:
13898
+ if (this.DeleteStockChipChart) this.DeleteStockChipChart();
13899
+ break;
13899
13900
  case JSCHART_MENU_ID.CMD_ENABLE_SELECT_RECT_ID:
13900
13901
  if (IFrameSplitOperator.IsBool(srcParam))
13901
13902
  this.EnableSelectRect=srcParam;
@@ -15800,6 +15801,23 @@ function AverageWidthFrame()
15800
15801
  }
15801
15802
  }
15802
15803
 
15804
+ this.IsShowRightHorizontal=function()
15805
+ {
15806
+ var borderRight=this.ChartBorder.Right;
15807
+ if (borderRight<=10) return false;
15808
+
15809
+ if (this.YTextPosition[1]==2) return false;
15810
+ if (this.IsShowYText[1]===false) return false;
15811
+
15812
+ if (this.GlobalOption && this.GlobalOption.RightHorizontal)
15813
+ {
15814
+ var item=this.GlobalOption.RightHorizontal;
15815
+ if (item.Show===false) return false;
15816
+ }
15817
+
15818
+ return true;
15819
+ }
15820
+
15803
15821
  //画Y轴
15804
15822
  this.DrawHorizontal=function()
15805
15823
  {
@@ -15816,7 +15834,8 @@ function AverageWidthFrame()
15816
15834
  var borderLeft=this.ChartBorder.Left;
15817
15835
 
15818
15836
  var isDrawLeft=borderLeft>10 && this.IsShowYText[0]===true && this.YTextPosition[0]!=2;
15819
- var isDrawRight=borderRight>10 && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
15837
+ //var isDrawRight=borderRight>10 && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
15838
+ var isDrawRight=this.IsShowRightHorizontal();
15820
15839
 
15821
15840
  var rightExtendLine=null; //右侧延长线
15822
15841
  var leftExtendLine=null; //左侧延长线
@@ -17808,14 +17827,16 @@ function AverageWidthFrame()
17808
17827
  var borderTop=this.ChartBorder.Top;
17809
17828
  var borderBottom=this.ChartBorder.Bottom;
17810
17829
  var isDrawLeft=borderTop>10*pixelTatio && this.IsShowYText[0]===true && this.YTextPosition[0]!=2;
17811
- var isDrawRight=borderBottom>10*pixelTatio && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
17830
+ //var isDrawRight=borderBottom>10*pixelTatio && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
17831
+ var isDrawRight=this.IsShowRightHorizontal();
17812
17832
  }
17813
17833
  else
17814
17834
  {
17815
17835
  var borderRight=this.ChartBorder.Right;
17816
17836
  var borderLeft=this.ChartBorder.Left;
17817
17837
  var isDrawLeft=borderLeft>10 && this.IsShowYText[0]===true && this.YTextPosition[0]!=2;
17818
- var isDrawRight=borderRight>10 && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
17838
+ //var isDrawRight=borderRight>10 && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
17839
+ var isDrawRight=this.IsShowRightHorizontal();
17819
17840
  }
17820
17841
 
17821
17842
  if (!isDrawRight && !isDrawLeft) return null;
@@ -22505,6 +22526,25 @@ function KLineHScreenFrame()
22505
22526
  }
22506
22527
  }
22507
22528
 
22529
+ this.IsShowRightHorizontal=function()
22530
+ {
22531
+ var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
22532
+ var borderBottom=this.ChartBorder.Bottom;
22533
+ if (borderBottom<=10*pixelTatio) return false;
22534
+
22535
+ if (this.YTextPosition[1]==2) return false;
22536
+ if (this.IsShowYText[1]===false) return false;
22537
+
22538
+ if (this.GlobalOption && this.GlobalOption.RightHorizontal)
22539
+ {
22540
+ var item=this.GlobalOption.RightHorizontal;
22541
+ if (item.Show===false) return false;
22542
+ }
22543
+
22544
+ return true;
22545
+ }
22546
+
22547
+
22508
22548
  //画Y轴
22509
22549
  this.DrawHorizontal=function()
22510
22550
  {
@@ -22520,7 +22560,8 @@ function KLineHScreenFrame()
22520
22560
  var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
22521
22561
 
22522
22562
  var isDrawLeft=borderTop>10*pixelTatio && this.IsShowYText[0]===true && this.YTextPosition[0]!=2;
22523
- var isDrawRight=borderBottom>10*pixelTatio && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
22563
+ //var isDrawRight=borderBottom>10*pixelTatio && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
22564
+ var isDrawRight=this.IsShowRightHorizontal();
22524
22565
 
22525
22566
  for(var i=this.HorizontalInfo.length-1; i>=0; --i) //从左往右画分割线
22526
22567
  {
@@ -47713,7 +47754,7 @@ function StockInfoExtendChartPaint()
47713
47754
  this.Canvas.textAlign="left";
47714
47755
  this.Canvas.fillText(this.Name,middle+2,y);
47715
47756
  }
47716
- ;
47757
+
47717
47758
  this.Canvas.strokeStyle=this.BorderColor;
47718
47759
  this.Canvas.moveTo(left,y);
47719
47760
  this.Canvas.lineTo(right,y);
@@ -48494,6 +48535,428 @@ function StockChip()
48494
48535
  }
48495
48536
  }
48496
48537
 
48538
+ //筹码分布手机版
48539
+ function StockChipPhone()
48540
+ {
48541
+ this.newMethod=StockChip; //派生
48542
+ this.newMethod();
48543
+ delete this.newMethod;
48544
+
48545
+ this.Name='筹码分布手机版';
48546
+ this.ClassName='StockChipPhone';
48547
+ this.ShowType=0; //0=所有筹码 手机版只支持0
48548
+
48549
+ //手机端没有按钮
48550
+ this.DrawToolbar=function(moveonPoint, mouseStatus) { }
48551
+
48552
+ this.Draw=function()
48553
+ {
48554
+ this.IsHScreen=this.ChartFrame.IsHScreen==true;
48555
+ this.PixelRatio=GetDevicePixelRatio();
48556
+ if (this.IsHScreen)
48557
+ {
48558
+ var border=this.ChartBorder.GetHScreenBorder();
48559
+ var left=ToFixedPoint(border.Left);
48560
+ var right=ToFixedPoint(border.Right);
48561
+ var top=ToFixedPoint(border.Bottom+this.Left);
48562
+ var bottom=ToFixedPoint(border.ChartHeight-2*this.PixelRatio);
48563
+ this.ClientRect={Left:left,Top:top, Right:right, Bottom:bottom};
48564
+ this.ClientRect.Width=this.ClientRect.Right-this.ClientRect.Left;
48565
+ this.ClientRect.Height=this.ClientRect.Bottom-this.ClientRect.Top;
48566
+ }
48567
+ else
48568
+ {
48569
+ var left=ToFixedPoint(this.ChartBorder.GetRight()+this.Left);
48570
+ var top=ToFixedPoint(this.ChartBorder.GetTop());
48571
+ var right=ToFixedPoint(left+this.Width-1*this.PixelRatio);
48572
+ var bottom=ToFixedPoint(this.ChartBorder.GetBottom());
48573
+ this.ClientRect={Left:left,Top:top,Right:right, Bottom:bottom};
48574
+ this.ClientRect.Width=this.ClientRect.Right-this.ClientRect.Left;
48575
+ this.ClientRect.Height=this.ClientRect.Bottom-this.ClientRect.Top;
48576
+ }
48577
+
48578
+ if (ChartData.IsTickPeriod(this.HQChart.Period))
48579
+ {
48580
+
48581
+ }
48582
+ else
48583
+ {
48584
+ if (this.CalculateChip())
48585
+ {
48586
+ this.DrawAllChip();
48587
+ if (this.ShowType==1|| this.ShowType==2) this.DrawDayChip();
48588
+
48589
+ this.CalculateCast(); //计算成本
48590
+ if (this.IsHScreen) this.DrawHScreenChipInfo();
48591
+ else this.DrawChipInfo();
48592
+ }
48593
+ }
48594
+
48595
+ this.DrawBorder();
48596
+ this.SizeChange=false;
48597
+ }
48598
+
48599
+ this.DrawAllChip=function()
48600
+ {
48601
+ var KLineFrame=this.HQChart.Frame.SubFrame[0].Frame;
48602
+ var selectPrice=this.Data.SelectData.Close;
48603
+ var aryProfitPoint=[];
48604
+ var aryNoProfitPoint=[];
48605
+ var totalVol=0,totalAmount=0,totalProfitVol=0, totalYProfitVol=0; //总的成交量, 总的成交金额, 总的盈利的成交量
48606
+ var yPrice=this.Data.YPrice;
48607
+
48608
+ var maxPrice=KLineFrame.HorizontalMax;
48609
+ var minPrice=KLineFrame.HorizontalMin;
48610
+
48611
+ var MaxVol=1;
48612
+ for(var i=0;i<this.Data.AllChip.length;++i)
48613
+ {
48614
+ var vol=this.Data.AllChip[i];
48615
+ if(!vol) continue;
48616
+ var price=(i+this.Data.MinPrice)/this.PriceZoom;
48617
+ totalVol+=vol;
48618
+ totalAmount+=price*vol;
48619
+
48620
+ if (price<yPrice) totalYProfitVol+=vol; //获利的成交量
48621
+ if (price<selectPrice) totalProfitVol+=vol; //鼠标当前位置 获利的成交量
48622
+
48623
+ if (price<=maxPrice && price>=minPrice)
48624
+ {
48625
+ if (MaxVol<vol) MaxVol=vol;
48626
+ }
48627
+ }
48628
+ this.Data.MaxVol=MaxVol; //把成交量最大值替换成 当前屏成交量最大值
48629
+
48630
+ for(var i=0;i<this.Data.AllChip.length;++i)
48631
+ {
48632
+ var vol=this.Data.AllChip[i];
48633
+ if(!vol) continue;
48634
+ var price=(i+this.Data.MinPrice)/this.PriceZoom;
48635
+ if (price>maxPrice || price<minPrice) continue;
48636
+
48637
+ if (this.IsHScreen)
48638
+ {
48639
+ var y=KLineFrame.GetYFromData(price,false);
48640
+ var x=(vol/this.Data.MaxVol)*this.ClientRect.Height+this.ClientRect.Top;
48641
+ }
48642
+ else
48643
+ {
48644
+ var y=KLineFrame.GetYFromData(price,false);
48645
+ var x=(vol/this.Data.MaxVol)*this.ClientRect.Width+this.ClientRect.Left;
48646
+ }
48647
+
48648
+ if (price<selectPrice) aryProfitPoint.push({X:x,Y:y});
48649
+ else aryNoProfitPoint.push({X:x,Y:y});
48650
+ }
48651
+
48652
+ this.Data.ChipInfo=
48653
+ {
48654
+ Vol:totalVol, AveragePrice:totalAmount/totalVol, ProfitVol:totalProfitVol,
48655
+ ProfitRate:totalVol>0?totalProfitVol/totalVol*100:0,
48656
+ YProfitRate:totalVol>0?totalYProfitVol/totalVol*100:0
48657
+ };
48658
+
48659
+ if (this.ShowType==0)
48660
+ {
48661
+ this.DrawLines(aryProfitPoint,this.ColorProfit);
48662
+ this.DrawLines(aryNoProfitPoint,this.ColorNoProfit);
48663
+ var averagePrice=this.Data.ChipInfo.AveragePrice;
48664
+ if (averagePrice>0 && averagePrice<=maxPrice && averagePrice>=minPrice)
48665
+ {
48666
+ averagePrice=averagePrice.toFixed(2);
48667
+ this.DrawAveragePriceLine(aryProfitPoint,aryNoProfitPoint,KLineFrame.GetYFromData(averagePrice),this.ColorAveragePrice);
48668
+ }
48669
+ }
48670
+ else //在火焰山模式下, 筹码用一个颜色
48671
+ {
48672
+ this.DrawLines(aryProfitPoint,this.ColorBG);
48673
+ this.DrawLines(aryNoProfitPoint,this.ColorBG);
48674
+ }
48675
+ }
48676
+
48677
+ this.DrawLines=function(aryPoint,color)
48678
+ {
48679
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryPoint)) return;
48680
+
48681
+ this.Canvas.strokeStyle=color;
48682
+ this.Canvas.beginPath();
48683
+ for(var i =0; i<aryPoint.length; ++i)
48684
+ {
48685
+ var item=aryPoint[i];
48686
+ if (this.IsHScreen)
48687
+ {
48688
+ this.Canvas.moveTo(item.Y,this.ClientRect.Top);
48689
+ this.Canvas.lineTo(item.Y,item.X);
48690
+ }
48691
+ else
48692
+ {
48693
+ this.Canvas.moveTo(this.ClientRect.Left,item.Y);
48694
+ this.Canvas.lineTo(item.X,item.Y);
48695
+ }
48696
+
48697
+ }
48698
+ this.Canvas.stroke();
48699
+ }
48700
+
48701
+ this.DrawAveragePriceLine=function(aryProfitPoint,aryNoProfitPoint,y,color)
48702
+ {
48703
+ for(var i=0; i<aryProfitPoint.length; ++i)
48704
+ {
48705
+ var item=aryProfitPoint[i];
48706
+ if (item.Y==y)
48707
+ {
48708
+ this.Canvas.strokeStyle=color;
48709
+ this.Canvas.beginPath();
48710
+ if (this.IsHScreen)
48711
+ {
48712
+ this.Canvas.moveTo(item.Y,this.ClientRect.Top);
48713
+ this.Canvas.lineTo(item.Y,item.X);
48714
+ }
48715
+ else
48716
+ {
48717
+ this.Canvas.moveTo(this.ClientRect.Left,item.Y);
48718
+ this.Canvas.lineTo(item.X,item.Y);
48719
+ }
48720
+
48721
+ this.Canvas.stroke();
48722
+ return;
48723
+ }
48724
+ }
48725
+
48726
+ for(var i=0; i<aryNoProfitPoint.length; ++i)
48727
+ {
48728
+ var item=aryNoProfitPoint[i];
48729
+ if (item.Y==y)
48730
+ {
48731
+ this.Canvas.strokeStyle=color;
48732
+ this.Canvas.beginPath();
48733
+ if (this.IsHScreen)
48734
+ {
48735
+ this.Canvas.moveTo(item.Y,this.ClientRect.Top);
48736
+ this.Canvas.lineTo(item.Y,item.X);
48737
+ }
48738
+ else
48739
+ {
48740
+ this.Canvas.moveTo(this.ClientRect.Left,item.Y);
48741
+ this.Canvas.lineTo(item.X,item.Y);
48742
+ }
48743
+ this.Canvas.stroke();
48744
+ return;
48745
+ }
48746
+ }
48747
+ }
48748
+
48749
+ this.GetChipInfoTitle=function()
48750
+ {
48751
+ var aryText=[]; //从底部往上
48752
+
48753
+ if (ChartData.IsDayPeriod(this.HQChart.Period, true))
48754
+ {
48755
+ var item={ Title:"日期:", Text:IFrameSplitOperator.FormatDateString(this.Data.SelectData.Date) };
48756
+ aryText.push(item);
48757
+ }
48758
+ else if (ChartData.IsMinutePeriod(this.HQChart.Period, true))
48759
+ {
48760
+ var item={ Title:`${IFrameSplitOperator.FormatDateString(this.Data.SelectData.Date)} ${IFrameSplitOperator.FormatTimeString(this.Data.SelectData.Time, "HH:MM")}` };
48761
+ aryText.push(item);
48762
+ }
48763
+
48764
+ var item={ Title:"集中度:", Text:"--.--%", };
48765
+ if (IFrameSplitOperator.IsNonEmptyArray(this.Data.Cast)) item.Text=`${this.Data.Cast[0].Rate.toFixed(2)}%`;
48766
+ aryText.push(item);
48767
+
48768
+ var item={ Title:"90%成本:", Text:"--.--", };
48769
+ if (IFrameSplitOperator.IsNonEmptyArray(this.Data.Cast)) item.Text=`${this.Data.Cast[0].MinPrice.toFixed(2)}-${this.Data.Cast[0].MaxPrice.toFixed(2)}`;
48770
+ aryText.push(item);
48771
+
48772
+
48773
+ var item={ Title:"平均成本::", Text:"--.--", };
48774
+ if (this.Data.ChipInfo && IFrameSplitOperator.IsNumber(this.Data.ChipInfo.AveragePrice)) item.Text=`${this.Data.ChipInfo.AveragePrice.toFixed(2)}`;
48775
+
48776
+ if (IFrameSplitOperator.IsNumber(this.Data.YPrice) && IFrameSplitOperator.IsNumber(this.Data.ChipInfo.YProfitRate))
48777
+ {
48778
+ var item={ Title:`${this.Data.YPrice.toFixed(2)}获利:`, Text:`${this.Data.ChipInfo.YProfitRate.toFixed(2)}%` };
48779
+ aryText.push(item);
48780
+ }
48781
+
48782
+ if (this.IsHScreen) //横屏直接就显示数值 画进度条太麻烦了
48783
+ {
48784
+ var item={ Title:"获利比例:", Text: `${this.Data.ChipInfo.ProfitRate.toFixed(2)}%`};
48785
+ aryText.push(item);
48786
+ }
48787
+ else
48788
+ {
48789
+ var item={ Title:"获利比例:", Type:1 };
48790
+ aryText.push(item);
48791
+ }
48792
+
48793
+ return aryText;
48794
+ }
48795
+
48796
+ this.DrawHScreenChipInfo=function()
48797
+ {
48798
+ var aryText=this.GetChipInfoTitle();
48799
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryText)) return;
48800
+
48801
+ this.Canvas.font=this.Font;
48802
+ this.Canvas.fillStyle=this.InfoColor;
48803
+ this.Canvas.textBaseline='bottom';
48804
+ this.Canvas.textAlign='left';
48805
+
48806
+ var top=this.ClientRect.Top+2*this.PixelRatio;
48807
+ var left=this.ClientRect.Left+2*this.PixelRatio;
48808
+ var bottom=this.ClientRect.Bottom;
48809
+ var lineHeight=this.LineHeight*GetDevicePixelRatio();
48810
+
48811
+ this.Canvas.save();
48812
+ this.Canvas.translate(left, top);
48813
+ this.Canvas.rotate(90 * Math.PI / 180);
48814
+
48815
+ var yText=0, xText=0;
48816
+ for(var i=0;i<aryText.length;++i)
48817
+ {
48818
+ var item=aryText[i];
48819
+ yText=0;
48820
+ var textColor=item.TitleColor;
48821
+ if (item.TitleColor) textColor=item.TitleColor;
48822
+ this.Canvas.fillStyle=textColor;
48823
+ this.Canvas.fillText(item.Title,yText,xText);
48824
+ var textWidth=this.Canvas.measureText(item.Title).width+4*this.PixelRatio;
48825
+ var yText=textWidth;
48826
+
48827
+ if (item.Text)
48828
+ {
48829
+ var textColor=item.TitleColor;
48830
+ if (item.TextColor) textColor=item.TextColor;
48831
+ this.Canvas.fillStyle=textColor;
48832
+ this.Canvas.fillText(item.Text,yText,xText);
48833
+ }
48834
+
48835
+ xText-=lineHeight;
48836
+ }
48837
+
48838
+
48839
+ this.Canvas.restore();
48840
+ }
48841
+
48842
+ this.DrawChipInfo=function()
48843
+ {
48844
+ var aryText=this.GetChipInfoTitle();
48845
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryText)) return;
48846
+
48847
+ var bottom=this.ClientRect.Top+this.ClientRect.Height-1;
48848
+ var left=this.ClientRect.Left+2;
48849
+ var right=this.ClientRect.Left+this.ClientRect.Width;
48850
+
48851
+ this.Canvas.font=this.Font;
48852
+ this.Canvas.fillStyle=this.InfoColor;
48853
+ this.Canvas.textBaseline='bottom';
48854
+ this.Canvas.textAlign='left';
48855
+
48856
+ var lineHeight=this.LineHeight*GetDevicePixelRatio();
48857
+ var yText=bottom;
48858
+ for(var i=0;i<aryText.length;++i)
48859
+ {
48860
+ var item=aryText[i];
48861
+
48862
+ var textColor=item.TitleColor;
48863
+ if (item.TitleColor) textColor=item.TitleColor;
48864
+ this.Canvas.fillStyle=textColor;
48865
+ this.Canvas.fillText(item.Title,left,yText);
48866
+ var textWidth=this.Canvas.measureText(item.Title).width+4;
48867
+ var xText=left+textWidth;
48868
+
48869
+ if (item.Text)
48870
+ {
48871
+ var textColor=item.TitleColor;
48872
+ if (item.TextColor) textColor=item.TextColor;
48873
+ this.Canvas.fillStyle=textColor;
48874
+ this.Canvas.fillText(item.Text,xText,yText);
48875
+ }
48876
+
48877
+ if (item.Type==1)
48878
+ {
48879
+ var barLeft=left+textWidth+2;
48880
+ var barWidth=(right-5-barLeft);
48881
+ this.Canvas.strokeStyle=this.ColorNoProfit;
48882
+ this.Canvas.strokeRect(barLeft,yText-lineHeight,barWidth,lineHeight);
48883
+ this.Canvas.strokeStyle=this.ColorProfit;
48884
+ this.Canvas.strokeRect(barLeft,yText-lineHeight,barWidth*(this.Data.ChipInfo.ProfitRate/100),lineHeight);
48885
+ var text=this.Data.ChipInfo.ProfitRate.toFixed(2)+'%';
48886
+ this.Canvas.textAlign='center';
48887
+ this.Canvas.fillText(text,barLeft+barWidth/2,yText);
48888
+ }
48889
+
48890
+ yText-=lineHeight;
48891
+ }
48892
+ }
48893
+
48894
+ this.DrawDayChip=function()
48895
+ {
48896
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Data.DayChip)) return;
48897
+
48898
+ var KLineFrame=this.HQChart.Frame.SubFrame[0].Frame;
48899
+ for(var i=0;i<this.Data.DayChip.length;++i)
48900
+ {
48901
+ var aryPoint=[];
48902
+ var chipData=this.Data.DayChip[i].Chip;
48903
+ if (!chipData) continue;
48904
+ var totalVol=0;
48905
+ for(var j=0;j<chipData.length;++j)
48906
+ {
48907
+ var vol=chipData[j];
48908
+ if(!vol) continue;
48909
+ totalVol+=vol;
48910
+ var price=(j+this.Data.MinPrice)/100;
48911
+ if (this.IsHScreen)
48912
+ {
48913
+ var y=KLineFrame.GetYFromData(price);
48914
+ var x=(vol/this.Data.MaxVol)*this.ClientRect.Height+this.ClientRect.Top;
48915
+ }
48916
+ else
48917
+ {
48918
+ var y=KLineFrame.GetYFromData(price);
48919
+ var x=(vol/this.Data.MaxVol)*this.ClientRect.Width+this.ClientRect.Left;
48920
+ }
48921
+
48922
+ aryPoint.push({X:x,Y:y});
48923
+ }
48924
+ this.Data.DayChip[i].Vol=totalVol;
48925
+ this.DrawArea(aryPoint,this.Data.DayChip[i].Color);
48926
+ }
48927
+ }
48928
+
48929
+ this.DrawArea=function(aryPoint,color)
48930
+ {
48931
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryPoint)) return;
48932
+
48933
+ this.Canvas.fillStyle=color;
48934
+ this.Canvas.beginPath();
48935
+ if (this.IsHScreen)
48936
+ {
48937
+ this.Canvas.moveTo(aryPoint[0].Y,this.ClientRect.Top);
48938
+ for(var i=0; i<aryPoint.length; ++i)
48939
+ {
48940
+ var item=aryPoint[i];
48941
+ this.Canvas.lineTo(item.Y,item.X);
48942
+ }
48943
+ this.Canvas.lineTo(aryPoint[aryPoint.length-1].Y,this.ClientRect.Top);
48944
+ }
48945
+ else
48946
+ {
48947
+ this.Canvas.moveTo(this.ClientRect.Left,aryPoint[0].Y);
48948
+ for(var i=0; i<aryPoint.length; ++i)
48949
+ {
48950
+ var item=aryPoint[i];
48951
+ this.Canvas.lineTo(item.X,item.Y);
48952
+ }
48953
+ this.Canvas.lineTo(this.ClientRect.Left,aryPoint[aryPoint.length-1].Y);
48954
+ }
48955
+
48956
+ this.Canvas.fill();
48957
+ }
48958
+ }
48959
+
48497
48960
  //窗口分割
48498
48961
  function FrameSplitPaint()
48499
48962
  {
@@ -81024,12 +81487,59 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
81024
81487
  this.Draw();
81025
81488
  }
81026
81489
 
81490
+ //获取筹码图 className=指定筹码类名 否则就查询所有
81491
+ this.GetStockChipChart=function(className)
81492
+ {
81493
+ if (className)
81494
+ return this.GetExtendChartByClassName(className);
81495
+
81496
+ var chart=this.GetExtendChartByClassName('StockChip');
81497
+ if (chart) return chart;
81498
+
81499
+ chart=this.GetExtendChartByClassName("StockChipPhone");
81500
+ return chart;
81501
+ }
81502
+
81503
+ this.DeleteStockChipChart=function()
81504
+ {
81505
+ var stockChip=this.GetStockChipChart();
81506
+ if (!stockChip) return;
81507
+
81508
+ var chipWidth=stockChip.Chart.Width;
81509
+ this.DeleteExtendChart(stockChip);
81510
+ this.Frame.ChartBorder.Right-=chipWidth;
81511
+ if (stockChip.Chart.ClassName=="StockChipPhone")
81512
+ {
81513
+ this.GlobalOption.RightHorizontal.Show=true;
81514
+ this.Frame.ResetXYSplit();
81515
+ }
81516
+ this.SetSizeChange(true);
81517
+ this.Draw();
81518
+ }
81519
+
81520
+ this.CreateStockChipPhone=function(option)
81521
+ {
81522
+ var chart=new StockChipPhone();
81523
+ chart.Canvas=this.Canvas;
81524
+ chart.ChartBorder=this.Frame.ChartBorder;
81525
+ chart.ChartFrame=this.Frame;
81526
+ chart.HQChart=this;
81527
+ chart.Left=this.Frame.ChartBorder.Right; //左边间距使用当前框架间距
81528
+ chart.SetOption(option);
81529
+ this.ExtendChartPaint.push(chart);
81530
+ this.Frame.ChartBorder.Right+=chart.Width; //创建筹码需要增加右边的间距
81531
+ this.GlobalOption.RightHorizontal.Show=false;
81532
+
81533
+ return chart;
81534
+ }
81535
+
81027
81536
  this.CreateExtendChart=function(name, option) //创建扩展图形
81028
81537
  {
81029
81538
  var chart;
81030
81539
  switch(name)
81031
81540
  {
81032
81541
  case '筹码分布':
81542
+ case "StockChip":
81033
81543
  chart=new StockChip();
81034
81544
  chart.Canvas=this.Canvas;
81035
81545
  chart.ChartBorder=this.Frame.ChartBorder;
@@ -81040,6 +81550,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
81040
81550
  this.ExtendChartPaint.push(chart);
81041
81551
  this.Frame.ChartBorder.Right+=chart.Width; //创建筹码需要增加右边的间距
81042
81552
  return chart;
81553
+ case "StockChipPhone":
81554
+ return this.CreateStockChipPhone(option);
81043
81555
  case 'KLineTooltip':
81044
81556
  if (option.Create && typeof(option.Create)=='function') chart=option.Create();
81045
81557
  else chart=new KLineTooltipPaint();
@@ -82213,7 +82725,9 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
82213
82725
 
82214
82726
  var bBGSpit=false, bShowStockChip=false;
82215
82727
  if (this.GetExtendChartByClassName("SessionBreaksPaint")) bBGSpit=true;
82216
- if (this.GetExtendChartByClassName('StockChip')) bShowStockChip=true; //筹码
82728
+ if (this.GetStockChipChart()) bShowStockChip=true; //筹码
82729
+ var stockChipConfig={Name:'StockChip', ShowType:1, Width:230 };
82730
+ //var stockChipConfig={Name:'StockChipPhone', Width:150 }; //手机版筹码
82217
82731
 
82218
82732
  var bShowCorss=false; //十字光标十字线
82219
82733
  if (this.ChartCorssCursor) bShowCorss=this.ChartCorssCursor.IsShowCorss;
@@ -82388,7 +82902,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
82388
82902
 
82389
82903
  { Name:"画图工具", Data:{ ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID, Args:[]}, Checked:this.IsShowDrawToolDialog() },
82390
82904
 
82391
- { Name:"移动筹码图", Data:{ ID:bShowStockChip?JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:JSCHART_MENU_ID.CMD_SHOW_STOCKCHIP_ID, Args:[]}, Checked:bShowStockChip},
82905
+ { Name:"移动筹码图", Data:{ ID:bShowStockChip?JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:JSCHART_MENU_ID.CMD_SHOW_STOCKCHIP_ID, Args:[stockChipConfig.Name, stockChipConfig]}, Checked:bShowStockChip},
82392
82906
 
82393
82907
  { Name:"十字光标线", Data:{ ID:JSCHART_MENU_ID.CMD_SHOW_CORSS_LINE_ID, Args:[!bShowCorss]}, Checked:bShowCorss },
82394
82908
 
@@ -91871,6 +92385,8 @@ function KLineChartHScreenContainer(uielement)
91871
92385
  frame.ChartBorder=border;
91872
92386
  frame.Identify=i; //窗口序号
91873
92387
  frame.RightSpaceCount=this.RightSpaceCount; //右边
92388
+ frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
92389
+ frame.GlobalOption=this.GlobalOption;
91874
92390
 
91875
92391
  frame.HorizontalMax=20;
91876
92392
  frame.HorizontalMin=10;
@@ -91881,6 +92397,7 @@ function KLineChartHScreenContainer(uielement)
91881
92397
  frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');
91882
92398
  frame.YSplitOperator.FrameSplitData2=this.FrameSplitData.get('double');
91883
92399
  frame.YSplitOperator.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
92400
+ frame.YSplitOperator.HQChart=this;
91884
92401
  //主图上下间距
91885
92402
  var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
91886
92403
  border.TopSpace=12*pixelTatio;
@@ -91891,6 +92408,8 @@ function KLineChartHScreenContainer(uielement)
91891
92408
  frame.YSplitOperator=new FrameSplitY();
91892
92409
  frame.YSplitOperator.LanguageID=this.LanguageID;
91893
92410
  frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');
92411
+ frame.YSplitOperator.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
92412
+ frame.YSplitOperator.HQChart=this;
91894
92413
  //frame.IsLocked = true;
91895
92414
  }
91896
92415
 
@@ -91924,6 +92443,39 @@ function KLineChartHScreenContainer(uielement)
91924
92443
  this.Frame.SubFrame[i]=subFrame;
91925
92444
  }
91926
92445
  }
92446
+
92447
+ this.CreateStockChipPhone=function(option)
92448
+ {
92449
+ var chart=new StockChipPhone();
92450
+ chart.Canvas=this.Canvas;
92451
+ chart.ChartBorder=this.Frame.ChartBorder;
92452
+ chart.ChartFrame=this.Frame;
92453
+ chart.HQChart=this;
92454
+ chart.Left=this.Frame.ChartBorder.Bottom; //左边间距使用当前框架间距
92455
+ chart.SetOption(option);
92456
+ this.ExtendChartPaint.push(chart);
92457
+ this.Frame.ChartBorder.Bottom+=chart.Width; //创建筹码需要增加右边的间距
92458
+ this.GlobalOption.RightHorizontal.Show=false;
92459
+
92460
+ return chart;
92461
+ }
92462
+
92463
+ this.DeleteStockChipChart=function()
92464
+ {
92465
+ var stockChip=this.GetStockChipChart();
92466
+ if (!stockChip) return;
92467
+
92468
+ var chipWidth=stockChip.Chart.Width;
92469
+ this.DeleteExtendChart(stockChip);
92470
+ this.Frame.ChartBorder.Bottom-=chipWidth;
92471
+ if (stockChip.Chart.ClassName=="StockChipPhone")
92472
+ {
92473
+ this.GlobalOption.RightHorizontal.Show=true;
92474
+ this.Frame.ResetXYSplit();
92475
+ }
92476
+ this.SetSizeChange(true);
92477
+ this.Draw();
92478
+ }
91927
92479
  }
91928
92480
 
91929
92481
 
@@ -129284,6 +129836,8 @@ function JSReportChartContainer(uielement)
129284
129836
 
129285
129837
  this.UIOnMounseOut=function(e)
129286
129838
  {
129839
+ this.HideMinuteChartTooltip();
129840
+
129287
129841
  var bDraw=false;
129288
129842
  var tabChart=this.GetTabChart();
129289
129843
  if (tabChart && tabChart.MoveOnTabIndex>=0)
@@ -129308,6 +129862,8 @@ function JSReportChartContainer(uielement)
129308
129862
 
129309
129863
  this.UIOnMouseleave=function(e)
129310
129864
  {
129865
+ this.HideMinuteChartTooltip();
129866
+
129311
129867
  var tabChart=this.GetTabChart();
129312
129868
  if (tabChart && tabChart.MoveOnTabIndex>=0)
129313
129869
  {
@@ -137164,6 +137720,7 @@ function JSTReportChartContainer(uielement)
137164
137720
 
137165
137721
  if (item[32]) stock.CloseLine=item[32]; //32=收盘价线
137166
137722
  if (item[33]) stock.KLine=item[33]; //33=K线
137723
+ if (item[34]) stock.ExePrice=item[34]; //34=行权价设置 { BGColor:背景色, Text:, TextColor }
137167
137724
 
137168
137725
  //10个数值型 101-199
137169
137726
  if (IFrameSplitOperator.IsNumber(item[101])) stock.ReserveNumber1=item[101];
@@ -137988,6 +138545,8 @@ var TREPORT_COLUMN_ID=
137988
138545
  NAME_EX_ID:27, //扩展名字
137989
138546
  CLOSE_LINE_ID:28, //收盘价线
137990
138547
  KLINE_ID:29, //K线
138548
+
138549
+ EXE_PRICE_EX_ID:30, //行权价格 扩张设置
137991
138550
 
137992
138551
  //预留数值类型 10个 201-299
137993
138552
  RESERVE_NUMBER1_ID:201, //ReserveNumber1:
@@ -138034,6 +138593,7 @@ var MAP_TREPORT_COLUMN_FIELD=new Map(
138034
138593
  [TREPORT_COLUMN_ID.AVERAGE_PRICE_ID,"AvPrice"],
138035
138594
  [TREPORT_COLUMN_ID.POSITION_ID,"Position"],
138036
138595
  [TREPORT_COLUMN_ID.AMPLITUDE_ID,"Amplitude"],
138596
+ [TREPORT_COLUMN_ID.EXE_PRICE_EX_ID, "ExePrice"],
138037
138597
 
138038
138598
  [TREPORT_COLUMN_ID.RESERVE_NUMBER1_ID,"ReserveNumber1"],
138039
138599
  [TREPORT_COLUMN_ID.RESERVE_NUMBER2_ID,"ReserveNumber2"],
@@ -138716,6 +139276,55 @@ function ChartTReport()
138716
139276
  }
138717
139277
  }
138718
139278
 
139279
+ this.FormatCenterItem=function(data,drawInfo)
139280
+ {
139281
+ if (!data || !data.TData) return;
139282
+ var leftData=this.GetExePriceExtendData(data.TData.LeftData);
139283
+ var rightData=this.GetExePriceExtendData(data.TData.RightData);
139284
+
139285
+ if (leftData)
139286
+ {
139287
+ if (leftData.BGColor) drawInfo.BGColor=leftData.BGColor;
139288
+ if (leftData.TitleColor) drawInfo.TextColor=leftData.TitleColor;
139289
+ if (leftData.Text && leftData.TextColor)
139290
+ {
139291
+ drawInfo.Left={ Text:leftData.Text, TextColor:leftData.TextColor};
139292
+ }
139293
+ else if (leftData.IconFont && leftData.TextColor)
139294
+ {
139295
+ drawInfo.Left={ IconFont:leftData.IconFont, TextColor:leftData.TextColor};
139296
+ }
139297
+
139298
+ }
139299
+
139300
+ if (rightData)
139301
+ {
139302
+ if (rightData.BGColor) drawInfo.BGColor=rightData.BGColor;
139303
+ if (rightData.TitleColor) drawInfo.TextColor=rightData.TitleColor;
139304
+
139305
+ if (rightData.Text && rightData.TextColor)
139306
+ {
139307
+ drawInfo.Right={ Text:rightData.Text, TextColor:rightData.TextColor};
139308
+ }
139309
+ else if (rightData.IconFont && rightData.TextColor)
139310
+ {
139311
+ drawInfo.Right={ IconFont:rightData.IconFont, TextColor:rightData.TextColor};
139312
+ }
139313
+ }
139314
+ }
139315
+
139316
+ //行权价列扩展信息
139317
+ this.GetExePriceExtendData=function(data)
139318
+ {
139319
+ if (!data) return null;
139320
+
139321
+ var fieldName=MAP_TREPORT_COLUMN_FIELD.get(TREPORT_COLUMN_ID.EXE_PRICE_EX_ID);
139322
+ if (!fieldName) return null;
139323
+
139324
+ var value=data[fieldName];
139325
+ return value;
139326
+ }
139327
+
138719
139328
  this.DrawCenterItem=function(index, data, column, rtItem, cellType) //cellType 0=中间字段 1=左侧 2=右侧
138720
139329
  {
138721
139330
  //tooltip提示
@@ -138728,6 +139337,10 @@ function ChartTReport()
138728
139337
  var drawInfo={ Text:null, TextColor:this.CenterItemConfig.TextColor, BGColor:this.CenterItemConfig.BGColor, TextAlign:column.TextAlign, Rect:rtItem, RectText:rtText };
138729
139338
  drawInfo.Text=`${data.ExePrice.toFixed(data.Decimal)}`;
138730
139339
 
139340
+ this.FormatCenterItem(data,drawInfo);
139341
+
139342
+
139343
+
138731
139344
  this.DrawCell(drawInfo);
138732
139345
  }
138733
139346
 
@@ -138969,7 +139582,7 @@ function ChartTReport()
138969
139582
  {
138970
139583
  var rtText=drawInfo.RectText;
138971
139584
  var yCenter=rtText.Top+(rtText.Height/2);
138972
-
139585
+ var fontBackup=null; //字体备份
138973
139586
  if (drawInfo.BGColor) //背景
138974
139587
  {
138975
139588
  var rtItem=drawInfo.Rect;
@@ -138996,6 +139609,44 @@ function ChartTReport()
138996
139609
  if(drawInfo.TextColor) this.Canvas.fillStyle=drawInfo.TextColor;
138997
139610
  this.DrawText(drawInfo.Text, drawInfo.TextAlign, rtText.Left, yCenter, rtText.Width);
138998
139611
  }
139612
+
139613
+ if (drawInfo.Left)
139614
+ {
139615
+ var item=drawInfo.Left;
139616
+ this.Canvas.textAlign="left";
139617
+ this.Canvas.textBaseline="middle";
139618
+ this.Canvas.fillStyle=item.TextColor;
139619
+ if (item.IconFont)
139620
+ {
139621
+ if (!fontBackup) fontBackup=this.Canvas.font;
139622
+ this.Canvas.font=item.IconFont.Font;
139623
+ this.Canvas.fillText(item.IconFont.Symbol,rtText.Left,yCenter);
139624
+ }
139625
+ else if (item.Text)
139626
+ {
139627
+ this.Canvas.fillText(item.Text,rtText.Left,yCenter);
139628
+ }
139629
+ }
139630
+
139631
+ if (drawInfo.Right)
139632
+ {
139633
+ var item=drawInfo.Right;
139634
+ this.Canvas.textAlign="right";
139635
+ this.Canvas.textBaseline="middle";
139636
+ this.Canvas.fillStyle=item.TextColor;
139637
+ if (item.IconFont)
139638
+ {
139639
+ if (!fontBackup) fontBackup=this.Canvas.font;
139640
+ this.Canvas.font=item.IconFont.Font;
139641
+ this.Canvas.fillText(item.IconFont.Symbol,rtText.Right,yCenter);
139642
+ }
139643
+ else if (item.Text)
139644
+ {
139645
+ this.Canvas.fillText(item.Text,rtText.Right,yCenter);
139646
+ }
139647
+ }
139648
+
139649
+ if (fontBackup) this.Canvas.font=fontBackup;
138999
139650
  }
139000
139651
 
139001
139652
  this.GetTooltipData=function(x,y)
@@ -149041,7 +149692,7 @@ function HQChartScriptWorker()
149041
149692
 
149042
149693
 
149043
149694
 
149044
- var HQCHART_VERSION="1.1.14164";
149695
+ var HQCHART_VERSION="1.1.14178";
149045
149696
 
149046
149697
  function PrintHQChartVersion()
149047
149698
  {