hqchart 1.1.14766 → 1.1.14768
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.
package/lib/umychart.vue.js
CHANGED
|
@@ -5115,7 +5115,7 @@ this.RecentButton=CloneData(g_JSChartResource.StockChip.RecentButton);//近期
|
|
|
5115
5115
|
this.CloseButton=CloneData(g_JSChartResource.StockChip.CloseButton);this.ButtonTooltip=CloneData(g_JSChartResource.Buttons.Tooltip);};this.Draw=function(){this.PixelRatio=GetDevicePixelRatio();var left=ToFixedPoint(this.ChartBorder.GetRight()+this.Left);var top=ToFixedPoint(this.ChartBorder.GetTop());var right=ToFixedPoint(left+this.Width-1*this.PixelRatio);var bottom=ToFixedPoint(this.ChartBorder.GetBottom());var width=right-left;var height=bottom-top;this.ClientRect={Left:left,Top:top,Width:width,Height:height};if(ChartData.IsTickPeriod(this.HQChart.Period))//分笔图没有筹码
|
|
5116
5116
|
{this.Canvas.font=this.Font;this.Canvas.fillStyle=this.InfoColor;var x=left+width/2;var y=top+height/2;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillText(this.NotSupportMessage,x,y);this.DrawBorder();return;}if(this.CalculateChip()){this.DrawFrame();this.DrawAllChip();if(this.ShowType==1||this.ShowType==2)this.DrawDayChip();this.CalculateCast();//计算成本
|
|
5117
5117
|
this.DrawChipInfo();}else{JSConsole.Chart.Log('[StockChip::Draw] no data');}this.DrawBorder();this.SizeChange=false;};this.DrawChipInfo=function(){var bottom=this.ClientRect.Top+this.ClientRect.Height-1;var left=this.ClientRect.Left+2;var right=this.ClientRect.Left+this.ClientRect.Width;this.Canvas.font=this.Font;this.Canvas.fillStyle=this.InfoColor;this.Canvas.textBaseline='bottom';this.Canvas.textAlign='left';var lineHeight=this.LineHeight*GetDevicePixelRatio();var text='70%成本价 --.--';if(IFrameSplitOperator.IsNonEmptyArray(this.Data.Cast))text='70%成本价'+this.Data.Cast[1].MinPrice.toFixed(2)+'-'+this.Data.Cast[1].MaxPrice.toFixed(2)+'集中'+this.Data.Cast[1].Rate.toFixed(2)+'%';this.Canvas.fillText(text,left,bottom);bottom-=lineHeight;text='90%成本价 --.--';if(IFrameSplitOperator.IsNonEmptyArray(this.Data.Cast))text='90%成本价'+this.Data.Cast[0].MinPrice.toFixed(2)+'-'+this.Data.Cast[0].MaxPrice.toFixed(2)+'集中'+this.Data.Cast[0].Rate.toFixed(2)+'%';;this.Canvas.fillText(text,left,bottom);bottom-=lineHeight;text='平均成本:'+this.Data.ChipInfo.AveragePrice.toFixed(2)+'元';this.Canvas.fillText(text,left,bottom);bottom-=lineHeight;text=+this.Data.YPrice.toFixed(2)+'处获利盘:'+this.Data.ChipInfo.YProfitRate.toFixed(2)+'%';this.Canvas.fillText(text,left,bottom);bottom-=lineHeight;text='获利比例:';this.Canvas.fillText(text,left,bottom);var textWidth=this.Canvas.measureText(text).width+2;var barLeft=left+textWidth;var barWidth=right-5-barLeft;this.Canvas.strokeStyle=this.ColorNoProfit;this.Canvas.strokeRect(barLeft,bottom-lineHeight,barWidth,lineHeight);this.Canvas.strokeStyle=this.ColorProfit;this.Canvas.strokeRect(barLeft,bottom-lineHeight,barWidth*(this.Data.ChipInfo.ProfitRate/100),lineHeight);text=this.Data.ChipInfo.ProfitRate.toFixed(2)+'%';this.Canvas.textAlign='center';this.Canvas.fillText(text,barLeft+barWidth/2,bottom);bottom-=lineHeight;this.Canvas.textAlign='left';text='成本分布,日期:'+IFrameSplitOperator.FormatDateString(this.Data.SelectData.Date);if(this.Data.SelectData.Time)text+=' '+IFrameSplitOperator.FormatTimeString(this.Data.SelectData.Time);this.Canvas.fillText(text,left,bottom);bottom-=lineHeight;if(this.ShowType!=1&&this.ShowType!=2)return;var right=this.ClientRect.Left+this.ClientRect.Width-1;this.Canvas.textAlign='right';var textWidth=50;this.Data.DayChip.sort(function(a,b){return b.Day-a.Day;});for(var i in this.Data.DayChip){var item=this.Data.DayChip[i];var rate=0;if(this.Data.ChipInfo&&this.Data.ChipInfo.Vol>0)rate=item.Vol/this.Data.ChipInfo.Vol*100;text=item.Day+'周期'+(this.ShowType==1?'前':'内')+'成本'+(IFrameSplitOperator.IsNumber(rate)?rate.toFixed(2)+'%':"--.--%");if(i==0)textWidth=this.Canvas.measureText(text).width+8;this.Canvas.fillStyle=item.Color;this.Canvas.fillRect(right-textWidth,bottom-lineHeight,textWidth,lineHeight);this.Canvas.fillStyle=this.DayInfoColor;this.Canvas.fillText(text,right,bottom);bottom-=lineHeight;}};this.DrawDayChip=function(){var KLineFrame=this.HQChart.Frame.SubFrame[0].Frame;for(var i in this.Data.DayChip){var aryPoint=[];var chipData=this.Data.DayChip[i].Chip;if(!chipData)continue;var totalVol=0;for(var j=0;j<chipData.length;++j){var vol=chipData[j];if(!vol)continue;totalVol+=vol;var price=(j+this.Data.MinPrice)/100;var y=KLineFrame.GetYFromData(price);var x=vol/this.Data.MaxVol*this.ClientRect.Width+this.ClientRect.Left;aryPoint.push({X:x,Y:y});}this.Data.DayChip[i].Vol=totalVol;this.DrawArea(aryPoint,this.Data.DayChip[i].Color);}};this.DrawToolbar=function(moveonPoint,mouseStatus){this.Buttons=[];var left=this.ClientRect.Left;var right=this.ClientRect.Left+this.ClientRect.Width;var yButton=this.ClientRect.Top+this.ChartBorder.TitleHeight/2;var aryButton=[{ID:JSCHART_BUTTON_ID.CHIP_CLOSE,Style:this.CloseButton},{ID:JSCHART_BUTTON_ID.CHIP_RECENT,Style:this.RecentButton,ShowType:2},{ID:JSCHART_BUTTON_ID.CHIP_LONG,Style:this.LongButton,ShowType:1},{ID:JSCHART_BUTTON_ID.CHIP_DEFULT,Style:this.DefaultButton,ShowType:0}];//右往左绘制
|
|
5118
|
-
for(var i=0;i<aryButton.length;++i){var item=aryButton[i];var size=item.Style.Size;var xBotton=right-size-item.Style.MerginLeft;var font=size+'px '+item.Style.Family;var rtButton={Left:xBotton,Top:yButton-size/2,Right:xBotton+size+item.Style.MerginLeft,Bottom:yButton+size/2,Width:size+item.Style.MerginLeft,Height:size};var color=item.Style.Color;var btnItem={ID:item.ID,Rect:rtButton};if(this.ShowType==item.ShowType){color=item.Style.SelectedColor;if(mouseStatus&&moveonPoint&&moveonPoint.X>=rtButton.Left&&moveonPoint.X<rtButton.Right&&moveonPoint.Y>=rtButton.Top&&moveonPoint.Y<=rtButton.Bottom)mouseStatus.MouseOnToolbar={Rect:rtButton,Item:btnItem,Frame:this,Point:{X:moveonPoint.X,Y:moveonPoint.Y}};}else{if(moveonPoint&&moveonPoint.X>=rtButton.Left&&moveonPoint.X<rtButton.Right&&moveonPoint.Y>=rtButton.Top&&moveonPoint.Y<=rtButton.Bottom){color=item.Style.MoveOnColor;if(mouseStatus)mouseStatus.MouseOnToolbar={Rect:rtButton,Item:btnItem,Frame:this,Point:{X:moveonPoint.X,Y:moveonPoint.Y}};}}this.Canvas.fillStyle=color;this.Canvas.font=font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillText(item.Style.Text,xBotton,yButton);this.Buttons.push(btnItem);right=xBotton;}};this.DrawToolbarTooltip=function(mouseOnToolbar){if(!mouseOnToolbar)return;var left=this.ClientRect.Left;var right=this.ClientRect.Left+this.ClientRect.Width;var key='Toolbar-'+mouseOnToolbar.Item.ID;text=g_JSChartLocalization.GetText(key,0);if(!text)return;var rtButton=mouseOnToolbar.Rect;var xCenter=rtButton.Left+rtButton.Width/2;this.Canvas.font=this.ButtonTooltip.Font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";var textWidth=this.Canvas.measureText(text).width+8;var textHeight=this.GetFontHeight();var bgHeight=textHeight+8;var x=xCenter-textWidth/2;var y=rtButton.Top-bgHeight;if(y<0)y=rtButton.Bottom+1;if(x+textWidth>right)x=right-textWidth-2;this.Canvas.fillStyle=this.ButtonTooltip.ColorBG;this.Canvas.fillRect(x,y,textWidth,bgHeight);//画一个背景色, 不然是一个黑的背景
|
|
5118
|
+
for(var i=0;i<aryButton.length;++i){var item=aryButton[i];var size=item.Style.Size;var xBotton=right-size-item.Style.MerginLeft;var font=size+'px '+item.Style.Family;var rtButton={Left:xBotton,Top:yButton-size/2,Right:xBotton+size+item.Style.MerginLeft,Bottom:yButton+size/2,Width:size+item.Style.MerginLeft,Height:size};var color=item.Style.Color;var btnItem={ID:item.ID,Rect:rtButton};if(this.ShowType==item.ShowType){color=item.Style.SelectedColor;if(mouseStatus&&moveonPoint&&moveonPoint.X>=rtButton.Left&&moveonPoint.X<rtButton.Right&&moveonPoint.Y>=rtButton.Top&&moveonPoint.Y<=rtButton.Bottom)mouseStatus.MouseOnToolbar={Rect:rtButton,Item:btnItem,Frame:this,Point:{X:moveonPoint.X,Y:moveonPoint.Y}};}else{if(moveonPoint&&moveonPoint.X>=rtButton.Left&&moveonPoint.X<rtButton.Right&&moveonPoint.Y>=rtButton.Top&&moveonPoint.Y<=rtButton.Bottom){color=item.Style.MoveOnColor;if(mouseStatus)mouseStatus.MouseOnToolbar={Rect:rtButton,Item:btnItem,Frame:this,Point:{X:moveonPoint.X,Y:moveonPoint.Y}};}}this.Canvas.fillStyle=color;this.Canvas.font=font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillText(item.Style.Text,xBotton,yButton);this.Buttons.push(btnItem);right=xBotton;}};this.DrawToolbarTooltip=function(mouseOnToolbar){if(!mouseOnToolbar)return;var left=this.ClientRect.Left;var right=this.ClientRect.Left+this.ClientRect.Width;var key='Toolbar-'+mouseOnToolbar.Item.ID;var text=g_JSChartLocalization.GetText(key,0);if(!text)return;var rtButton=mouseOnToolbar.Rect;var xCenter=rtButton.Left+rtButton.Width/2;this.Canvas.font=this.ButtonTooltip.Font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";var textWidth=this.Canvas.measureText(text).width+8;var textHeight=this.GetFontHeight();var bgHeight=textHeight+8;var x=xCenter-textWidth/2;var y=rtButton.Top-bgHeight;if(y<0)y=rtButton.Bottom+1;if(x+textWidth>right)x=right-textWidth-2;this.Canvas.fillStyle=this.ButtonTooltip.ColorBG;this.Canvas.fillRect(x,y,textWidth,bgHeight);//画一个背景色, 不然是一个黑的背景
|
|
5119
5119
|
this.Canvas.fillStyle=this.ButtonTooltip.Color;this.Canvas.fillText(text,x+4,y+bgHeight/2);};this.PtInButtons=function(x,y)//坐标是否在按钮上
|
|
5120
5120
|
{for(var i=0;i<this.Buttons.length;++i){var item=this.Buttons[i];if(!item.Rect)continue;var rect=item.Rect;this.Canvas.beginPath();this.Canvas.rect(rect.Left,rect.Top,rect.Width,rect.Height);if(this.Canvas.isPointInPath(x,y)){return{ID:item.ID,Rect:rect};}}return null;};this.DrawAllChip=function(){var KLineFrame=this.HQChart.Frame.SubFrame[0].Frame;var selectPrice=this.Data.SelectData.Close;var aryProfitPoint=[];var aryNoProfitPoint=[];var totalVol=0,totalAmount=0,totalProfitVol=0,totalYProfitVol=0;//总的成交量, 总的成交金额, 总的盈利的成交量
|
|
5121
5121
|
var yPrice=this.Data.YPrice;var maxPrice=KLineFrame.HorizontalMax;var minPrice=KLineFrame.HorizontalMin;var MaxVol=1;for(var i=0;i<this.Data.AllChip.length;++i){var vol=this.Data.AllChip[i];if(!vol)continue;var price=(i+this.Data.MinPrice)/this.PriceZoom;totalVol+=vol;totalAmount+=price*vol;if(price<yPrice)totalYProfitVol+=vol;//获利的成交量
|
|
@@ -14970,7 +14970,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
|
|
|
14970
14970
|
this.ExecuteScript(item,data);}this.Status=0;}};this.OnExecuteFinish=function(data,indexInfo,jsExectute,jobInfo){var message={Data:data,IndexInfo:indexInfo,ID:JSCHART_WORKER_MESSAGE_ID.FINISH_EXECUTE_SCRIPT,JobInfo:jobInfo};postMessage(message);};this.OnExecuteError=function(error,indexInfo,jobData){var message={IndexInfo:indexInfo,ID:JSCHART_WORKER_MESSAGE_ID.ERROR_EXECUTE_SCRIPT,Error:error};postMessage(message);};}/********************************************************************************
|
|
14971
14971
|
* 版本信息输出
|
|
14972
14972
|
*
|
|
14973
|
-
*/var HQCHART_VERSION="1.1.
|
|
14973
|
+
*/var HQCHART_VERSION="1.1.14767";function PrintHQChartVersion(){var logo='\n\n*************************************************************************************************************************************************************************** \n* \n* :%@@- \n* :@@@@- \n* =@@@@ :#@@@ .:+#@@@#=: :=*@@@@@@#+-. *@@@@. \n* :@@@@@ .@@@@@ .#@@@@@@@@@@@- +@@@@@@@@@@@@@+ @@@@@ -%@@* \n* +@@@@% #@@@@# *@@@@@@@@@@@@@@%. =@@@@@@@@@@@@@@@- @@@@@ -@@@@+ \n* %@@@@* @@@@@+ .%@@@@@@@@@@@@@@@@%: #@@@@@@@@@@@@@@@% @@@@# *@@@@= \n* @@@@@= @@@@@- .%@@@@@@@*++*%@@@@@@% .%@@@@@@@%*+==+**= -@@@@+ #@@@@- \n* @@@@@. @@@@@. #@@@@@%= =@@@@@@* %@@@@@@#: *@@@@- :::. .-+*###+: ::: .+##+: -%%@@@@@%%%% \n* .@@@@@ .@@@@@. +@@@@@% .@@@@@@ *@@@@@@: %@@@@: +@@@@@%. :%@@@@@@@@@@: *@@@ :@@@@@* @@@@@@@@@@@@ \n* :@@@@@ :@@@@@ @@@@@% :@@@@@+ @@@@@@: %@@@@-@@@@@@@@@. @@@@@@@@@@@@@. :@@@%-@@@@@@.:@@@@@@@@@@@# \n* -@@@@% -@@@@@ =@@@@@. %@@@@% %@@@@@- %@@@@@@@@@@@@@@* %@@@@@@@@@@@@+ -@@@@@@@@@@# -@@@@@@@@@@@. \n* +@@@@%=========#@@@@% @@@@@# :@@@@@ .@@@@@% @@@@@@@@%@@@@@@@ -%+:. .#@@@@* +@@@@@@@%%@. .::+@@@@#:: \n* #@@@@@@@@@@@@@@@@@@@# .@@@@@ .@@@@@ :@@@@@. @@@@@@#. #@@@@@. -@@@@* #@@@@@@: *@@@@+ \n* %@@@@@@@@@@@@@@@@@@@+ :@@@@@ .@@@@@ -@@@@@ @@@@@+ @@@@@. :@@@@* @@@@@% #@@@@- \n* @@@@@@@@@@@@@@@@@@@@: :@@@@% :@@@@@ +@@@@% -@@@@+ @@@@@ -@@@@+ @@@@@. @@@@@. \n* .@@@@@@@@@@@@@@@@@@@@ :@@@@% -@@@@% *@@@@% #@@@@. @@@@@ .=*#%%%@@@@@= :@@@@# @@@@@. \n* -@@@@@:::::::::=@@@@@ :@@@@@ @@@@@* +@@@@% @@@@@ @@@@% -#@@@@@@@@@@@@: -@@@@* @@@@@ \n* =@@@@% =@@@@% .@@@@@ :@@@@@. -@@@@% @@@@@ .@@@@* +@@@@@@@@@@@@@@. =@@@@+ .@@@@@ \n* +@@@@# +@@@@# @@@@@# %@@@@% :@@@@@ .@@@@% =@@@@= -@@@@@*-:..%@@@@ +@@@@= :@@@@# \n* *@@@@* *@@@@* +@@@@@: #@@@@@+ .@@@@@@ :@@@@% *@@@@- @@@@@. @@@@% #@@@@: =@@@@+ \n* %@@@@= %@@@@+ @@@@@@- .%@@@@@# #@@@@@# :@@@@% #@@@@: @@@@% @@@@* %@@@@. #@@@@- \n* @@@@@- @@@@@= =@@@@@@#=...-*@@@@@@@: @@@@@@%=. :+**. :@@@@* %@@@@. .@@@@* *@@@@= @@@@@ %@@@@+ \n* .@@@@@: .@@@@@: *@@@@@@@@@@@@@@@@@@@# =@@@@@@@@%%%@@@@@@ +@@@@- @@@@@ .@@@@@: :%@@@@@- .@@@@% %@@@@@*+- \n* :@@@@@ :@@@@@ +@@@@@@@@@@@@@@@@@@@# =@@@@@@@@@@@@@@@@% %@@@@ @@@@@ @@@@@@@@@@@@@@@: -@@@@* *@@@@@@@@- \n* =@@@@@ -@@@@@ :@@@@@@@@@@@@@@@@@@@# :@@@@@@@@@@@@@@@% @@@@@ %@@@% #@@@@@@@@@#@@@@. +@@@@- .@@@@@@@@# \n* *@@@@# =@@@@% :#@@@@@@@#: :@@@@@= =@@@@@@@@@@@+. @@@@@ :@@@+ *@@@@@@@- %@@@ *@@@= =@@@@@@@* \n* =++++- -++++= .:::. .=*+: :-=+++=:. ****= .=+. .-++=: :+++ -+=: .-=+=:. \n* \n* \n* HQChart \n* Ver: '+HQCHART_VERSION+' \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n************************************************************************************************************************************************************************** \n ';console.log(logo);}PrintHQChartVersion();//把给外界调用的方法暴露出来
|
|
14974
14974
|
exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
|
|
14975
14975
|
// BaseIndex:BaseIndex,
|
|
14976
14976
|
// ChartLine:ChartLine,
|
package/package.json
CHANGED
package/src/jscommon/umychart.js
CHANGED
|
@@ -48458,7 +48458,7 @@ function StockChip()
|
|
|
48458
48458
|
var right=this.ClientRect.Left+this.ClientRect.Width;
|
|
48459
48459
|
|
|
48460
48460
|
var key='Toolbar-'+mouseOnToolbar.Item.ID;
|
|
48461
|
-
text=g_JSChartLocalization.GetText(key,0);
|
|
48461
|
+
var text=g_JSChartLocalization.GetText(key,0);
|
|
48462
48462
|
|
|
48463
48463
|
if (!text) return;
|
|
48464
48464
|
|
|
@@ -52554,7 +52554,7 @@ function StockChip()
|
|
|
52554
52554
|
var right=this.ClientRect.Left+this.ClientRect.Width;
|
|
52555
52555
|
|
|
52556
52556
|
var key='Toolbar-'+mouseOnToolbar.Item.ID;
|
|
52557
|
-
text=g_JSChartLocalization.GetText(key,0);
|
|
52557
|
+
var text=g_JSChartLocalization.GetText(key,0);
|
|
52558
52558
|
|
|
52559
52559
|
if (!text) return;
|
|
52560
52560
|
|
|
@@ -148865,7 +148865,7 @@ function ScrollBarBGChart()
|
|
|
148865
148865
|
|
|
148866
148866
|
|
|
148867
148867
|
|
|
148868
|
-
var HQCHART_VERSION="1.1.
|
|
148868
|
+
var HQCHART_VERSION="1.1.14767";
|
|
148869
148869
|
|
|
148870
148870
|
function PrintHQChartVersion()
|
|
148871
148871
|
{
|
|
@@ -52598,7 +52598,7 @@ function StockChip()
|
|
|
52598
52598
|
var right=this.ClientRect.Left+this.ClientRect.Width;
|
|
52599
52599
|
|
|
52600
52600
|
var key='Toolbar-'+mouseOnToolbar.Item.ID;
|
|
52601
|
-
text=g_JSChartLocalization.GetText(key,0);
|
|
52601
|
+
var text=g_JSChartLocalization.GetText(key,0);
|
|
52602
52602
|
|
|
52603
52603
|
if (!text) return;
|
|
52604
52604
|
|
|
@@ -159812,7 +159812,7 @@ function HQChartScriptWorker()
|
|
|
159812
159812
|
|
|
159813
159813
|
|
|
159814
159814
|
|
|
159815
|
-
var HQCHART_VERSION="1.1.
|
|
159815
|
+
var HQCHART_VERSION="1.1.14767";
|
|
159816
159816
|
|
|
159817
159817
|
function PrintHQChartVersion()
|
|
159818
159818
|
{
|