hqchart 1.1.14161 → 1.1.14172

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.
@@ -7008,9 +7008,14 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7008
7008
  {
7009
7009
  IsValueFullRange:false ,
7010
7010
  IsDisplayLatest:false,
7011
- SelectedBorder:{ Mode:0, SelFrame:0 }, //边框选中模式 Mode:0=禁用 1=右侧标记选中 2=指标窗口标记选中
7012
- SelectedXBorder: { Mode:0, Date:null } //X边框选中模式 Mode:0=禁用 分时图图有效
7011
+ SelectedBorder:{ Mode:0, SelFrame:0 }, //边框选中模式 Mode:0=禁用 1=右侧标记选中 2=指标窗口标记选中
7012
+ SelectedXBorder: { Mode:0, Date:null }, //X边框选中模式 Mode:0=禁用 分时图图有效
7013
7013
  //XDateFormat (多日分时图x轴底部日期格式)
7014
+ RightHorizontal:
7015
+ {
7016
+ //Show:true,
7017
+ //Width:5
7018
+ } //右侧框架外部坐标和间距
7014
7019
  };
7015
7020
 
7016
7021
  this.VerticalDrag; //通过X轴左右拖动数据(手势才有)
@@ -15800,6 +15805,23 @@ function AverageWidthFrame()
15800
15805
  }
15801
15806
  }
15802
15807
 
15808
+ this.IsShowRightHorizontal=function()
15809
+ {
15810
+ var borderRight=this.ChartBorder.Right;
15811
+ if (borderRight<=10) return false;
15812
+
15813
+ if (this.YTextPosition[1]==2) return false;
15814
+ if (this.IsShowYText[1]===false) return false;
15815
+
15816
+ if (this.GlobalOption && this.GlobalOption.RightHorizontal)
15817
+ {
15818
+ var item=this.GlobalOption.RightHorizontal;
15819
+ if (item.Show===false) return false;
15820
+ }
15821
+
15822
+ return true;
15823
+ }
15824
+
15803
15825
  //画Y轴
15804
15826
  this.DrawHorizontal=function()
15805
15827
  {
@@ -15816,7 +15838,8 @@ function AverageWidthFrame()
15816
15838
  var borderLeft=this.ChartBorder.Left;
15817
15839
 
15818
15840
  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;
15841
+ //var isDrawRight=borderRight>10 && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
15842
+ var isDrawRight=this.IsShowRightHorizontal();
15820
15843
 
15821
15844
  var rightExtendLine=null; //右侧延长线
15822
15845
  var leftExtendLine=null; //左侧延长线
@@ -17815,7 +17838,8 @@ function AverageWidthFrame()
17815
17838
  var borderRight=this.ChartBorder.Right;
17816
17839
  var borderLeft=this.ChartBorder.Left;
17817
17840
  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;
17841
+ //var isDrawRight=borderRight>10 && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
17842
+ isDrawRight=this.IsShowRightHorizontal();
17819
17843
  }
17820
17844
 
17821
17845
  if (!isDrawRight && !isDrawLeft) return null;
@@ -47713,7 +47737,7 @@ function StockInfoExtendChartPaint()
47713
47737
  this.Canvas.textAlign="left";
47714
47738
  this.Canvas.fillText(this.Name,middle+2,y);
47715
47739
  }
47716
- ;
47740
+
47717
47741
  this.Canvas.strokeStyle=this.BorderColor;
47718
47742
  this.Canvas.moveTo(left,y);
47719
47743
  this.Canvas.lineTo(right,y);
@@ -48494,6 +48518,133 @@ function StockChip()
48494
48518
  }
48495
48519
  }
48496
48520
 
48521
+ //筹码分布手机版
48522
+ function StockChipPhone()
48523
+ {
48524
+ this.newMethod=StockChip; //派生
48525
+ this.newMethod();
48526
+ delete this.newMethod;
48527
+
48528
+ this.Name='筹码分布手机版';
48529
+ this.ClassName='StockChipPhone';
48530
+ this.ShowType=0; //0=所有筹码 手机版只支持0
48531
+
48532
+ this.Draw=function()
48533
+ {
48534
+ this.ShowType=0;
48535
+ this.PixelRatio=GetDevicePixelRatio();
48536
+ var left=ToFixedPoint(this.ChartBorder.GetRight()+this.Left);
48537
+ var top=ToFixedPoint(this.ChartBorder.GetTop());
48538
+ var right=ToFixedPoint(left+this.Width-1*this.PixelRatio);
48539
+ var bottom=ToFixedPoint(this.ChartBorder.GetBottom());
48540
+ var width=right-left;
48541
+ var height=bottom-top;
48542
+ this.ClientRect={Left:left,Top:top,Width:width,Height:height};
48543
+
48544
+ if (ChartData.IsTickPeriod(this.HQChart.Period))
48545
+ {
48546
+
48547
+ }
48548
+ else
48549
+ {
48550
+ if (this.CalculateChip())
48551
+ {
48552
+ this.DrawFrame();
48553
+ this.DrawAllChip();
48554
+
48555
+ this.CalculateCast(); //计算成本
48556
+ this.DrawChipInfo();
48557
+ }
48558
+ }
48559
+
48560
+ this.DrawBorder();
48561
+ this.SizeChange=false;
48562
+ }
48563
+
48564
+ this.DrawToolbar=function(moveonPoint, mouseStatus)
48565
+ {
48566
+
48567
+ }
48568
+
48569
+ this.GetChipInfoTitle=function()
48570
+ {
48571
+ var aryText=[]; //从底部往上
48572
+
48573
+ var item={ Title:"日期:", Text:IFrameSplitOperator.FormatDateString(this.Data.SelectData.Date) };
48574
+ aryText.push(item);
48575
+
48576
+ var item={ Title:"集中度:", Text:"--.--%", };
48577
+ if (IFrameSplitOperator.IsNonEmptyArray(this.Data.Cast)) item.Text=`${this.Data.Cast[0].Rate.toFixed(2)}%`;
48578
+ aryText.push(item);
48579
+
48580
+ var item={ Title:"90%成本:", Text:"--.--", };
48581
+ if (IFrameSplitOperator.IsNonEmptyArray(this.Data.Cast)) item.Text=`${this.Data.Cast[0].MinPrice.toFixed(2)}-${this.Data.Cast[0].MaxPrice.toFixed(2)}`;
48582
+ aryText.push(item);
48583
+
48584
+
48585
+ var item={ Title:"平均成本::", Text:"--.--", };
48586
+ if (this.Data.ChipInfo && IFrameSplitOperator.IsNumber(this.Data.ChipInfo.AveragePrice)) item.Text=`${this.Data.ChipInfo.AveragePrice.toFixed(2)}`;
48587
+
48588
+ if (IFrameSplitOperator.IsNumber(this.Data.YPrice) && IFrameSplitOperator.IsNumber(this.Data.ChipInfo.YProfitRate))
48589
+ {
48590
+ var item={ Title:`${this.Data.YPrice.toFixed(2)}获利:`, Text:`${this.Data.ChipInfo.YProfitRate.toFixed(2)}%` };
48591
+ aryText.push(item);
48592
+ }
48593
+
48594
+ return aryText;
48595
+ }
48596
+
48597
+ this.DrawChipInfo=function()
48598
+ {
48599
+ var aryText=this.GetChipInfoTitle();
48600
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryText)) return;
48601
+
48602
+ var bottom=this.ClientRect.Top+this.ClientRect.Height-1;
48603
+ var left=this.ClientRect.Left+2;
48604
+ var right=this.ClientRect.Left+this.ClientRect.Width;
48605
+
48606
+ this.Canvas.font=this.Font;
48607
+ this.Canvas.fillStyle=this.InfoColor;
48608
+ this.Canvas.textBaseline='bottom';
48609
+ this.Canvas.textAlign='left';
48610
+
48611
+ var lineHeight=this.LineHeight*GetDevicePixelRatio();
48612
+ var yText=bottom;
48613
+ for(var i=0;i<aryText.length;++i)
48614
+ {
48615
+ var item=aryText[i];
48616
+
48617
+ var textColor=item.TitleColor;
48618
+ if (item.TitleColor) textColor=item.TitleColor;
48619
+ this.Canvas.fillStyle=textColor;
48620
+ this.Canvas.fillText(item.Title,left,yText);
48621
+ var textWidth=this.Canvas.measureText(item.Title).width+4;
48622
+ var xText=left+textWidth;
48623
+
48624
+ var textColor=item.TitleColor;
48625
+ if (item.TextColor) textColor=item.TextColor;
48626
+ this.Canvas.fillStyle=textColor;
48627
+ this.Canvas.fillText(item.Text,xText,yText);
48628
+
48629
+ yText-=lineHeight;
48630
+ }
48631
+
48632
+ var text='获利比例:';
48633
+ this.Canvas.fillText(text,left,yText);
48634
+ var textWidth=this.Canvas.measureText(text).width+2;
48635
+ var barLeft=left+textWidth;
48636
+ var barWidth=(right-5-barLeft);
48637
+ this.Canvas.strokeStyle=this.ColorNoProfit;
48638
+ this.Canvas.strokeRect(barLeft,yText-lineHeight,barWidth,lineHeight);
48639
+ this.Canvas.strokeStyle=this.ColorProfit;
48640
+ this.Canvas.strokeRect(barLeft,yText-lineHeight,barWidth*(this.Data.ChipInfo.ProfitRate/100),lineHeight);
48641
+ text=this.Data.ChipInfo.ProfitRate.toFixed(2)+'%';
48642
+ this.Canvas.textAlign='center';
48643
+ this.Canvas.fillText(text,barLeft+barWidth/2,yText);
48644
+ yText-=lineHeight;
48645
+ }
48646
+ }
48647
+
48497
48648
  //窗口分割
48498
48649
  function FrameSplitPaint()
48499
48650
  {
@@ -81030,6 +81181,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
81030
81181
  switch(name)
81031
81182
  {
81032
81183
  case '筹码分布':
81184
+ case "StockChip":
81033
81185
  chart=new StockChip();
81034
81186
  chart.Canvas=this.Canvas;
81035
81187
  chart.ChartBorder=this.Frame.ChartBorder;
@@ -81040,6 +81192,18 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
81040
81192
  this.ExtendChartPaint.push(chart);
81041
81193
  this.Frame.ChartBorder.Right+=chart.Width; //创建筹码需要增加右边的间距
81042
81194
  return chart;
81195
+ case "StockChipPhone":
81196
+ chart=new StockChipPhone();
81197
+ chart.Canvas=this.Canvas;
81198
+ chart.ChartBorder=this.Frame.ChartBorder;
81199
+ chart.ChartFrame=this.Frame;
81200
+ chart.HQChart=this;
81201
+ chart.Left=this.Frame.ChartBorder.Right; //左边间距使用当前框架间距
81202
+ chart.SetOption(option);
81203
+ this.ExtendChartPaint.push(chart);
81204
+ this.Frame.ChartBorder.Right+=chart.Width; //创建筹码需要增加右边的间距
81205
+ this.GlobalOption.RightHorizontal.Show=false;
81206
+ return chart;
81043
81207
  case 'KLineTooltip':
81044
81208
  if (option.Create && typeof(option.Create)=='function') chart=option.Create();
81045
81209
  else chart=new KLineTooltipPaint();
@@ -129126,6 +129290,8 @@ function JSReportChartContainer(uielement)
129126
129290
  //去掉右键菜单
129127
129291
  this.UIOnContextMenu=function(e)
129128
129292
  {
129293
+ e.preventDefault();
129294
+
129129
129295
  if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
129130
129296
 
129131
129297
  if (!this.IsShowRightMenu) return;
@@ -129138,7 +129304,7 @@ function JSReportChartContainer(uielement)
129138
129304
 
129139
129305
  this.OnRightMenu=function(x,y,e)
129140
129306
  {
129141
- e.preventDefault();
129307
+
129142
129308
  }
129143
129309
 
129144
129310
  this.UIOnMouseMove=function(e)
@@ -136706,10 +136872,11 @@ function JSTReportChartContainer(uielement)
136706
136872
  this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e);}
136707
136873
  this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
136708
136874
  this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
136875
+ this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
136709
136876
 
136710
136877
  /*
136711
136878
  this.UIElement.onmouseup=(e)=>{ this.UIOnMounseUp(e); }
136712
- this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
136879
+
136713
136880
 
136714
136881
 
136715
136882
  //手机拖拽
@@ -137161,6 +137328,7 @@ function JSTReportChartContainer(uielement)
137161
137328
 
137162
137329
  if (item[32]) stock.CloseLine=item[32]; //32=收盘价线
137163
137330
  if (item[33]) stock.KLine=item[33]; //33=K线
137331
+ if (item[34]) stock.ExePrice=item[34]; //34=行权价设置 { BGColor:背景色, Text:, TextColor }
137164
137332
 
137165
137333
  //10个数值型 101-199
137166
137334
  if (IFrameSplitOperator.IsNumber(item[101])) stock.ReserveNumber1=item[101];
@@ -137358,6 +137526,21 @@ function JSTReportChartContainer(uielement)
137358
137526
  this.HideMinuteChartTooltip();
137359
137527
  }
137360
137528
 
137529
+ this.UIOnContextMenu=function(e)
137530
+ {
137531
+ e.preventDefault();
137532
+
137533
+ var x = e.clientX-this.UIElement.getBoundingClientRect().left;
137534
+ var y = e.clientY-this.UIElement.getBoundingClientRect().top;
137535
+
137536
+ this.OnRightMenu(x,y,e); //右键菜单事件
137537
+ }
137538
+
137539
+ this.OnRightMenu=function(x,y,e)
137540
+ {
137541
+
137542
+ }
137543
+
137361
137544
  //点表头
137362
137545
  this.OnClickHeader=function(clickData, e)
137363
137546
  {
@@ -137970,6 +138153,8 @@ var TREPORT_COLUMN_ID=
137970
138153
  NAME_EX_ID:27, //扩展名字
137971
138154
  CLOSE_LINE_ID:28, //收盘价线
137972
138155
  KLINE_ID:29, //K线
138156
+
138157
+ EXE_PRICE_EX_ID:30, //行权价格 扩张设置
137973
138158
 
137974
138159
  //预留数值类型 10个 201-299
137975
138160
  RESERVE_NUMBER1_ID:201, //ReserveNumber1:
@@ -138016,6 +138201,7 @@ var MAP_TREPORT_COLUMN_FIELD=new Map(
138016
138201
  [TREPORT_COLUMN_ID.AVERAGE_PRICE_ID,"AvPrice"],
138017
138202
  [TREPORT_COLUMN_ID.POSITION_ID,"Position"],
138018
138203
  [TREPORT_COLUMN_ID.AMPLITUDE_ID,"Amplitude"],
138204
+ [TREPORT_COLUMN_ID.EXE_PRICE_EX_ID, "ExePrice"],
138019
138205
 
138020
138206
  [TREPORT_COLUMN_ID.RESERVE_NUMBER1_ID,"ReserveNumber1"],
138021
138207
  [TREPORT_COLUMN_ID.RESERVE_NUMBER2_ID,"ReserveNumber2"],
@@ -138698,6 +138884,55 @@ function ChartTReport()
138698
138884
  }
138699
138885
  }
138700
138886
 
138887
+ this.FormatCenterItem=function(data,drawInfo)
138888
+ {
138889
+ if (!data || !data.TData) return;
138890
+ var leftData=this.GetExePriceExtendData(data.TData.LeftData);
138891
+ var rightData=this.GetExePriceExtendData(data.TData.RightData);
138892
+
138893
+ if (leftData)
138894
+ {
138895
+ if (leftData.BGColor) drawInfo.BGColor=leftData.BGColor;
138896
+ if (leftData.TitleColor) drawInfo.TextColor=leftData.TitleColor;
138897
+ if (leftData.Text && leftData.TextColor)
138898
+ {
138899
+ drawInfo.Left={ Text:leftData.Text, TextColor:leftData.TextColor};
138900
+ }
138901
+ else if (leftData.IconFont && leftData.TextColor)
138902
+ {
138903
+ drawInfo.Left={ IconFont:leftData.IconFont, TextColor:leftData.TextColor};
138904
+ }
138905
+
138906
+ }
138907
+
138908
+ if (rightData)
138909
+ {
138910
+ if (rightData.BGColor) drawInfo.BGColor=rightData.BGColor;
138911
+ if (rightData.TitleColor) drawInfo.TextColor=rightData.TitleColor;
138912
+
138913
+ if (rightData.Text && rightData.TextColor)
138914
+ {
138915
+ drawInfo.Right={ Text:rightData.Text, TextColor:rightData.TextColor};
138916
+ }
138917
+ else if (rightData.IconFont && rightData.TextColor)
138918
+ {
138919
+ drawInfo.Right={ IconFont:rightData.IconFont, TextColor:rightData.TextColor};
138920
+ }
138921
+ }
138922
+ }
138923
+
138924
+ //行权价列扩展信息
138925
+ this.GetExePriceExtendData=function(data)
138926
+ {
138927
+ if (!data) return null;
138928
+
138929
+ var fieldName=MAP_TREPORT_COLUMN_FIELD.get(TREPORT_COLUMN_ID.EXE_PRICE_EX_ID);
138930
+ if (!fieldName) return null;
138931
+
138932
+ var value=data[fieldName];
138933
+ return value;
138934
+ }
138935
+
138701
138936
  this.DrawCenterItem=function(index, data, column, rtItem, cellType) //cellType 0=中间字段 1=左侧 2=右侧
138702
138937
  {
138703
138938
  //tooltip提示
@@ -138710,6 +138945,10 @@ function ChartTReport()
138710
138945
  var drawInfo={ Text:null, TextColor:this.CenterItemConfig.TextColor, BGColor:this.CenterItemConfig.BGColor, TextAlign:column.TextAlign, Rect:rtItem, RectText:rtText };
138711
138946
  drawInfo.Text=`${data.ExePrice.toFixed(data.Decimal)}`;
138712
138947
 
138948
+ this.FormatCenterItem(data,drawInfo);
138949
+
138950
+
138951
+
138713
138952
  this.DrawCell(drawInfo);
138714
138953
  }
138715
138954
 
@@ -138951,7 +139190,7 @@ function ChartTReport()
138951
139190
  {
138952
139191
  var rtText=drawInfo.RectText;
138953
139192
  var yCenter=rtText.Top+(rtText.Height/2);
138954
-
139193
+ var fontBackup=null; //字体备份
138955
139194
  if (drawInfo.BGColor) //背景
138956
139195
  {
138957
139196
  var rtItem=drawInfo.Rect;
@@ -138978,6 +139217,44 @@ function ChartTReport()
138978
139217
  if(drawInfo.TextColor) this.Canvas.fillStyle=drawInfo.TextColor;
138979
139218
  this.DrawText(drawInfo.Text, drawInfo.TextAlign, rtText.Left, yCenter, rtText.Width);
138980
139219
  }
139220
+
139221
+ if (drawInfo.Left)
139222
+ {
139223
+ var item=drawInfo.Left;
139224
+ this.Canvas.textAlign="left";
139225
+ this.Canvas.textBaseline="middle";
139226
+ this.Canvas.fillStyle=item.TextColor;
139227
+ if (item.IconFont)
139228
+ {
139229
+ if (!fontBackup) fontBackup=this.Canvas.font;
139230
+ this.Canvas.font=item.IconFont.Font;
139231
+ this.Canvas.fillText(item.IconFont.Symbol,rtText.Left,yCenter);
139232
+ }
139233
+ else if (item.Text)
139234
+ {
139235
+ this.Canvas.fillText(item.Text,rtText.Left,yCenter);
139236
+ }
139237
+ }
139238
+
139239
+ if (drawInfo.Right)
139240
+ {
139241
+ var item=drawInfo.Right;
139242
+ this.Canvas.textAlign="right";
139243
+ this.Canvas.textBaseline="middle";
139244
+ this.Canvas.fillStyle=item.TextColor;
139245
+ if (item.IconFont)
139246
+ {
139247
+ if (!fontBackup) fontBackup=this.Canvas.font;
139248
+ this.Canvas.font=item.IconFont.Font;
139249
+ this.Canvas.fillText(item.IconFont.Symbol,rtText.Right,yCenter);
139250
+ }
139251
+ else if (item.Text)
139252
+ {
139253
+ this.Canvas.fillText(item.Text,rtText.Right,yCenter);
139254
+ }
139255
+ }
139256
+
139257
+ if (fontBackup) this.Canvas.font=fontBackup;
138981
139258
  }
138982
139259
 
138983
139260
  this.GetTooltipData=function(x,y)
@@ -149023,7 +149300,7 @@ function HQChartScriptWorker()
149023
149300
 
149024
149301
 
149025
149302
 
149026
- var HQCHART_VERSION="1.1.14160";
149303
+ var HQCHART_VERSION="1.1.14171";
149027
149304
 
149028
149305
  function PrintHQChartVersion()
149029
149306
  {