hqchart 1.1.14172 → 1.1.14181

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.
@@ -2030,16 +2030,6 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
2030
2030
  }
2031
2031
  }
2032
2032
 
2033
- //历史分钟数据 更改日期
2034
- this.ChangeTradeDate=function(tradeDate)
2035
- {
2036
- if(this.JSChartContainer && typeof(this.JSChartContainer.ChangeTradeDate)=='function')
2037
- {
2038
- JSConsole.Chart.Log('[JSChart:ChangeTradeDate] date', tradeDate);
2039
- this.JSChartContainer.ChangeTradeDate(tradeDate);
2040
- }
2041
- }
2042
-
2043
2033
  //多日走势图
2044
2034
  this.ChangeDayCount=function(count, option)
2045
2035
  {
@@ -2242,6 +2232,15 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
2242
2232
  return this.JSChartContainer.PopupMenuByDrapdown(menuData, rtButton);
2243
2233
  }
2244
2234
  }
2235
+
2236
+ this.ExecuteMenuCommand=function(cmdID, aryArgs)
2237
+ {
2238
+ if(this.JSChartContainer && typeof(this.JSChartContainer.ExecuteMenuCommand)=='function')
2239
+ {
2240
+ JSConsole.Chart.Log('[JSChart:ExecuteMenuCommand] ');
2241
+ return this.JSChartContainer.ExecuteMenuCommand(cmdID, aryArgs);
2242
+ }
2243
+ }
2245
2244
  }
2246
2245
 
2247
2246
  JSChart.LastVersion=null; //最新的版本号
@@ -2661,6 +2660,8 @@ var JSCHART_EVENT_ID=
2661
2660
  ON_FORMAT_KLINE_INFO_FLOAT_TOOLTIP:162, //格式化信息地雷显示文字
2662
2661
 
2663
2662
  SEARCH_DIALOG_ON_CLICK_INDEX:163, //切换指标-指标对话框
2663
+
2664
+ ON_CALCULATE_CHIP_DATA:164, //计算筹码数据 (筹码图用)
2664
2665
  }
2665
2666
 
2666
2667
  var JSCHART_OPERATOR_ID=
@@ -9916,22 +9917,19 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9916
9917
  this.ShowDrawToolDialog();
9917
9918
  break;
9918
9919
  case JSCHART_MENU_ID.CMD_SHOW_STOCKCHIP_ID:
9919
- var option={Name:'筹码分布', ShowType:1, Width:230 };
9920
- var extendChart=this.CreateExtendChart(option.Name, option); //创建扩展图形
9921
- this.SetSizeChange(true);
9922
- this.Draw();
9923
- break;
9924
- case JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:
9925
- var StockChip=this.GetExtendChartByClassName('StockChip');
9926
- if (StockChip)
9920
+ //var option={Name:'筹码分布', ShowType:1, Width:230 };
9921
+ var stockChip=this.GetStockChipChart();
9922
+ if (stockChip) return;
9923
+ if (srcParam)
9927
9924
  {
9928
- var chipWidth=StockChip.Chart.Width;
9929
- this.DeleteExtendChart(StockChip);
9930
- this.Frame.ChartBorder.Right-=chipWidth;
9925
+ var extendChart=this.CreateExtendChart(srcParam, aryArgs[1]); //创建扩展图形
9931
9926
  this.SetSizeChange(true);
9932
9927
  this.Draw();
9933
9928
  }
9934
9929
  break;
9930
+ case JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:
9931
+ if (this.DeleteStockChipChart) this.DeleteStockChipChart();
9932
+ break;
9935
9933
  case JSCHART_MENU_ID.CMD_ENABLE_SELECT_RECT_ID:
9936
9934
  if (IFrameSplitOperator.IsBool(srcParam))
9937
9935
  this.EnableSelectRect=srcParam;
@@ -13862,7 +13860,8 @@ function AverageWidthFrame()
13862
13860
  var borderTop=this.ChartBorder.Top;
13863
13861
  var borderBottom=this.ChartBorder.Bottom;
13864
13862
  var isDrawLeft=borderTop>10*pixelTatio && this.IsShowYText[0]===true && this.YTextPosition[0]!=2;
13865
- var isDrawRight=borderBottom>10*pixelTatio && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
13863
+ //var isDrawRight=borderBottom>10*pixelTatio && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
13864
+ var isDrawRight=this.IsShowRightHorizontal();
13866
13865
  }
13867
13866
  else
13868
13867
  {
@@ -13870,7 +13869,7 @@ function AverageWidthFrame()
13870
13869
  var borderLeft=this.ChartBorder.Left;
13871
13870
  var isDrawLeft=borderLeft>10 && this.IsShowYText[0]===true && this.YTextPosition[0]!=2;
13872
13871
  //var isDrawRight=borderRight>10 && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
13873
- isDrawRight=this.IsShowRightHorizontal();
13872
+ var isDrawRight=this.IsShowRightHorizontal();
13874
13873
  }
13875
13874
 
13876
13875
  if (!isDrawRight && !isDrawLeft) return null;
@@ -18560,6 +18559,25 @@ function KLineHScreenFrame()
18560
18559
  }
18561
18560
  }
18562
18561
 
18562
+ this.IsShowRightHorizontal=function()
18563
+ {
18564
+ var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
18565
+ var borderBottom=this.ChartBorder.Bottom;
18566
+ if (borderBottom<=10*pixelTatio) return false;
18567
+
18568
+ if (this.YTextPosition[1]==2) return false;
18569
+ if (this.IsShowYText[1]===false) return false;
18570
+
18571
+ if (this.GlobalOption && this.GlobalOption.RightHorizontal)
18572
+ {
18573
+ var item=this.GlobalOption.RightHorizontal;
18574
+ if (item.Show===false) return false;
18575
+ }
18576
+
18577
+ return true;
18578
+ }
18579
+
18580
+
18563
18581
  //画Y轴
18564
18582
  this.DrawHorizontal=function()
18565
18583
  {
@@ -18575,7 +18593,8 @@ function KLineHScreenFrame()
18575
18593
  var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
18576
18594
 
18577
18595
  var isDrawLeft=borderTop>10*pixelTatio && this.IsShowYText[0]===true && this.YTextPosition[0]!=2;
18578
- var isDrawRight=borderBottom>10*pixelTatio && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
18596
+ //var isDrawRight=borderBottom>10*pixelTatio && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
18597
+ var isDrawRight=this.IsShowRightHorizontal();
18579
18598
 
18580
18599
  for(var i=this.HorizontalInfo.length-1; i>=0; --i) //从左往右画分割线
18581
18600
  {
@@ -44358,12 +44377,38 @@ function StockChip()
44358
44377
  else this.EvenlyDistribute(aryChip, data);
44359
44378
  }
44360
44379
 
44380
+ this.SendCalculateChipEvent=function()
44381
+ {
44382
+ var event=this.HQChart.GetEventCallback(JSCHART_EVENT_ID.ON_CALCULATE_CHIP_DATA);
44383
+ if (!event) return null;
44384
+
44385
+ var bindData=this.HQChart.ChartPaint[0].Data;
44386
+ var curIndex=bindData.DataOffset+parseInt(this.HQChart.CursorIndex);
44387
+ var sendData=
44388
+ {
44389
+ Symbol:this.HQChart.Symbol, Period:this.HQChart.Period, KData:bindData,
44390
+ CurrentIndex:curIndex, Y:this.HQChart.LastPoint.Y, HQChart:this.HQChart,
44391
+ ShowType:this.ShowType, CalculateType:this.CalculateType,
44392
+ PreventDefault:false,
44393
+ Result:null, //true/false
44394
+ };
44395
+
44396
+ event.Callback(event, sendData, this);
44397
+
44398
+ return sendData;
44399
+ }
44400
+
44361
44401
  this.CalculateChip=function() //计算筹码
44362
44402
  {
44363
44403
  if (!this.HQChart) return false;
44364
44404
  if (!this.HQChart.FlowCapitalReady) return false;
44365
44405
  var symbol=this.HQChart.Symbol;
44366
44406
  if (!symbol) return false;
44407
+
44408
+ var recvData=this.SendCalculateChipEvent();
44409
+ if (recvData && recvData.PreventDefault)
44410
+ return recvData.Result;
44411
+
44367
44412
  if (MARKET_SUFFIX_NAME.IsSHSZIndex(symbol)) return false; //指数暂时不支持移动筹码
44368
44413
 
44369
44414
  var bindData=this.HQChart.ChartPaint[0].Data;
@@ -44560,18 +44605,35 @@ function StockChipPhone()
44560
44605
  this.ClassName='StockChipPhone';
44561
44606
  this.ShowType=0; //0=所有筹码 手机版只支持0
44562
44607
 
44608
+ //手机端没有按钮
44609
+ this.DrawToolbar=function(moveonPoint, mouseStatus) { }
44610
+
44563
44611
  this.Draw=function()
44564
44612
  {
44565
- this.ShowType=0;
44613
+ this.IsHScreen=this.ChartFrame.IsHScreen==true;
44566
44614
  this.PixelRatio=GetDevicePixelRatio();
44567
- var left=ToFixedPoint(this.ChartBorder.GetRight()+this.Left);
44568
- var top=ToFixedPoint(this.ChartBorder.GetTop());
44569
- var right=ToFixedPoint(left+this.Width-1*this.PixelRatio);
44570
- var bottom=ToFixedPoint(this.ChartBorder.GetBottom());
44571
- var width=right-left;
44572
- var height=bottom-top;
44573
- this.ClientRect={Left:left,Top:top,Width:width,Height:height};
44574
-
44615
+ if (this.IsHScreen)
44616
+ {
44617
+ var border=this.ChartBorder.GetHScreenBorder();
44618
+ var left=ToFixedPoint(border.Left);
44619
+ var right=ToFixedPoint(border.Right);
44620
+ var top=ToFixedPoint(border.Bottom+this.Left);
44621
+ var bottom=ToFixedPoint(border.ChartHeight-2*this.PixelRatio);
44622
+ this.ClientRect={Left:left,Top:top, Right:right, Bottom:bottom};
44623
+ this.ClientRect.Width=this.ClientRect.Right-this.ClientRect.Left;
44624
+ this.ClientRect.Height=this.ClientRect.Bottom-this.ClientRect.Top;
44625
+ }
44626
+ else
44627
+ {
44628
+ var left=ToFixedPoint(this.ChartBorder.GetRight()+this.Left);
44629
+ var top=ToFixedPoint(this.ChartBorder.GetTop());
44630
+ var right=ToFixedPoint(left+this.Width-1*this.PixelRatio);
44631
+ var bottom=ToFixedPoint(this.ChartBorder.GetBottom());
44632
+ this.ClientRect={Left:left,Top:top,Right:right, Bottom:bottom};
44633
+ this.ClientRect.Width=this.ClientRect.Right-this.ClientRect.Left;
44634
+ this.ClientRect.Height=this.ClientRect.Bottom-this.ClientRect.Top;
44635
+ }
44636
+
44575
44637
  if (ChartData.IsTickPeriod(this.HQChart.Period))
44576
44638
  {
44577
44639
 
@@ -44580,11 +44642,12 @@ function StockChipPhone()
44580
44642
  {
44581
44643
  if (this.CalculateChip())
44582
44644
  {
44583
- this.DrawFrame();
44584
44645
  this.DrawAllChip();
44585
-
44586
- this.CalculateCast(); //计算成本
44587
- this.DrawChipInfo();
44646
+ if (this.ShowType==1|| this.ShowType==2) this.DrawDayChip();
44647
+
44648
+ this.CalculateCast(); //计算成本
44649
+ if (this.IsHScreen) this.DrawHScreenChipInfo();
44650
+ else this.DrawChipInfo();
44588
44651
  }
44589
44652
  }
44590
44653
 
@@ -44592,17 +44655,170 @@ function StockChipPhone()
44592
44655
  this.SizeChange=false;
44593
44656
  }
44594
44657
 
44595
- this.DrawToolbar=function(moveonPoint, mouseStatus)
44658
+ this.DrawAllChip=function()
44596
44659
  {
44660
+ var KLineFrame=this.HQChart.Frame.SubFrame[0].Frame;
44661
+ var selectPrice=this.Data.SelectData.Close;
44662
+ var aryProfitPoint=[];
44663
+ var aryNoProfitPoint=[];
44664
+ var totalVol=0,totalAmount=0,totalProfitVol=0, totalYProfitVol=0; //总的成交量, 总的成交金额, 总的盈利的成交量
44665
+ var yPrice=this.Data.YPrice;
44666
+
44667
+ var maxPrice=KLineFrame.HorizontalMax;
44668
+ var minPrice=KLineFrame.HorizontalMin;
44597
44669
 
44670
+ var MaxVol=1;
44671
+ for(var i=0;i<this.Data.AllChip.length;++i)
44672
+ {
44673
+ var vol=this.Data.AllChip[i];
44674
+ if(!vol) continue;
44675
+ var price=(i+this.Data.MinPrice)/this.PriceZoom;
44676
+ totalVol+=vol;
44677
+ totalAmount+=price*vol;
44678
+
44679
+ if (price<yPrice) totalYProfitVol+=vol; //获利的成交量
44680
+ if (price<selectPrice) totalProfitVol+=vol; //鼠标当前位置 获利的成交量
44681
+
44682
+ if (price<=maxPrice && price>=minPrice)
44683
+ {
44684
+ if (MaxVol<vol) MaxVol=vol;
44685
+ }
44686
+ }
44687
+ this.Data.MaxVol=MaxVol; //把成交量最大值替换成 当前屏成交量最大值
44688
+
44689
+ for(var i=0;i<this.Data.AllChip.length;++i)
44690
+ {
44691
+ var vol=this.Data.AllChip[i];
44692
+ if(!vol) continue;
44693
+ var price=(i+this.Data.MinPrice)/this.PriceZoom;
44694
+ if (price>maxPrice || price<minPrice) continue;
44695
+
44696
+ if (this.IsHScreen)
44697
+ {
44698
+ var y=KLineFrame.GetYFromData(price,false);
44699
+ var x=(vol/this.Data.MaxVol)*this.ClientRect.Height+this.ClientRect.Top;
44700
+ }
44701
+ else
44702
+ {
44703
+ var y=KLineFrame.GetYFromData(price,false);
44704
+ var x=(vol/this.Data.MaxVol)*this.ClientRect.Width+this.ClientRect.Left;
44705
+ }
44706
+
44707
+ if (price<selectPrice) aryProfitPoint.push({X:x,Y:y});
44708
+ else aryNoProfitPoint.push({X:x,Y:y});
44709
+ }
44710
+
44711
+ this.Data.ChipInfo=
44712
+ {
44713
+ Vol:totalVol, AveragePrice:totalAmount/totalVol, ProfitVol:totalProfitVol,
44714
+ ProfitRate:totalVol>0?totalProfitVol/totalVol*100:0,
44715
+ YProfitRate:totalVol>0?totalYProfitVol/totalVol*100:0
44716
+ };
44717
+
44718
+ if (this.ShowType==0)
44719
+ {
44720
+ this.DrawLines(aryProfitPoint,this.ColorProfit);
44721
+ this.DrawLines(aryNoProfitPoint,this.ColorNoProfit);
44722
+ var averagePrice=this.Data.ChipInfo.AveragePrice;
44723
+ if (averagePrice>0 && averagePrice<=maxPrice && averagePrice>=minPrice)
44724
+ {
44725
+ averagePrice=averagePrice.toFixed(2);
44726
+ this.DrawAveragePriceLine(aryProfitPoint,aryNoProfitPoint,KLineFrame.GetYFromData(averagePrice),this.ColorAveragePrice);
44727
+ }
44728
+ }
44729
+ else //在火焰山模式下, 筹码用一个颜色
44730
+ {
44731
+ this.DrawLines(aryProfitPoint,this.ColorBG);
44732
+ this.DrawLines(aryNoProfitPoint,this.ColorBG);
44733
+ }
44734
+ }
44735
+
44736
+ this.DrawLines=function(aryPoint,color)
44737
+ {
44738
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryPoint)) return;
44739
+
44740
+ this.Canvas.strokeStyle=color;
44741
+ this.Canvas.beginPath();
44742
+ for(var i =0; i<aryPoint.length; ++i)
44743
+ {
44744
+ var item=aryPoint[i];
44745
+ if (this.IsHScreen)
44746
+ {
44747
+ this.Canvas.moveTo(item.Y,this.ClientRect.Top);
44748
+ this.Canvas.lineTo(item.Y,item.X);
44749
+ }
44750
+ else
44751
+ {
44752
+ this.Canvas.moveTo(this.ClientRect.Left,item.Y);
44753
+ this.Canvas.lineTo(item.X,item.Y);
44754
+ }
44755
+
44756
+ }
44757
+ this.Canvas.stroke();
44758
+ }
44759
+
44760
+ this.DrawAveragePriceLine=function(aryProfitPoint,aryNoProfitPoint,y,color)
44761
+ {
44762
+ for(var i=0; i<aryProfitPoint.length; ++i)
44763
+ {
44764
+ var item=aryProfitPoint[i];
44765
+ if (item.Y==y)
44766
+ {
44767
+ this.Canvas.strokeStyle=color;
44768
+ this.Canvas.beginPath();
44769
+ if (this.IsHScreen)
44770
+ {
44771
+ this.Canvas.moveTo(item.Y,this.ClientRect.Top);
44772
+ this.Canvas.lineTo(item.Y,item.X);
44773
+ }
44774
+ else
44775
+ {
44776
+ this.Canvas.moveTo(this.ClientRect.Left,item.Y);
44777
+ this.Canvas.lineTo(item.X,item.Y);
44778
+ }
44779
+
44780
+ this.Canvas.stroke();
44781
+ return;
44782
+ }
44783
+ }
44784
+
44785
+ for(var i=0; i<aryNoProfitPoint.length; ++i)
44786
+ {
44787
+ var item=aryNoProfitPoint[i];
44788
+ if (item.Y==y)
44789
+ {
44790
+ this.Canvas.strokeStyle=color;
44791
+ this.Canvas.beginPath();
44792
+ if (this.IsHScreen)
44793
+ {
44794
+ this.Canvas.moveTo(item.Y,this.ClientRect.Top);
44795
+ this.Canvas.lineTo(item.Y,item.X);
44796
+ }
44797
+ else
44798
+ {
44799
+ this.Canvas.moveTo(this.ClientRect.Left,item.Y);
44800
+ this.Canvas.lineTo(item.X,item.Y);
44801
+ }
44802
+ this.Canvas.stroke();
44803
+ return;
44804
+ }
44805
+ }
44598
44806
  }
44599
44807
 
44600
44808
  this.GetChipInfoTitle=function()
44601
44809
  {
44602
44810
  var aryText=[]; //从底部往上
44603
44811
 
44604
- var item={ Title:"日期:", Text:IFrameSplitOperator.FormatDateString(this.Data.SelectData.Date) };
44605
- aryText.push(item);
44812
+ if (ChartData.IsDayPeriod(this.HQChart.Period, true))
44813
+ {
44814
+ var item={ Title:"日期:", Text:IFrameSplitOperator.FormatDateString(this.Data.SelectData.Date) };
44815
+ aryText.push(item);
44816
+ }
44817
+ else if (ChartData.IsMinutePeriod(this.HQChart.Period, true))
44818
+ {
44819
+ var item={ Title:`${IFrameSplitOperator.FormatDateString(this.Data.SelectData.Date)} ${IFrameSplitOperator.FormatTimeString(this.Data.SelectData.Time, "HH:MM")}` };
44820
+ aryText.push(item);
44821
+ }
44606
44822
 
44607
44823
  var item={ Title:"集中度:", Text:"--.--%", };
44608
44824
  if (IFrameSplitOperator.IsNonEmptyArray(this.Data.Cast)) item.Text=`${this.Data.Cast[0].Rate.toFixed(2)}%`;
@@ -44622,9 +44838,66 @@ function StockChipPhone()
44622
44838
  aryText.push(item);
44623
44839
  }
44624
44840
 
44841
+ if (this.IsHScreen) //横屏直接就显示数值 画进度条太麻烦了
44842
+ {
44843
+ var item={ Title:"获利比例:", Text: `${this.Data.ChipInfo.ProfitRate.toFixed(2)}%`};
44844
+ aryText.push(item);
44845
+ }
44846
+ else
44847
+ {
44848
+ var item={ Title:"获利比例:", Type:1 };
44849
+ aryText.push(item);
44850
+ }
44851
+
44625
44852
  return aryText;
44626
44853
  }
44627
44854
 
44855
+ this.DrawHScreenChipInfo=function()
44856
+ {
44857
+ var aryText=this.GetChipInfoTitle();
44858
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryText)) return;
44859
+
44860
+ this.Canvas.font=this.Font;
44861
+ this.Canvas.fillStyle=this.InfoColor;
44862
+ this.Canvas.textBaseline='bottom';
44863
+ this.Canvas.textAlign='left';
44864
+
44865
+ var top=this.ClientRect.Top+2*this.PixelRatio;
44866
+ var left=this.ClientRect.Left+2*this.PixelRatio;
44867
+ var bottom=this.ClientRect.Bottom;
44868
+ var lineHeight=this.LineHeight*GetDevicePixelRatio();
44869
+
44870
+ this.Canvas.save();
44871
+ this.Canvas.translate(left, top);
44872
+ this.Canvas.rotate(90 * Math.PI / 180);
44873
+
44874
+ var yText=0, xText=0;
44875
+ for(var i=0;i<aryText.length;++i)
44876
+ {
44877
+ var item=aryText[i];
44878
+ yText=0;
44879
+ var textColor=item.TitleColor;
44880
+ if (item.TitleColor) textColor=item.TitleColor;
44881
+ this.Canvas.fillStyle=textColor;
44882
+ this.Canvas.fillText(item.Title,yText,xText);
44883
+ var textWidth=this.Canvas.measureText(item.Title).width+4*this.PixelRatio;
44884
+ var yText=textWidth;
44885
+
44886
+ if (item.Text)
44887
+ {
44888
+ var textColor=item.TitleColor;
44889
+ if (item.TextColor) textColor=item.TextColor;
44890
+ this.Canvas.fillStyle=textColor;
44891
+ this.Canvas.fillText(item.Text,yText,xText);
44892
+ }
44893
+
44894
+ xText-=lineHeight;
44895
+ }
44896
+
44897
+
44898
+ this.Canvas.restore();
44899
+ }
44900
+
44628
44901
  this.DrawChipInfo=function()
44629
44902
  {
44630
44903
  var aryText=this.GetChipInfoTitle();
@@ -44652,27 +44925,94 @@ function StockChipPhone()
44652
44925
  var textWidth=this.Canvas.measureText(item.Title).width+4;
44653
44926
  var xText=left+textWidth;
44654
44927
 
44655
- var textColor=item.TitleColor;
44656
- if (item.TextColor) textColor=item.TextColor;
44657
- this.Canvas.fillStyle=textColor;
44658
- this.Canvas.fillText(item.Text,xText,yText);
44928
+ if (item.Text)
44929
+ {
44930
+ var textColor=item.TitleColor;
44931
+ if (item.TextColor) textColor=item.TextColor;
44932
+ this.Canvas.fillStyle=textColor;
44933
+ this.Canvas.fillText(item.Text,xText,yText);
44934
+ }
44935
+
44936
+ if (item.Type==1)
44937
+ {
44938
+ var barLeft=left+textWidth+2;
44939
+ var barWidth=(right-5-barLeft);
44940
+ this.Canvas.strokeStyle=this.ColorNoProfit;
44941
+ this.Canvas.strokeRect(barLeft,yText-lineHeight,barWidth,lineHeight);
44942
+ this.Canvas.strokeStyle=this.ColorProfit;
44943
+ this.Canvas.strokeRect(barLeft,yText-lineHeight,barWidth*(this.Data.ChipInfo.ProfitRate/100),lineHeight);
44944
+ var text=this.Data.ChipInfo.ProfitRate.toFixed(2)+'%';
44945
+ this.Canvas.textAlign='center';
44946
+ this.Canvas.fillText(text,barLeft+barWidth/2,yText);
44947
+ }
44659
44948
 
44660
44949
  yText-=lineHeight;
44661
44950
  }
44951
+ }
44952
+
44953
+ this.DrawDayChip=function()
44954
+ {
44955
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Data.DayChip)) return;
44956
+
44957
+ var KLineFrame=this.HQChart.Frame.SubFrame[0].Frame;
44958
+ for(var i=0;i<this.Data.DayChip.length;++i)
44959
+ {
44960
+ var aryPoint=[];
44961
+ var chipData=this.Data.DayChip[i].Chip;
44962
+ if (!chipData) continue;
44963
+ var totalVol=0;
44964
+ for(var j=0;j<chipData.length;++j)
44965
+ {
44966
+ var vol=chipData[j];
44967
+ if(!vol) continue;
44968
+ totalVol+=vol;
44969
+ var price=(j+this.Data.MinPrice)/100;
44970
+ if (this.IsHScreen)
44971
+ {
44972
+ var y=KLineFrame.GetYFromData(price);
44973
+ var x=(vol/this.Data.MaxVol)*this.ClientRect.Height+this.ClientRect.Top;
44974
+ }
44975
+ else
44976
+ {
44977
+ var y=KLineFrame.GetYFromData(price);
44978
+ var x=(vol/this.Data.MaxVol)*this.ClientRect.Width+this.ClientRect.Left;
44979
+ }
44980
+
44981
+ aryPoint.push({X:x,Y:y});
44982
+ }
44983
+ this.Data.DayChip[i].Vol=totalVol;
44984
+ this.DrawArea(aryPoint,this.Data.DayChip[i].Color);
44985
+ }
44986
+ }
44987
+
44988
+ this.DrawArea=function(aryPoint,color)
44989
+ {
44990
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryPoint)) return;
44991
+
44992
+ this.Canvas.fillStyle=color;
44993
+ this.Canvas.beginPath();
44994
+ if (this.IsHScreen)
44995
+ {
44996
+ this.Canvas.moveTo(aryPoint[0].Y,this.ClientRect.Top);
44997
+ for(var i=0; i<aryPoint.length; ++i)
44998
+ {
44999
+ var item=aryPoint[i];
45000
+ this.Canvas.lineTo(item.Y,item.X);
45001
+ }
45002
+ this.Canvas.lineTo(aryPoint[aryPoint.length-1].Y,this.ClientRect.Top);
45003
+ }
45004
+ else
45005
+ {
45006
+ this.Canvas.moveTo(this.ClientRect.Left,aryPoint[0].Y);
45007
+ for(var i=0; i<aryPoint.length; ++i)
45008
+ {
45009
+ var item=aryPoint[i];
45010
+ this.Canvas.lineTo(item.X,item.Y);
45011
+ }
45012
+ this.Canvas.lineTo(this.ClientRect.Left,aryPoint[aryPoint.length-1].Y);
45013
+ }
44662
45014
 
44663
- var text='获利比例:';
44664
- this.Canvas.fillText(text,left,yText);
44665
- var textWidth=this.Canvas.measureText(text).width+2;
44666
- var barLeft=left+textWidth;
44667
- var barWidth=(right-5-barLeft);
44668
- this.Canvas.strokeStyle=this.ColorNoProfit;
44669
- this.Canvas.strokeRect(barLeft,yText-lineHeight,barWidth,lineHeight);
44670
- this.Canvas.strokeStyle=this.ColorProfit;
44671
- this.Canvas.strokeRect(barLeft,yText-lineHeight,barWidth*(this.Data.ChipInfo.ProfitRate/100),lineHeight);
44672
- text=this.Data.ChipInfo.ProfitRate.toFixed(2)+'%';
44673
- this.Canvas.textAlign='center';
44674
- this.Canvas.fillText(text,barLeft+barWidth/2,yText);
44675
- yText-=lineHeight;
45015
+ this.Canvas.fill();
44676
45016
  }
44677
45017
  }
44678
45018
 
@@ -77206,6 +77546,52 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
77206
77546
  this.Draw();
77207
77547
  }
77208
77548
 
77549
+ //获取筹码图 className=指定筹码类名 否则就查询所有
77550
+ this.GetStockChipChart=function(className)
77551
+ {
77552
+ if (className)
77553
+ return this.GetExtendChartByClassName(className);
77554
+
77555
+ var chart=this.GetExtendChartByClassName('StockChip');
77556
+ if (chart) return chart;
77557
+
77558
+ chart=this.GetExtendChartByClassName("StockChipPhone");
77559
+ return chart;
77560
+ }
77561
+
77562
+ this.DeleteStockChipChart=function()
77563
+ {
77564
+ var stockChip=this.GetStockChipChart();
77565
+ if (!stockChip) return;
77566
+
77567
+ var chipWidth=stockChip.Chart.Width;
77568
+ this.DeleteExtendChart(stockChip);
77569
+ this.Frame.ChartBorder.Right-=chipWidth;
77570
+ if (stockChip.Chart.ClassName=="StockChipPhone")
77571
+ {
77572
+ this.GlobalOption.RightHorizontal.Show=true;
77573
+ this.Frame.ResetXYSplit();
77574
+ }
77575
+ this.SetSizeChange(true);
77576
+ this.Draw();
77577
+ }
77578
+
77579
+ this.CreateStockChipPhone=function(option)
77580
+ {
77581
+ var chart=new StockChipPhone();
77582
+ chart.Canvas=this.Canvas;
77583
+ chart.ChartBorder=this.Frame.ChartBorder;
77584
+ chart.ChartFrame=this.Frame;
77585
+ chart.HQChart=this;
77586
+ chart.Left=this.Frame.ChartBorder.Right; //左边间距使用当前框架间距
77587
+ chart.SetOption(option);
77588
+ this.ExtendChartPaint.push(chart);
77589
+ this.Frame.ChartBorder.Right+=chart.Width; //创建筹码需要增加右边的间距
77590
+ this.GlobalOption.RightHorizontal.Show=false;
77591
+
77592
+ return chart;
77593
+ }
77594
+
77209
77595
  this.CreateExtendChart=function(name, option) //创建扩展图形
77210
77596
  {
77211
77597
  var chart;
@@ -77224,17 +77610,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
77224
77610
  this.Frame.ChartBorder.Right+=chart.Width; //创建筹码需要增加右边的间距
77225
77611
  return chart;
77226
77612
  case "StockChipPhone":
77227
- chart=new StockChipPhone();
77228
- chart.Canvas=this.Canvas;
77229
- chart.ChartBorder=this.Frame.ChartBorder;
77230
- chart.ChartFrame=this.Frame;
77231
- chart.HQChart=this;
77232
- chart.Left=this.Frame.ChartBorder.Right; //左边间距使用当前框架间距
77233
- chart.SetOption(option);
77234
- this.ExtendChartPaint.push(chart);
77235
- this.Frame.ChartBorder.Right+=chart.Width; //创建筹码需要增加右边的间距
77236
- this.GlobalOption.RightHorizontal.Show=false;
77237
- return chart;
77613
+ return this.CreateStockChipPhone(option);
77238
77614
  case 'KLineTooltip':
77239
77615
  if (option.Create && typeof(option.Create)=='function') chart=option.Create();
77240
77616
  else chart=new KLineTooltipPaint();
@@ -78408,7 +78784,9 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
78408
78784
 
78409
78785
  var bBGSpit=false, bShowStockChip=false;
78410
78786
  if (this.GetExtendChartByClassName("SessionBreaksPaint")) bBGSpit=true;
78411
- if (this.GetExtendChartByClassName('StockChip')) bShowStockChip=true; //筹码
78787
+ if (this.GetStockChipChart()) bShowStockChip=true; //筹码
78788
+ var stockChipConfig={Name:'StockChip', ShowType:1, Width:230 };
78789
+ //var stockChipConfig={Name:'StockChipPhone', Width:150 }; //手机版筹码
78412
78790
 
78413
78791
  var bShowCorss=false; //十字光标十字线
78414
78792
  if (this.ChartCorssCursor) bShowCorss=this.ChartCorssCursor.IsShowCorss;
@@ -78583,7 +78961,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
78583
78961
 
78584
78962
  { Name:"画图工具", Data:{ ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID, Args:[]}, Checked:this.IsShowDrawToolDialog() },
78585
78963
 
78586
- { Name:"移动筹码图", Data:{ ID:bShowStockChip?JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:JSCHART_MENU_ID.CMD_SHOW_STOCKCHIP_ID, Args:[]}, Checked:bShowStockChip},
78964
+ { Name:"移动筹码图", Data:{ ID:bShowStockChip?JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:JSCHART_MENU_ID.CMD_SHOW_STOCKCHIP_ID, Args:[stockChipConfig.Name, stockChipConfig]}, Checked:bShowStockChip},
78587
78965
 
78588
78966
  { Name:"十字光标线", Data:{ ID:JSCHART_MENU_ID.CMD_SHOW_CORSS_LINE_ID, Args:[!bShowCorss]}, Checked:bShowCorss },
78589
78967
 
@@ -88066,6 +88444,8 @@ function KLineChartHScreenContainer(uielement)
88066
88444
  frame.ChartBorder=border;
88067
88445
  frame.Identify=i; //窗口序号
88068
88446
  frame.RightSpaceCount=this.RightSpaceCount; //右边
88447
+ frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
88448
+ frame.GlobalOption=this.GlobalOption;
88069
88449
 
88070
88450
  frame.HorizontalMax=20;
88071
88451
  frame.HorizontalMin=10;
@@ -88076,6 +88456,7 @@ function KLineChartHScreenContainer(uielement)
88076
88456
  frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');
88077
88457
  frame.YSplitOperator.FrameSplitData2=this.FrameSplitData.get('double');
88078
88458
  frame.YSplitOperator.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
88459
+ frame.YSplitOperator.HQChart=this;
88079
88460
  //主图上下间距
88080
88461
  var pixelTatio = GetDevicePixelRatio(); //获取设备的分辨率
88081
88462
  border.TopSpace=12*pixelTatio;
@@ -88086,6 +88467,8 @@ function KLineChartHScreenContainer(uielement)
88086
88467
  frame.YSplitOperator=new FrameSplitY();
88087
88468
  frame.YSplitOperator.LanguageID=this.LanguageID;
88088
88469
  frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');
88470
+ frame.YSplitOperator.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
88471
+ frame.YSplitOperator.HQChart=this;
88089
88472
  //frame.IsLocked = true;
88090
88473
  }
88091
88474
 
@@ -88119,6 +88502,39 @@ function KLineChartHScreenContainer(uielement)
88119
88502
  this.Frame.SubFrame[i]=subFrame;
88120
88503
  }
88121
88504
  }
88505
+
88506
+ this.CreateStockChipPhone=function(option)
88507
+ {
88508
+ var chart=new StockChipPhone();
88509
+ chart.Canvas=this.Canvas;
88510
+ chart.ChartBorder=this.Frame.ChartBorder;
88511
+ chart.ChartFrame=this.Frame;
88512
+ chart.HQChart=this;
88513
+ chart.Left=this.Frame.ChartBorder.Bottom; //左边间距使用当前框架间距
88514
+ chart.SetOption(option);
88515
+ this.ExtendChartPaint.push(chart);
88516
+ this.Frame.ChartBorder.Bottom+=chart.Width; //创建筹码需要增加右边的间距
88517
+ this.GlobalOption.RightHorizontal.Show=false;
88518
+
88519
+ return chart;
88520
+ }
88521
+
88522
+ this.DeleteStockChipChart=function()
88523
+ {
88524
+ var stockChip=this.GetStockChipChart();
88525
+ if (!stockChip) return;
88526
+
88527
+ var chipWidth=stockChip.Chart.Width;
88528
+ this.DeleteExtendChart(stockChip);
88529
+ this.Frame.ChartBorder.Bottom-=chipWidth;
88530
+ if (stockChip.Chart.ClassName=="StockChipPhone")
88531
+ {
88532
+ this.GlobalOption.RightHorizontal.Show=true;
88533
+ this.Frame.ResetXYSplit();
88534
+ }
88535
+ this.SetSizeChange(true);
88536
+ this.Draw();
88537
+ }
88122
88538
  }
88123
88539
 
88124
88540