hqchart 1.1.12716 → 1.1.12717
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
|
@@ -3941,7 +3941,8 @@ function ChartLineStick(){this.newMethod=ChartStick;//派生
|
|
|
3941
3941
|
this.newMethod();delete this.newMethod;this.ClassName='ChartLineStick';this.Draw=function(){if(!this.IsShow||this.ChartFrame.IsMinSize)return;if(this.IsShowIndexTitleOnly())return;if(this.IsHideScriptIndex())return;if(this.NotSupportMessage){this.DrawNotSupportmessage();return;}this.DrawStick();this.DrawLine();};}//通达信语法 VOLSTICK 支持横屏
|
|
3942
3942
|
function ChartVolStick(){this.newMethod=IChartPainting;//派生
|
|
3943
3943
|
this.newMethod();delete this.newMethod;this.UpColor=g_JSChartResource.UpBarColor;this.DownColor=g_JSChartResource.DownBarColor;this.HistoryData;//历史数据
|
|
3944
|
-
this.KLineDrawType=0;this.ClassName='ChartVolStick';this.
|
|
3944
|
+
this.KLineDrawType=0;this.ClassName='ChartVolStick';this.BarWidth;//固定宽度 目前只支持宽度为1
|
|
3945
|
+
this.PtInChart=this.PtInBar;this.DrawSelectedStatus=this.DrawLinePoint;this.ExportData=this.ExportArrayData;this.Draw=function(){if(!this.IsShow||this.ChartFrame.IsMinSize||!this.IsVisible)return;if(this.IsShowIndexTitleOnly())return;if(this.IsHideScriptIndex())return;if(this.ChartFrame.IsHScreen===true){this.HScreenDraw();return;}var dataWidth=this.ChartFrame.DataWidth;var distanceWidth=this.ChartFrame.DistanceWidth;var border=this.ChartBorder.GetBorder();var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;var chartright=border.RightEx;var xPointCount=this.ChartFrame.XPointCount;var lockRect=this.GetLockRect();if(lockRect)chartright=lockRect.Left;var isMinute=this.IsMinuteFrame();var yBottom=this.ChartFrame.GetYFromData(0);if(dataWidth>=4&&!(this.BarWidth===1)){yBottom=ToFixedRect(yBottom);for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j,xOffset+=dataWidth+distanceWidth){var value=this.Data.Data[i];var kItem=this.HistoryData.Data[i];if(value==null||kItem==null)continue;if(value==0)continue;var left=xOffset;var right=xOffset+dataWidth;if(right>chartright)break;var y=this.ChartFrame.GetYFromData(value);var barColor=this.GetBarColor(kItem);var bUp=barColor.IsUp;this.Canvas.fillStyle=barColor.Color;var height=ToFixedRect(Math.abs(yBottom-y)>=1?yBottom-y:1);//高度调整为整数, 如果小于1, 统一使用1
|
|
3945
3946
|
y=yBottom-height;if(this.KLineDrawType==6)//完全空心柱
|
|
3946
3947
|
{this.Canvas.strokeStyle=barColor.Color;this.Canvas.beginPath();this.Canvas.rect(ToFixedPoint(left),ToFixedPoint(y),ToFixedRect(dataWidth),height);this.Canvas.stroke();}else if(bUp&&(this.KLineDrawType==1||this.KLineDrawType==2||this.KLineDrawType==3))//空心柱子
|
|
3947
3948
|
{this.Canvas.strokeStyle=this.UpColor;this.Canvas.beginPath();this.Canvas.rect(ToFixedPoint(left),ToFixedPoint(y),ToFixedRect(dataWidth),height);this.Canvas.stroke();}else{this.Canvas.fillRect(ToFixedRect(left),y,ToFixedRect(dataWidth),height);}}}else//太细了直接话线
|
|
@@ -11344,7 +11345,7 @@ else if(value.indexOf("FONTSIZE")==0){var strFontSize=value.replace("FONTSIZE","
|
|
|
11344
11345
|
{var _outVar9=this.VarTable.get(_varName3);if(!Array.isArray(_outVar9))_outVar9=this.SingleDataToArrayData(_outVar9);var _value6={Name:_varName3,Data:_outVar9,Radius:g_JSChartResource.CIRCLEDOT.Radius,Type:3,UpDownDot:true};if(color)_value6.Color=color;if(lineWidth)_value6.LineWidth=lineWidth;this.OutVarTable.push(_value6);}else if(lineStick&&_varName3)//LINESTICK 同时画出柱状线和指标线
|
|
11345
11346
|
{var _outVar10=this.VarTable.get(_varName3);var _value7={Name:_varName3,Data:_outVar10,Type:4};if(color)_value7.Color=color;if(lineWidth)_value7.LineWidth=lineWidth;this.OutVarTable.push(_value7);}else if(stick&&_varName3)//STICK 画柱状线
|
|
11346
11347
|
{var _outVar11=this.VarTable.get(_varName3);var _value8={Name:_varName3,Data:_outVar11,Type:5};if(color)_value8.Color=color;if(lineWidth)_value8.LineWidth=lineWidth;this.OutVarTable.push(_value8);}else if(volStick&&_varName3)//VOLSTICK 画彩色柱状线
|
|
11347
|
-
{var _outVar12=this.VarTable.get(_varName3);var _value9={Name:_varName3,Data:_outVar12,Type:6};if(color)_value9.Color=color;if(upColor)_value9.UpColor=upColor;if(downColor)_value9.DownColor=downColor;this.OutVarTable.push(_value9);}else if(lineArea&&_varName3)//LINEAREA 面积
|
|
11348
|
+
{var _outVar12=this.VarTable.get(_varName3);var _value9={Name:_varName3,Data:_outVar12,Type:6};if(color)_value9.Color=color;if(upColor)_value9.UpColor=upColor;if(downColor)_value9.DownColor=downColor;if(lineWidth)_value9.LineWidth=lineWidth;this.OutVarTable.push(_value9);}else if(lineArea&&_varName3)//LINEAREA 面积
|
|
11348
11349
|
{var _outVar13=this.VarTable.get(_varName3);var _value10={Name:_varName3,Data:_outVar13,Type:9};if(color)_value10.Color=color;if(upColor)_value10.UpColor=upColor;if(downColor)_value10.DownColor=downColor;if(lineWidth)_value10.LineWidth=lineWidth;this.OutVarTable.push(_value10);}else if(colorStick&&_varName3)//CYW: SUM(VAR4,10)/10000, COLORSTICK; 画上下柱子
|
|
11349
11350
|
{var _outVar14=this.VarTable.get(_varName3);var _value11={Name:_varName3,Data:_outVar14,Color:color,Type:2};if(lineWidth)_value11.LineWidth=lineWidth;if(color)_value11.Color=color;if(upColor)_value11.UpColor=upColor;if(downColor)_value11.DownColor=downColor;this.OutVarTable.push(_value11);}else if(_varName3&&color&&!_draw3){var _outVar15=this.VarTable.get(_varName3);if(!Array.isArray(_outVar15))_outVar15=this.SingleDataToArrayData(_outVar15);var _value12={Name:_varName3,Data:_outVar15,Color:color,Type:0};if(lineWidth)_value12.LineWidth=lineWidth;if(isShow==false)_value12.IsShow=false;if(isExData==true)_value12.IsExData=true;if(isDotLine==true)_value12.IsDotLine=true;if(isOverlayLine==true)_value12.IsOverlayLine=true;if(isNoneName==true)_value12.NoneName=true;if(isShowTitle==false)_value12.IsShowTitle=false;if(stepLine==true)_value12.Type=7;this.OutVarTable.push(_value12);}else if(_draw3)//画图函数
|
|
11350
11351
|
{var outVar={Name:_draw3.Name,Draw:_draw3,Type:1};if(color)outVar.Color=color;if(isDotLine==true)outVar.IsDotLine=true;if(lineWidth)outVar.LineWidth=lineWidth;if(isDrawAbove)outVar.IsDrawAbove=true;if(isDrawCenter)outVar.IsDrawCenter=true;if(isDrawBelow)outVar.IsDrawBelow=true;if(drawAlign>=0)outVar.DrawAlign=drawAlign;if(drawVAlign>=0)outVar.DrawVAlign=drawVAlign;if(fontSize>0)outVar.DrawFontSize=fontSize;if(bgConfig)outVar.Background=bgConfig;if(vLineConfig)outVar.VerticalLine=vLineConfig;if(IFrameSplitOperator.IsNumber(xOffset))outVar.XOffset=xOffset;if(IFrameSplitOperator.IsNumber(yOffset))outVar.YOffset=yOffset;if(IFrameSplitOperator.IsBool(isFirstDraw))outVar.IsFirstDraw=isFirstDraw;this.OutVarTable.push(outVar);}else if(_varName3){var _outVar16=this.VarTable.get(_varName3);var _value13={Name:_varName3,Data:_outVar16,Type:0};if(color)_value13.Color=color;if(lineWidth)_value13.LineWidth=lineWidth;if(isShow==false)_value13.IsShow=false;if(isExData==true)_value13.IsExData=true;if(isDotLine==true)_value13.IsDotLine=true;if(isOverlayLine==true)_value13.IsOverlayLine=true;if(isShowTitle==false)_value13.IsShowTitle=false;if(stepLine==true)_value13.Type=7;this.OutVarTable.push(_value13);}}}};this.GetOutIconData=function(cond,iconDraw){if(Array.isArray(cond)){for(var i=0;i<cond.length&&i<iconDraw.DrawData.length;++i){var item=cond[i];if(item<=0)iconDraw.DrawData[i]=null;}return iconDraw;}if(cond)return iconDraw;return null;};this.GetSoundEvent=function(){if(!this.GetEventCallback)return null;return this.GetEventCallback(JSCHART_EVENT_ID.ON_PLAY_SOUND);};this.Run=function(){try{var data=this.RunAST();//执行脚本
|
|
@@ -11545,7 +11546,7 @@ if(varItem.Draw.FixedPosition==="TOP")chartText.FixedPosition=1;else if(varItem.
|
|
|
11545
11546
|
hqChart.ChartPaint.push(chartText);};//COLORSTICK
|
|
11546
11547
|
this.CreateMACD=function(hqChart,windowIndex,varItem,id){var chartMACD=new ChartMACD();chartMACD.Canvas=hqChart.Canvas;chartMACD.Identify=this.Guid;chartMACD.Name=varItem.Name;chartMACD.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chartMACD.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;if(varItem.LineWidth){var width=parseInt(varItem.LineWidth.replace("LINETHICK",""));if(!isNaN(width)&&width>0)chartMACD.LineWidth=width;}var titleIndex=windowIndex+1;chartMACD.Data.Data=varItem.Data;var clrTitle=this.GetDefaultColor(id);if(varItem.Color)clrTitle=this.GetColor(varItem.Color);if(varItem.UpColor)chartMACD.UpColor=varItem.UpColor;if(varItem.DownColor)chartMACD.DownColor=varItem.DownColor;this.ReloadChartResource(hqChart,windowIndex,chartMACD);hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(chartMACD.Data,varItem.Name,clrTitle);this.SetChartIndexName(chartMACD);hqChart.ChartPaint.push(chartMACD);};this.CreatePointDot=function(hqChart,windowIndex,varItem,id,hisData){var pointDot=new ChartPointDot();pointDot.Canvas=hqChart.Canvas;pointDot.Name=varItem.Name;pointDot.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;pointDot.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;if(varItem.Color)pointDot.Color=this.GetColor(varItem.Color);else pointDot.Color=this.GetDefaultColor(id);if(varItem.Radius)pointDot.Radius=varItem.Radius;if(varItem.LineWidth){var width=parseInt(varItem.LineWidth.replace("LINETHICK",""));if(!isNaN(width)&&width>0)pointDot.Radius=width;}if(IFrameSplitOperator.IsBool(varItem.UpDownDot)){pointDot.EnableUpDownColor=varItem.UpDownDot;pointDot.HistoryData=hisData;}var titleIndex=windowIndex+1;pointDot.Data.Data=varItem.Data;hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(pointDot.Data,varItem.Name,pointDot.Color);hqChart.ChartPaint.push(pointDot);};this.CreateStick=function(hqChart,windowIndex,varItem,id){var chart=new ChartStick();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;if(varItem.Color)chart.Color=this.GetColor(varItem.Color);else chart.Color=this.GetDefaultColor(id);if(varItem.LineWidth){var width=parseInt(varItem.LineWidth.replace("LINETHICK",""));if(!isNaN(width)&&width>0)chart.LineWidth=width;}var titleIndex=windowIndex+1;chart.Data.Data=varItem.Data;this.ReloadChartResource(hqChart,windowIndex,chart);hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);this.SetChartIndexName(chart);hqChart.ChartPaint.push(chart);};this.CreateLineStick=function(hqChart,windowIndex,varItem,id){var chart=new ChartLineStick();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;if(varItem.Color)chart.Color=this.GetColor(varItem.Color);else chart.Color=this.GetDefaultColor(id);if(varItem.LineWidth){var width=parseInt(varItem.LineWidth.replace("LINETHICK",""));if(!isNaN(width)&&width>0)chart.LineWidth=width;}var titleIndex=windowIndex+1;chart.Data.Data=varItem.Data;hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);hqChart.ChartPaint.push(chart);};this.CreateStraightLine=function(hqChart,windowIndex,varItem,id){var line=new ChartLine();line.DrawType=1;line.Canvas=hqChart.Canvas;line.Name=varItem.Name;line.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;line.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;if(varItem.Color)line.Color=this.GetColor(varItem.Color);else line.Color=this.GetDefaultColor(id);if(varItem.LineWidth){var width=parseInt(varItem.LineWidth.replace("LINETHICK",""));if(!isNaN(width)&&width>0)line.LineWidth=width;}var titleIndex=windowIndex+1;line.Data.Data=varItem.Draw.DrawData;if(varItem.Name=="DRAWLINE")hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(line.Data,null,line.Color);//hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(line.Data,varItem.Name,line.Color);
|
|
11547
11548
|
hqChart.ChartPaint.push(line);};this.CreateVolStick=function(hqChart,windowIndex,varItem,id,hisData){var chart=new ChartVolStick();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;chart.KLineDrawType=hqChart.KLineDrawType;//设置K线显示类型
|
|
11548
|
-
chart.Identify=this.Guid;if(varItem.Color)chart.Color=this.GetColor(varItem.Color);else chart.Color=this.GetDefaultColor(id);if(varItem.UpColor)chart.UpColor=varItem.UpColor;if(varItem.DownColor)chart.DownColor=varItem.DownColor;var titleIndex=windowIndex+1;chart.Data.Data=varItem.Data;chart.HistoryData=hisData;this.ReloadChartResource(hqChart,windowIndex,chart);var titleData=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);hqChart.TitlePaint[titleIndex].Data[id]=titleData;this.SetTitleData(titleData,chart);this.SetChartIndexName(chart);hqChart.ChartPaint.push(chart);};this.CreateBand=function(hqChart,windowIndex,varItem,id){var chart=new ChartBand();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;chart.FirstColor=varItem.Draw.Color[0];chart.SecondColor=varItem.Draw.Color[1];chart.Data.Data=varItem.Draw.DrawData;if(IFrameSplitOperator.IsBool(varItem.IsFirstDraw))chart.IsDrawFirst=varItem.IsFirstDraw;hqChart.ChartPaint.push(chart);};this.CreateFillRGN=function(hqChart,windowIndex,varItem,id){var chart=new ChartLineArea();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;chart.Data.Data=varItem.Draw.DrawData;if(varItem.Color)chart.Color=this.GetColor(varItem.Color);else chart.Color=this.GetDefaultColor(id);hqChart.ChartPaint.push(chart);};this.CreateFillRGN2=function(hqChart,windowIndex,varItem,id){var chart=new ChartFillRGN();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;chart.Data.Data=varItem.Draw.DrawData;hqChart.ChartPaint.push(chart);};this.CreateFillBGRGN=function(hqChart,windowIndex,varItem,id){var chart=new ChartFillBGRGN();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;chart.Data.Data=varItem.Draw.DrawData;hqChart.ChartPaint.push(chart);};this.CreateFLOATRGN=function(hqChart,windowIndex,varItem,id){var chart=new ChartFLOATRGN();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;chart.Data.Data=varItem.Draw.DrawData;hqChart.ChartPaint.push(chart);};//创建K线图
|
|
11549
|
+
chart.Identify=this.Guid;if(varItem.Color)chart.Color=this.GetColor(varItem.Color);else chart.Color=this.GetDefaultColor(id);if(varItem.UpColor)chart.UpColor=varItem.UpColor;if(varItem.DownColor)chart.DownColor=varItem.DownColor;if(varItem.LineWidth){var width=parseInt(varItem.LineWidth.replace("LINETHICK",""));if(IFrameSplitOperator.IsPlusNumber(width))chart.BarWidth=width;}var titleIndex=windowIndex+1;chart.Data.Data=varItem.Data;chart.HistoryData=hisData;this.ReloadChartResource(hqChart,windowIndex,chart);var titleData=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);hqChart.TitlePaint[titleIndex].Data[id]=titleData;this.SetTitleData(titleData,chart);this.SetChartIndexName(chart);hqChart.ChartPaint.push(chart);};this.CreateBand=function(hqChart,windowIndex,varItem,id){var chart=new ChartBand();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;chart.FirstColor=varItem.Draw.Color[0];chart.SecondColor=varItem.Draw.Color[1];chart.Data.Data=varItem.Draw.DrawData;if(IFrameSplitOperator.IsBool(varItem.IsFirstDraw))chart.IsDrawFirst=varItem.IsFirstDraw;hqChart.ChartPaint.push(chart);};this.CreateFillRGN=function(hqChart,windowIndex,varItem,id){var chart=new ChartLineArea();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;chart.Data.Data=varItem.Draw.DrawData;if(varItem.Color)chart.Color=this.GetColor(varItem.Color);else chart.Color=this.GetDefaultColor(id);hqChart.ChartPaint.push(chart);};this.CreateFillRGN2=function(hqChart,windowIndex,varItem,id){var chart=new ChartFillRGN();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;chart.Data.Data=varItem.Draw.DrawData;hqChart.ChartPaint.push(chart);};this.CreateFillBGRGN=function(hqChart,windowIndex,varItem,id){var chart=new ChartFillBGRGN();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;chart.Data.Data=varItem.Draw.DrawData;hqChart.ChartPaint.push(chart);};this.CreateFLOATRGN=function(hqChart,windowIndex,varItem,id){var chart=new ChartFLOATRGN();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;chart.Data.Data=varItem.Draw.DrawData;hqChart.ChartPaint.push(chart);};//创建K线图
|
|
11549
11550
|
this.CreateKLine=function(hqChart,windowIndex,varItem,id){var chart=new ChartKLine();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.Identify=this.Guid;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;chart.Data.Data=varItem.Draw.DrawData;chart.IsShowMaxMinPrice=false;chart.IsShowKTooltip=false;if(varItem.Color)//如果设置了颜色,使用外面设置的颜色
|
|
11550
11551
|
chart.UnchagneColor=chart.DownColor=chart.UpColor=this.GetColor(varItem.Color);hqChart.ChartPaint.push(chart);};this.CreateOverlayKLine=function(hqChart,windowIndex,varItem,id){var chart=null;if(hqChart.IsKLineContainer())chart=new ChartOverlayKLine();else if(hqChart.IsMinuteContainer())chart=new ChartOverlayMinutePriceLine();else return;chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.Identify=this.Guid;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;if(varItem.Color)chart.Color=this.GetColor(varItem.Color);//如果设置了颜色,使用外面设置的颜色
|
|
11551
11552
|
else chart.Color=this.GetDefaultColor(id);chart.Data.Data=varItem.Draw.DrawData;chart.MainData=hqChart.ChartPaint[0].Data;//绑定K线
|
|
@@ -11675,7 +11676,7 @@ if(varItem.Draw.DrawData)chart.Data.Data=varItem.Draw.DrawData;chart.Text=varIte
|
|
|
11675
11676
|
frame.ChartPaint.push(chart);};//COLORSTICK
|
|
11676
11677
|
this.CreateMACD=function(hqChart,windowIndex,varItem,id){var overlayIndex=this.OverlayIndex;var frame=overlayIndex.Frame;var chart=new ChartMACD();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=frame.Frame.ChartBorder;chart.ChartFrame=frame.Frame;chart.Identify=overlayIndex.Identify;var titleIndex=windowIndex+1;chart.Data.Data=varItem.Data;var titlePaint=hqChart.TitlePaint[titleIndex];var clrTitle=this.GetDefaultColor(id);if(varItem.Color)clrTitle=this.GetColor(varItem.Color);if(varItem.UpColor)chart.UpColor=varItem.UpColor;if(varItem.DownColor)chart.DownColor=varItem.DownColor;this.ReloadChartResource(hqChart,windowIndex,chart);titlePaint.OverlayIndex.get(overlayIndex.Identify).Data[id]=new DynamicTitleData(chart.Data,varItem.Name,clrTitle);frame.ChartPaint.push(chart);};this.CreatePointDot=function(hqChart,windowIndex,varItem,id,hisData){var overlayIndex=this.OverlayIndex;var frame=overlayIndex.Frame;var chart=new ChartPointDot();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=frame.Frame.ChartBorder;chart.ChartFrame=frame.Frame;chart.Identify=overlayIndex.Identify;if(varItem.Color)chart.Color=this.GetColor(varItem.Color);else chart.Color=this.GetDefaultColor(id);if(varItem.Radius)chart.Radius=varItem.Radius;if(varItem.LineWidth){var width=parseInt(varItem.LineWidth.replace("LINETHICK",""));if(!isNaN(width)&&width>0)chart.Radius=width;}if(IFrameSplitOperator.IsBool(varItem.UpDownDot)){chart.EnableUpDownColor=varItem.UpDownDot;chart.HistoryData=hisData;}var titleIndex=windowIndex+1;chart.Data.Data=varItem.Data;var titlePaint=hqChart.TitlePaint[titleIndex];titlePaint.OverlayIndex.get(overlayIndex.Identify).Data[id]=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);frame.ChartPaint.push(chart);};this.CreateStick=function(hqChart,windowIndex,varItem,id){var overlayIndex=this.OverlayIndex;var frame=overlayIndex.Frame;var chart=new ChartStick();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=frame.Frame.ChartBorder;chart.ChartFrame=frame.Frame;chart.Identify=overlayIndex.Identify;if(varItem.Color)chart.Color=this.GetColor(varItem.Color);else chart.Color=this.GetDefaultColor(id);if(varItem.LineWidth){var width=parseInt(varItem.LineWidth.replace("LINETHICK",""));if(!isNaN(width)&&width>0)chart.LineWidth=width;}var titleIndex=windowIndex+1;chart.Data.Data=varItem.Data;this.ReloadChartResource(hqChart,windowIndex,chart);var titlePaint=hqChart.TitlePaint[titleIndex];titlePaint.OverlayIndex.get(overlayIndex.Identify).Data[id]=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);frame.ChartPaint.push(chart);};this.CreateLineStick=function(hqChart,windowIndex,varItem,id){var overlayIndex=this.OverlayIndex;var frame=overlayIndex.Frame;var chart=new ChartLineStick();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=frame.Frame.ChartBorder;chart.ChartFrame=frame.Frame;chart.Identify=overlayIndex.Identify;if(varItem.Color)chart.Color=this.GetColor(varItem.Color);else chart.Color=this.GetDefaultColor(id);if(varItem.LineWidth){var width=parseInt(varItem.LineWidth.replace("LINETHICK",""));if(!isNaN(width)&&width>0)chart.LineWidth=width;}var titleIndex=windowIndex+1;chart.Data.Data=varItem.Data;var titlePaint=hqChart.TitlePaint[titleIndex];titlePaint.OverlayIndex.get(overlayIndex.Identify).Data[id]=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);frame.ChartPaint.push(chart);};this.CreateStraightLine=function(hqChart,windowIndex,varItem,id){var overlayIndex=this.OverlayIndex;var frame=overlayIndex.Frame;var chart=new ChartLine();chart.DrawType=1;chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=frame.Frame.ChartBorder;chart.ChartFrame=frame.Frame;chart.Identify=overlayIndex.Identify;if(varItem.Color)chart.Color=this.GetColor(varItem.Color);else chart.Color=this.GetDefaultColor(id);if(varItem.LineWidth){var width=parseInt(varItem.LineWidth.replace("LINETHICK",""));if(!isNaN(width)&&width>0)chart.LineWidth=width;}var titleIndex=windowIndex+1;chart.Data.Data=varItem.Draw.DrawData;//hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(line.Data,varItem.Name,line.Color);
|
|
11677
11678
|
frame.ChartPaint.push(chart);};this.CreateVolStick=function(hqChart,windowIndex,varItem,id,hisData){var overlayIndex=this.OverlayIndex;var frame=overlayIndex.Frame;var chart=new ChartVolStick();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=frame.Frame.ChartBorder;chart.ChartFrame=frame.Frame;chart.Identify=overlayIndex.Identify;chart.KLineDrawType=hqChart.KLineDrawType;//设置K线显示类型
|
|
11678
|
-
if(varItem.Color)chart.Color=this.GetColor(varItem.Color);else chart.Color=this.GetDefaultColor(id);if(varItem.UpColor)chart.UpColor=varItem.UpColor;if(varItem.DownColor)chart.DownColor=varItem.DownColor;var titleIndex=windowIndex+1;chart.Data.Data=varItem.Data;chart.HistoryData=hisData;this.ReloadChartResource(hqChart,windowIndex,chart);var titlePaint=hqChart.TitlePaint[titleIndex];
|
|
11679
|
+
if(varItem.Color)chart.Color=this.GetColor(varItem.Color);else chart.Color=this.GetDefaultColor(id);if(varItem.UpColor)chart.UpColor=varItem.UpColor;if(varItem.DownColor)chart.DownColor=varItem.DownColor;if(varItem.LineWidth){var width=parseInt(varItem.LineWidth.replace("LINETHICK",""));if(IFrameSplitOperator.IsPlusNumber(width))chart.BarWidth=width;}var titleIndex=windowIndex+1;chart.Data.Data=varItem.Data;chart.HistoryData=hisData;this.ReloadChartResource(hqChart,windowIndex,chart);var titlePaint=hqChart.TitlePaint[titleIndex];var titleData=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);titlePaint.OverlayIndex.get(overlayIndex.Identify).Data[id]=titleData;this.SetTitleData(titleData,chart);this.SetChartIndexName(chart);frame.ChartPaint.push(chart);};this.CreateBand=function(hqChart,windowIndex,varItem,id){var overlayIndex=this.OverlayIndex;var frame=overlayIndex.Frame;var chart=new ChartBand();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=frame.Frame.ChartBorder;chart.ChartFrame=frame.Frame;chart.Identify=overlayIndex.Identify;chart.FirstColor=varItem.Draw.Color[0];chart.SecondColor=varItem.Draw.Color[1];chart.Data.Data=varItem.Draw.DrawData;if(IFrameSplitOperator.IsBool(varItem.IsFirstDraw))chart.IsDrawFirst=varItem.IsFirstDraw;frame.ChartPaint.push(chart);};//创建K线图
|
|
11679
11680
|
this.CreateKLine=function(hqChart,windowIndex,varItem,id){var overlayIndex=this.OverlayIndex;var frame=overlayIndex.Frame;var chart=new ChartKLine();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=frame.Frame.ChartBorder;chart.ChartFrame=frame.Frame;chart.Identify=overlayIndex.Identify;chart.Data.Data=varItem.Draw.DrawData;chart.IsShowMaxMinPrice=false;chart.IsShowKTooltip=false;if(varItem.Color)//如果设置了颜色,使用外面设置的颜色
|
|
11680
11681
|
chart.UnchagneColor=chart.DownColor=chart.UpColor=this.GetColor(varItem.Color);frame.ChartPaint.push(chart);};this.CreatePolyLine=function(hqChart,windowIndex,varItem,id){var overlayIndex=this.OverlayIndex;var frame=overlayIndex.Frame;var chart=new ChartLine();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=frame.Frame.ChartBorder;chart.ChartFrame=frame.Frame;chart.Identify=overlayIndex.Identify;if(varItem.Color)chart.Color=this.GetColor(varItem.Color);else chart.Color=this.GetDefaultColor(id);if(varItem.LineWidth){var width=parseInt(varItem.LineWidth.replace("LINETHICK",""));if(!isNaN(width)&&width>0)chart.LineWidth=width;}var titleIndex=windowIndex+1;chart.Data.Data=varItem.Draw.DrawData;var titlePaint=hqChart.TitlePaint[titleIndex];titlePaint.OverlayIndex.get(overlayIndex.Identify).Data[id]=new DynamicTitleData(line.Data,' ',line.Color);//给一个空的标题
|
|
11681
11682
|
frame.ChartPaint.push(chart);};this.CreateNumberText=function(hqChart,windowIndex,varItem,id){var overlayIndex=this.OverlayIndex;var frame=overlayIndex.Frame;var chart=new ChartSingleText();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=frame.Frame.ChartBorder;chart.ChartFrame=frame.Frame;chart.Identify=overlayIndex.Identify;chart.ReloadResource();chart.TextAlign="center";if(varItem.Color)chart.Color=this.GetColor(varItem.Color);else chart.Color=this.GetDefaultColor(id);if(varItem.IsDrawAbove)chart.Direction=1;else chart.Direction=2;if(varItem.Draw.Position)chart.Position=varItem.Draw.Position;//赋值坐标
|
|
@@ -12892,7 +12893,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
|
|
|
12892
12893
|
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);};}/********************************************************************************
|
|
12893
12894
|
* 版本信息输出
|
|
12894
12895
|
*
|
|
12895
|
-
*/var HQCHART_VERSION="1.1.
|
|
12896
|
+
*/var HQCHART_VERSION="1.1.12715";function PrintHQChartVersion(){var log='*************************************************************************************************************\n*\n* HQChart Ver: '+HQCHART_VERSION+' \n* \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n*************************************************************************************************************\n';console.log(log);}PrintHQChartVersion();//把给外界调用的方法暴露出来
|
|
12896
12897
|
exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
|
|
12897
12898
|
// BaseIndex:BaseIndex,
|
|
12898
12899
|
// ChartLine:ChartLine,
|
package/package.json
CHANGED
|
@@ -5054,7 +5054,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
5054
5054
|
var item=option.Frame[i];
|
|
5055
5055
|
if (!chart.Frame.SubFrame[i]) continue;
|
|
5056
5056
|
var subFrame=chart.Frame.SubFrame[i].Frame;
|
|
5057
|
-
|
|
5057
|
+
|
|
5058
5058
|
if (IFrameSplitOperator.IsNumber(item.SplitCount)) chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitCount=item.SplitCount;
|
|
5059
5059
|
if (item.StringFormat) chart.Frame.SubFrame[i].Frame.YSplitOperator.StringFormat=item.StringFormat;
|
|
5060
5060
|
if (IFrameSplitOperator.IsNumber(item.SplitType))
|
|
@@ -33798,6 +33798,8 @@ function ChartVolStick()
|
|
|
33798
33798
|
this.KLineDrawType=0;
|
|
33799
33799
|
this.ClassName='ChartVolStick';
|
|
33800
33800
|
|
|
33801
|
+
this.BarWidth; //固定宽度 目前只支持宽度为1
|
|
33802
|
+
|
|
33801
33803
|
this.PtInChart=this.PtInBar;
|
|
33802
33804
|
this.DrawSelectedStatus=this.DrawLinePoint;
|
|
33803
33805
|
|
|
@@ -33827,7 +33829,7 @@ function ChartVolStick()
|
|
|
33827
33829
|
|
|
33828
33830
|
var yBottom=this.ChartFrame.GetYFromData(0);
|
|
33829
33831
|
|
|
33830
|
-
if (dataWidth>=4)
|
|
33832
|
+
if (dataWidth>=4 && !(this.BarWidth===1))
|
|
33831
33833
|
{
|
|
33832
33834
|
yBottom=ToFixedRect(yBottom);
|
|
33833
33835
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
|
|
@@ -111971,6 +111973,7 @@ function JSExecute(ast,option)
|
|
|
111971
111973
|
if (color) value.Color=color;
|
|
111972
111974
|
if (upColor) value.UpColor=upColor;
|
|
111973
111975
|
if (downColor) value.DownColor=downColor;
|
|
111976
|
+
if (lineWidth) value.LineWidth=lineWidth;
|
|
111974
111977
|
this.OutVarTable.push(value);
|
|
111975
111978
|
}
|
|
111976
111979
|
else if (lineArea && varName) //LINEAREA 面积
|
|
@@ -114955,6 +114958,11 @@ function ScriptIndex(name,script,args,option)
|
|
|
114955
114958
|
|
|
114956
114959
|
if (varItem.UpColor) chart.UpColor=varItem.UpColor;
|
|
114957
114960
|
if (varItem.DownColor) chart.DownColor=varItem.DownColor;
|
|
114961
|
+
if (varItem.LineWidth)
|
|
114962
|
+
{
|
|
114963
|
+
let width=parseInt(varItem.LineWidth.replace("LINETHICK",""));
|
|
114964
|
+
if (IFrameSplitOperator.IsPlusNumber(width)) chart.BarWidth=width;
|
|
114965
|
+
}
|
|
114958
114966
|
|
|
114959
114967
|
let titleIndex=windowIndex+1;
|
|
114960
114968
|
chart.Data.Data=varItem.Data;
|
|
@@ -116820,6 +116828,11 @@ function OverlayScriptIndex(name,script,args,option)
|
|
|
116820
116828
|
|
|
116821
116829
|
if (varItem.UpColor) chart.UpColor=varItem.UpColor;
|
|
116822
116830
|
if (varItem.DownColor) chart.DownColor=varItem.DownColor;
|
|
116831
|
+
if (varItem.LineWidth)
|
|
116832
|
+
{
|
|
116833
|
+
let width=parseInt(varItem.LineWidth.replace("LINETHICK",""));
|
|
116834
|
+
if (IFrameSplitOperator.IsPlusNumber(width)) chart.BarWidth=width;
|
|
116835
|
+
}
|
|
116823
116836
|
|
|
116824
116837
|
let titleIndex=windowIndex+1;
|
|
116825
116838
|
chart.Data.Data=varItem.Data;
|
|
@@ -116827,7 +116840,8 @@ function OverlayScriptIndex(name,script,args,option)
|
|
|
116827
116840
|
this.ReloadChartResource(hqChart, windowIndex, chart);
|
|
116828
116841
|
|
|
116829
116842
|
var titlePaint=hqChart.TitlePaint[titleIndex];
|
|
116830
|
-
|
|
116843
|
+
var titleData=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);
|
|
116844
|
+
titlePaint.OverlayIndex.get(overlayIndex.Identify).Data[id]=titleData;
|
|
116831
116845
|
|
|
116832
116846
|
this.SetTitleData(titleData,chart);
|
|
116833
116847
|
|
|
@@ -130937,7 +130951,7 @@ function ScrollBarBGChart()
|
|
|
130937
130951
|
|
|
130938
130952
|
|
|
130939
130953
|
|
|
130940
|
-
var HQCHART_VERSION="1.1.
|
|
130954
|
+
var HQCHART_VERSION="1.1.12715";
|
|
130941
130955
|
|
|
130942
130956
|
function PrintHQChartVersion()
|
|
130943
130957
|
{
|
|
@@ -5098,7 +5098,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
5098
5098
|
var item=option.Frame[i];
|
|
5099
5099
|
if (!chart.Frame.SubFrame[i]) continue;
|
|
5100
5100
|
var subFrame=chart.Frame.SubFrame[i].Frame;
|
|
5101
|
-
|
|
5101
|
+
|
|
5102
5102
|
if (IFrameSplitOperator.IsNumber(item.SplitCount)) chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitCount=item.SplitCount;
|
|
5103
5103
|
if (item.StringFormat) chart.Frame.SubFrame[i].Frame.YSplitOperator.StringFormat=item.StringFormat;
|
|
5104
5104
|
if (IFrameSplitOperator.IsNumber(item.SplitType))
|
|
@@ -33842,6 +33842,8 @@ function ChartVolStick()
|
|
|
33842
33842
|
this.KLineDrawType=0;
|
|
33843
33843
|
this.ClassName='ChartVolStick';
|
|
33844
33844
|
|
|
33845
|
+
this.BarWidth; //固定宽度 目前只支持宽度为1
|
|
33846
|
+
|
|
33845
33847
|
this.PtInChart=this.PtInBar;
|
|
33846
33848
|
this.DrawSelectedStatus=this.DrawLinePoint;
|
|
33847
33849
|
|
|
@@ -33871,7 +33873,7 @@ function ChartVolStick()
|
|
|
33871
33873
|
|
|
33872
33874
|
var yBottom=this.ChartFrame.GetYFromData(0);
|
|
33873
33875
|
|
|
33874
|
-
if (dataWidth>=4)
|
|
33876
|
+
if (dataWidth>=4 && !(this.BarWidth===1))
|
|
33875
33877
|
{
|
|
33876
33878
|
yBottom=ToFixedRect(yBottom);
|
|
33877
33879
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
|
|
@@ -112015,6 +112017,7 @@ function JSExecute(ast,option)
|
|
|
112015
112017
|
if (color) value.Color=color;
|
|
112016
112018
|
if (upColor) value.UpColor=upColor;
|
|
112017
112019
|
if (downColor) value.DownColor=downColor;
|
|
112020
|
+
if (lineWidth) value.LineWidth=lineWidth;
|
|
112018
112021
|
this.OutVarTable.push(value);
|
|
112019
112022
|
}
|
|
112020
112023
|
else if (lineArea && varName) //LINEAREA 面积
|
|
@@ -114999,6 +115002,11 @@ function ScriptIndex(name,script,args,option)
|
|
|
114999
115002
|
|
|
115000
115003
|
if (varItem.UpColor) chart.UpColor=varItem.UpColor;
|
|
115001
115004
|
if (varItem.DownColor) chart.DownColor=varItem.DownColor;
|
|
115005
|
+
if (varItem.LineWidth)
|
|
115006
|
+
{
|
|
115007
|
+
let width=parseInt(varItem.LineWidth.replace("LINETHICK",""));
|
|
115008
|
+
if (IFrameSplitOperator.IsPlusNumber(width)) chart.BarWidth=width;
|
|
115009
|
+
}
|
|
115002
115010
|
|
|
115003
115011
|
let titleIndex=windowIndex+1;
|
|
115004
115012
|
chart.Data.Data=varItem.Data;
|
|
@@ -116864,6 +116872,11 @@ function OverlayScriptIndex(name,script,args,option)
|
|
|
116864
116872
|
|
|
116865
116873
|
if (varItem.UpColor) chart.UpColor=varItem.UpColor;
|
|
116866
116874
|
if (varItem.DownColor) chart.DownColor=varItem.DownColor;
|
|
116875
|
+
if (varItem.LineWidth)
|
|
116876
|
+
{
|
|
116877
|
+
let width=parseInt(varItem.LineWidth.replace("LINETHICK",""));
|
|
116878
|
+
if (IFrameSplitOperator.IsPlusNumber(width)) chart.BarWidth=width;
|
|
116879
|
+
}
|
|
116867
116880
|
|
|
116868
116881
|
let titleIndex=windowIndex+1;
|
|
116869
116882
|
chart.Data.Data=varItem.Data;
|
|
@@ -116871,7 +116884,8 @@ function OverlayScriptIndex(name,script,args,option)
|
|
|
116871
116884
|
this.ReloadChartResource(hqChart, windowIndex, chart);
|
|
116872
116885
|
|
|
116873
116886
|
var titlePaint=hqChart.TitlePaint[titleIndex];
|
|
116874
|
-
|
|
116887
|
+
var titleData=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);
|
|
116888
|
+
titlePaint.OverlayIndex.get(overlayIndex.Identify).Data[id]=titleData;
|
|
116875
116889
|
|
|
116876
116890
|
this.SetTitleData(titleData,chart);
|
|
116877
116891
|
|
|
@@ -131095,7 +131109,7 @@ function HQChartScriptWorker()
|
|
|
131095
131109
|
|
|
131096
131110
|
|
|
131097
131111
|
|
|
131098
|
-
var HQCHART_VERSION="1.1.
|
|
131112
|
+
var HQCHART_VERSION="1.1.12715";
|
|
131099
131113
|
|
|
131100
131114
|
function PrintHQChartVersion()
|
|
131101
131115
|
{
|