hqchart 1.1.13135 → 1.1.13140
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.
|
@@ -10806,13 +10806,18 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
10806
10806
|
{
|
|
10807
10807
|
ID:key, Frame:frame, ChartPaint:[] , Max:null, Min:null,
|
|
10808
10808
|
OverlayFrame:[], //共享坐标
|
|
10809
|
-
SingleOverlay:[]
|
|
10809
|
+
SingleOverlay:[], //独立坐标
|
|
10810
|
+
MainOverlayFrame:[null, null], //叠加坐标在主坐标显示[0]=left [1]=right
|
|
10810
10811
|
};
|
|
10811
10812
|
|
|
10812
10813
|
for(var j=0;j<subItem.OverlayIndex.length;++j)
|
|
10813
10814
|
{
|
|
10814
10815
|
var overlayItem=subItem.OverlayIndex[j];
|
|
10815
10816
|
var overlayFrame=overlayItem.Frame;
|
|
10817
|
+
|
|
10818
|
+
if (overlayFrame.IsShowMainFrame===1) item.MainOverlayFrame[0]= overlayFrame;
|
|
10819
|
+
else if (overlayFrame.IsShowMainFrame===2) item.MainOverlayFrame[1]= overlayFrame;
|
|
10820
|
+
|
|
10816
10821
|
if (overlayFrame.IsShareY)
|
|
10817
10822
|
{
|
|
10818
10823
|
if (!overlayFrame.MainFrame) continue;
|
|
@@ -10828,7 +10833,6 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
10828
10833
|
{
|
|
10829
10834
|
item.SingleOverlay.push(overlayItem);
|
|
10830
10835
|
}
|
|
10831
|
-
|
|
10832
10836
|
}
|
|
10833
10837
|
|
|
10834
10838
|
mapFrame.set(key, item);
|
|
@@ -10913,6 +10917,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
10913
10917
|
item.OverlayFrame[j].XYSplit=true;
|
|
10914
10918
|
}
|
|
10915
10919
|
|
|
10920
|
+
//叠加坐标显示在主图坐标 需要同步
|
|
10921
|
+
for(var i=0;i<item.MainOverlayFrame.length;++i)
|
|
10922
|
+
{
|
|
10923
|
+
var subItem=item.MainOverlayFrame[i];
|
|
10924
|
+
if (subItem) subItem.XYSplit=true;
|
|
10925
|
+
}
|
|
10926
|
+
|
|
10916
10927
|
//独立坐标叠加指标
|
|
10917
10928
|
for(var i=0;i<item.SingleOverlay.length;++i)
|
|
10918
10929
|
{
|
|
@@ -13895,6 +13906,8 @@ function AverageWidthFrame()
|
|
|
13895
13906
|
this.XTextExtend; //[0]=底部 { Align:0=默认(居中), 1=左对齐 }
|
|
13896
13907
|
this.XLineExtend; //[0]=底部 { Mode:1, Color: } Mode=1 分割线 Mode=2短线
|
|
13897
13908
|
|
|
13909
|
+
this.FrameData={ SubFrameItem:null }; //窗口框架信息
|
|
13910
|
+
|
|
13898
13911
|
//画图工具刻度
|
|
13899
13912
|
|
|
13900
13913
|
this.DrawPicture={
|
|
@@ -15844,6 +15857,25 @@ function AverageWidthFrame()
|
|
|
15844
15857
|
|
|
15845
15858
|
if (divToolbar.style.display!='none') divToolbar.style.display='none';
|
|
15846
15859
|
}
|
|
15860
|
+
|
|
15861
|
+
this.GetMainOverlayFrame=function()
|
|
15862
|
+
{
|
|
15863
|
+
if (!this.FrameData || !this.FrameData.SubFrameItem) return null;
|
|
15864
|
+
|
|
15865
|
+
var subFrame=this.FrameData.SubFrameItem;
|
|
15866
|
+
var leftFrame=null, rightFrame=null;
|
|
15867
|
+
for(var i=0;i<subFrame.OverlayIndex.length;++i)
|
|
15868
|
+
{
|
|
15869
|
+
var item=subFrame.OverlayIndex[i];
|
|
15870
|
+
var overlayFrame=item.Frame;
|
|
15871
|
+
if (overlayFrame.IsShowMainFrame==2) rightFrame=overlayFrame;
|
|
15872
|
+
else if (overlayFrame.IsShowMainFrame==1) leftFrame=overlayFrame;
|
|
15873
|
+
}
|
|
15874
|
+
|
|
15875
|
+
if (!leftFrame && !rightFrame) return null;
|
|
15876
|
+
|
|
15877
|
+
return [leftFrame, rightFrame];
|
|
15878
|
+
}
|
|
15847
15879
|
}
|
|
15848
15880
|
|
|
15849
15881
|
function MinuteFrame()
|
|
@@ -17953,7 +17985,7 @@ function OverlayMinuteFrame()
|
|
|
17953
17985
|
this.HorizontalMax=this.MainFrame.HorizontalMax;
|
|
17954
17986
|
this.HorizontalMin=this.MainFrame.HorizontalMin;
|
|
17955
17987
|
this.HorizontalInfo=[];
|
|
17956
|
-
for(var i
|
|
17988
|
+
for(var i=0; i<this.MainFrame.HorizontalInfo.length; ++i)
|
|
17957
17989
|
{
|
|
17958
17990
|
var item=this.MainFrame.HorizontalInfo[i];
|
|
17959
17991
|
this.HorizontalInfo.push(item);
|
|
@@ -17963,7 +17995,7 @@ function OverlayMinuteFrame()
|
|
|
17963
17995
|
{
|
|
17964
17996
|
if (this.YSplitOperator!=null) this.YSplitOperator.Operator();
|
|
17965
17997
|
}
|
|
17966
|
-
|
|
17998
|
+
|
|
17967
17999
|
// if (this.XSplitOperator!=null) this.XSplitOperator.Operator(); 子坐标和主坐标X轴一致 所以不用计算
|
|
17968
18000
|
}
|
|
17969
18001
|
}
|
|
@@ -19297,6 +19329,7 @@ function OverlayKLineFrame()
|
|
|
19297
19329
|
|
|
19298
19330
|
this.MainFrame=null; //主框架
|
|
19299
19331
|
this.IsShareY=false; //使用和主框架公用Y轴
|
|
19332
|
+
this.IsShowMainFrame=0; //是否显示在主框架坐标上 1=左边 2=右边
|
|
19300
19333
|
this.IsCalculateYMaxMin=true; //是否计算Y最大最小值
|
|
19301
19334
|
this.RightOffset=50;
|
|
19302
19335
|
this.PenBorder=g_JSChartResource.OverlayFrame.BolderPen; //'rgb(0,0,0)'
|
|
@@ -19507,8 +19540,6 @@ function OverlayKLineFrame()
|
|
|
19507
19540
|
{
|
|
19508
19541
|
if (this.YSplitOperator!=null) this.YSplitOperator.Operator();
|
|
19509
19542
|
}
|
|
19510
|
-
|
|
19511
|
-
// if (this.XSplitOperator!=null) this.XSplitOperator.Operator(); 子坐标和主坐标X轴一致 所以不用计算
|
|
19512
19543
|
}
|
|
19513
19544
|
|
|
19514
19545
|
//画Y轴
|
|
@@ -26530,6 +26561,14 @@ function ChartKLine()
|
|
|
26530
26561
|
this.IsThinAKBar=true; //美国线 柱子是否是线段 (false=柱子)
|
|
26531
26562
|
|
|
26532
26563
|
this.HighLowBarColor=g_JSChartResource.HighLowBarColor;
|
|
26564
|
+
this.HighLowTextConfig=
|
|
26565
|
+
{
|
|
26566
|
+
FontName:g_JSChartResource.HighLowText.FontName,
|
|
26567
|
+
MaxSize:g_JSChartResource.HighLowText.MaxSize,
|
|
26568
|
+
MinSize:g_JSChartResource.HighLowText.MinSize,
|
|
26569
|
+
Color:g_JSChartResource.HighLowText.Color, //未用
|
|
26570
|
+
MaxText:g_JSChartResource.HighLowText.MaxText
|
|
26571
|
+
};
|
|
26533
26572
|
|
|
26534
26573
|
this.HLCAreaConfig=
|
|
26535
26574
|
{
|
|
@@ -28980,6 +29019,12 @@ function ChartKLine()
|
|
|
28980
29019
|
var top=this.ChartBorder.GetTopEx();
|
|
28981
29020
|
var bottom=this.ChartBorder.GetBottomEx();
|
|
28982
29021
|
if (this.ChartBorder.BottomSpace>0) bottom+=1;
|
|
29022
|
+
|
|
29023
|
+
if (this.DrawType==13) //需要显示文字,裁剪要大点
|
|
29024
|
+
{
|
|
29025
|
+
top=this.ChartBorder.GetTopTitle();
|
|
29026
|
+
bottom=this.ChartBorder.GetBottom();
|
|
29027
|
+
}
|
|
28983
29028
|
}
|
|
28984
29029
|
|
|
28985
29030
|
this.Canvas.beginPath();
|
|
@@ -30803,6 +30848,15 @@ function ChartKLine()
|
|
|
30803
30848
|
|
|
30804
30849
|
this.Canvas.fillStyle=this.HighLowBarColor;
|
|
30805
30850
|
this.Canvas.strokeStyle=this.HighLowBarColor;
|
|
30851
|
+
var defaultfloatPrecision=GetfloatPrecision(this.Symbol);
|
|
30852
|
+
var font=this.GetHighLowTextFont(dataWidth,distanceWidth);
|
|
30853
|
+
var bShowText=false;
|
|
30854
|
+
if (font)
|
|
30855
|
+
{
|
|
30856
|
+
bShowText=true;
|
|
30857
|
+
this.Canvas.font=font;
|
|
30858
|
+
}
|
|
30859
|
+
|
|
30806
30860
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth),++this.ShowRange.DataCount)
|
|
30807
30861
|
{
|
|
30808
30862
|
var data=this.Data.Data[i];
|
|
@@ -30829,6 +30883,7 @@ function ChartKLine()
|
|
|
30829
30883
|
else
|
|
30830
30884
|
{
|
|
30831
30885
|
this.Canvas.fillRect(ToFixedRect(left),ToFixedRect(yBarTop),ToFixedRect(dataWidth),ToFixedRect(barHeight));
|
|
30886
|
+
if (bShowText) this.DrawHighLowText(yHigh, yLow, x, data, defaultfloatPrecision);
|
|
30832
30887
|
//TODO:文字输出
|
|
30833
30888
|
}
|
|
30834
30889
|
}
|
|
@@ -30868,6 +30923,38 @@ function ChartKLine()
|
|
|
30868
30923
|
}
|
|
30869
30924
|
}
|
|
30870
30925
|
|
|
30926
|
+
this.DrawHighLowText=function(yHigh, yLow, x, kItem, floatPrecision)
|
|
30927
|
+
{
|
|
30928
|
+
this.Canvas.textAlign="center";
|
|
30929
|
+
|
|
30930
|
+
var text=kItem.High.toFixed(floatPrecision);
|
|
30931
|
+
this.Canvas.textBaseline="bottom";
|
|
30932
|
+
this.Canvas.fillText(text,x,yHigh-2);
|
|
30933
|
+
|
|
30934
|
+
var text=kItem.Low.toFixed(floatPrecision);
|
|
30935
|
+
this.Canvas.textBaseline="top";
|
|
30936
|
+
this.Canvas.fillText(text,x,yLow+3);
|
|
30937
|
+
}
|
|
30938
|
+
|
|
30939
|
+
this.GetHighLowTextFont=function(dataWidth, distanceWidth)
|
|
30940
|
+
{
|
|
30941
|
+
var barWidth=dataWidth+distanceWidth;
|
|
30942
|
+
var text=this.HighLowTextConfig.MaxText;
|
|
30943
|
+
var min=Math.min(this.HighLowTextConfig.MaxSize,this.HighLowTextConfig.MinSize);
|
|
30944
|
+
var max=Math.max(this.HighLowTextConfig.MaxSize,this.HighLowTextConfig.MinSize);
|
|
30945
|
+
|
|
30946
|
+
for(var i=max; i>=min; --i)
|
|
30947
|
+
{
|
|
30948
|
+
var font=`${i*GetDevicePixelRatio()}px ${this.HighLowTextConfig.FontName}`;
|
|
30949
|
+
this.Canvas.font=font;
|
|
30950
|
+
var textWidth=this.Canvas.measureText(text).width;
|
|
30951
|
+
if (textWidth<=barWidth)
|
|
30952
|
+
return font;
|
|
30953
|
+
}
|
|
30954
|
+
|
|
30955
|
+
return null;
|
|
30956
|
+
}
|
|
30957
|
+
|
|
30871
30958
|
//////////////////////////////////////////////////////////////
|
|
30872
30959
|
//标识缺口
|
|
30873
30960
|
//
|
|
@@ -49633,6 +49720,7 @@ function FrameSplitY()
|
|
|
49633
49720
|
if (this.SplitType!=1) this.Frame.HorizontalInfo = this.Filter(this.Frame.HorizontalInfo,(splitData.Max>0 && splitData.Min<0));
|
|
49634
49721
|
|
|
49635
49722
|
this.RightFrameSplitY();
|
|
49723
|
+
this.MainOverlayFrameSplitY(); //主图Y轴绑定叠加Y轴坐标
|
|
49636
49724
|
this.CallAcutionSplitY(this.SplitCount,splitData);
|
|
49637
49725
|
|
|
49638
49726
|
if (this.EnableRemoveZero) this.RemoveZero(this.Frame.HorizontalInfo);
|
|
@@ -49853,6 +49941,41 @@ function FrameSplitY()
|
|
|
49853
49941
|
}
|
|
49854
49942
|
}
|
|
49855
49943
|
|
|
49944
|
+
this.MainOverlayFrameSplitY=function()
|
|
49945
|
+
{
|
|
49946
|
+
if (!this.Frame.GetMainOverlayFrame) return;
|
|
49947
|
+
var aryOverlayFrame=this.Frame.GetMainOverlayFrame();
|
|
49948
|
+
if (!aryOverlayFrame ) return;
|
|
49949
|
+
|
|
49950
|
+
if (aryOverlayFrame[1])
|
|
49951
|
+
{
|
|
49952
|
+
var rightFrame=aryOverlayFrame[1];
|
|
49953
|
+
if (rightFrame.YSplitOperator) rightFrame.YSplitOperator.Operator();
|
|
49954
|
+
|
|
49955
|
+
for(var i=0;i<this.Frame.HorizontalInfo.length;++i)
|
|
49956
|
+
{
|
|
49957
|
+
var item=this.Frame.HorizontalInfo[i];
|
|
49958
|
+
var y=this.Frame.GetYFromData(item.Value);
|
|
49959
|
+
var yValue=rightFrame.GetYData(y);
|
|
49960
|
+
item.Message[1] = IFrameSplitOperator.FormatValueString(yValue, this.FloatPrecision,this.LanguageID);
|
|
49961
|
+
}
|
|
49962
|
+
}
|
|
49963
|
+
|
|
49964
|
+
if (aryOverlayFrame[0])
|
|
49965
|
+
{
|
|
49966
|
+
var leftFrame=aryOverlayFrame[0];
|
|
49967
|
+
if (leftFrame.YSplitOperator) leftFrame.YSplitOperator.Operator();
|
|
49968
|
+
|
|
49969
|
+
for(var i=0;i<this.Frame.HorizontalInfo.length;++i)
|
|
49970
|
+
{
|
|
49971
|
+
var item=this.Frame.HorizontalInfo[i];
|
|
49972
|
+
var y=this.Frame.GetYFromData(item.Value);
|
|
49973
|
+
var yValue=leftFrame.GetYData(y);
|
|
49974
|
+
item.Message[0] = IFrameSplitOperator.FormatValueString(yValue, this.FloatPrecision,this.LanguageID);
|
|
49975
|
+
}
|
|
49976
|
+
}
|
|
49977
|
+
}
|
|
49978
|
+
|
|
49856
49979
|
this.CustomCoordinate=function()
|
|
49857
49980
|
{
|
|
49858
49981
|
this.Frame.CustomHorizontalInfo=[];
|
|
@@ -67012,6 +67135,7 @@ function JSChartResource()
|
|
|
67012
67135
|
this.UnchagneBarColor="rgb(0,0,0)"; //平盘柱子颜色
|
|
67013
67136
|
this.EmptyBarBGColor="rgb(255,255,255)"; //空心柱子背景色
|
|
67014
67137
|
this.HighLowBarColor='rgb(41,98,255)'; //high low bar 颜色
|
|
67138
|
+
this.HighLowText={ FontName:"arial", MaxSize:30, MinSize:4, Color:"rgb(41,98,255)", MaxText:"9999.9" };
|
|
67015
67139
|
|
|
67016
67140
|
this.SplashScreen=
|
|
67017
67141
|
{
|
|
@@ -68182,6 +68306,16 @@ function JSChartResource()
|
|
|
68182
68306
|
if (style.UnchagneBarColor) this.UnchagneBarColor = style.UnchagneBarColor;
|
|
68183
68307
|
if (style.EmptyBarBGColor) this.EmptyBarBGColor=style.EmptyBarBGColor;
|
|
68184
68308
|
if (style.HighLowBarColor) this.HighLowBarColor=style.HighLowBarColor;
|
|
68309
|
+
if (style.HighLowText)
|
|
68310
|
+
{
|
|
68311
|
+
var dest=this.HighLowText;
|
|
68312
|
+
var item=style.HighLowText;
|
|
68313
|
+
if (item.FontName) dest.FontName=item.FontName;
|
|
68314
|
+
if (item.Color) dest.Color=item.Color;
|
|
68315
|
+
if (item.MaxText) dest.MaxText=item.MaxText;
|
|
68316
|
+
if (IFrameSplitOperator.IsPlusNumber(item.MaxSize)) dest.MaxSize=item.MaxSize;
|
|
68317
|
+
if (IFrameSplitOperator.IsPlusNumber(item.MinSize)) dest.MinSize=item.MinSize;
|
|
68318
|
+
}
|
|
68185
68319
|
|
|
68186
68320
|
if (style.SplashScreen)
|
|
68187
68321
|
{
|
|
@@ -69352,7 +69486,7 @@ function KLineCustomCalulate()
|
|
|
69352
69486
|
["RenkoCalculate", { Create:function() { return new RenkoCalculate(); } }],
|
|
69353
69487
|
["HeikinAshiCalculate", { Create:function() { return new HeikinAshiCalculate(); } }],
|
|
69354
69488
|
["LineBreakCalcuate", { Create:function() { return new LineBreakCalcuate(); } }],
|
|
69355
|
-
["KagiCalculate", { Create:function(){ return new
|
|
69489
|
+
["KagiCalculate", { Create:function(){ return new KagiCalculate(); } }]
|
|
69356
69490
|
]
|
|
69357
69491
|
);
|
|
69358
69492
|
|
|
@@ -69535,7 +69669,38 @@ function RenkoCalculate()
|
|
|
69535
69669
|
//
|
|
69536
69670
|
function KagiCalculate()
|
|
69537
69671
|
{
|
|
69672
|
+
this.Symbol;
|
|
69673
|
+
this.SourceData;
|
|
69674
|
+
this.FloatPrecision=2; //品种小数位数
|
|
69675
|
+
this.ATR={ Count:14 }; //使用ATR计算砖块大小
|
|
69538
69676
|
|
|
69677
|
+
this.RecvHistoryData=function(sourceData, option) //历史日线数据
|
|
69678
|
+
{
|
|
69679
|
+
this.Symbol=option.Symbol;
|
|
69680
|
+
this.SourceData=sourceData;
|
|
69681
|
+
this.FloatPrecision=GetfloatPrecision(this.Symbol);
|
|
69682
|
+
return this.Calculate(sourceData);
|
|
69683
|
+
}
|
|
69684
|
+
|
|
69685
|
+
this.Calculate=function(sourceData)
|
|
69686
|
+
{
|
|
69687
|
+
var bindData=new ChartData();
|
|
69688
|
+
bindData.Data=[]
|
|
69689
|
+
bindData.Right=sourceData.Right;
|
|
69690
|
+
bindData.Period=sourceData.Period;
|
|
69691
|
+
bindData.DataType=sourceData.DataType;
|
|
69692
|
+
bindData.Symbol=sourceData.symbol;
|
|
69693
|
+
|
|
69694
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(sourceData.Data)) return bindData;
|
|
69695
|
+
|
|
69696
|
+
var periodCount=this.ATR.Count;
|
|
69697
|
+
|
|
69698
|
+
var kItem=sourceData.Data[0];
|
|
69699
|
+
this.LastData=HistoryData.Copy(kItem);
|
|
69700
|
+
for(var i=1; i<sourceData.Data.length; )
|
|
69701
|
+
{
|
|
69702
|
+
}
|
|
69703
|
+
}
|
|
69539
69704
|
}
|
|
69540
69705
|
|
|
69541
69706
|
//////////////////////////////////////////////////////////////////
|
|
@@ -70915,6 +71080,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
70915
71080
|
}
|
|
70916
71081
|
|
|
70917
71082
|
var subFrame=new SubFrameItem();
|
|
71083
|
+
frame.FrameData.SubFrameItem=subFrame;
|
|
70918
71084
|
subFrame.Frame=frame;
|
|
70919
71085
|
if (i==0)
|
|
70920
71086
|
subFrame.Height=20;
|
|
@@ -70981,6 +71147,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
70981
71147
|
}
|
|
70982
71148
|
|
|
70983
71149
|
var subFrame=new SubFrameItem();
|
|
71150
|
+
frame.FrameData.SubFrameItem=subFrame;
|
|
70984
71151
|
subFrame.Frame=frame;
|
|
70985
71152
|
subFrame.Height=10;
|
|
70986
71153
|
|
|
@@ -73500,6 +73667,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
73500
73667
|
else if (obj.ShowRightText===false) frame.IsShow=false;
|
|
73501
73668
|
if (IFrameSplitOperator.IsBool(obj.ShowToolbar)) frame.IsShowToolbar=obj.ShowToolbar; //废弃
|
|
73502
73669
|
if (IFrameSplitOperator.IsBool(obj.IsShareY)) frame.IsShareY=obj.IsShareY;
|
|
73670
|
+
if (IFrameSplitOperator.IsNumber(obj.IsShowMainFrame)) frame.IsShowMainFrame=obj.IsShowMainFrame;
|
|
73503
73671
|
//if (IFrameSplitOperator.IsBool(obj.IsShowIndexTitle)) frame.IsShowIndexTitle=obj.IsShowIndexTitle;
|
|
73504
73672
|
if (IFrameSplitOperator.IsBool(obj.IsCalculateYMaxMin)) frame.IsCalculateYMaxMin=obj.IsCalculateYMaxMin; //是否计算Y最大最小值
|
|
73505
73673
|
|
|
@@ -134152,7 +134320,7 @@ function HQChartScriptWorker()
|
|
|
134152
134320
|
|
|
134153
134321
|
|
|
134154
134322
|
|
|
134155
|
-
var HQCHART_VERSION="1.1.
|
|
134323
|
+
var HQCHART_VERSION="1.1.13139";
|
|
134156
134324
|
|
|
134157
134325
|
function PrintHQChartVersion()
|
|
134158
134326
|
{
|