hqchart 1.1.14487 → 1.1.14492

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.
@@ -3288,7 +3288,7 @@ item.FinanceTime=tradeItem.Time;bMatch=true;}}}result[i]=item;++i;}return result
3288
3288
  this.GetFittingMarketValueData=function(financeData){var result=[];for(var i=0,j=0;i<this.Data.length;){var date=this.Data[i].Date;var price=this.Data[i].Close;if(j+1<financeData.length){if(financeData[j].Date<date&&financeData[j+1].Date<=date){++j;continue;}}var item=new SingleData();item.Date=date;item.Value=financeData[j].Value*price;//市值计算 收盘价*股数
3289
3289
  item.FinanceDate=financeData[j].Date;//财务日期 调试用
3290
3290
  result[i]=item;++i;}return result;};//月线数据拟合
3291
- this.GetFittingMonthData=function(overlayData){var result=new Array();var preDate=null;for(var i=0,j=0;i<this.Data.length;){var date=this.Data[i].Date;if(j>=overlayData.length){result[i]=null;++i;continue;;}var overlayDate=overlayData[j].Date;if(overlayDate==date){var item=new SingleData();item.Date=overlayData[j].Date;item.Value=overlayData[j].Value;item.Text=overlayData[j].Text;result[i]=item;++j;++i;}else if(preDate!=null&&preDate<overlayDate&&date>overlayDate){var item=new SingleData();item.Date=date;item.OverlayDate=overlayData[j].Date;item.Value=overlayData[j].Value;item.Text=overlayData[j].Text;result[i]=item;++j;++i;}else if(overlayDate<date){++j;}else{result[i]=new SingleData();result[i].Date=date;++i;}preDate=date;}return result;};this.GetValue=function(){var result=[];for(var i in this.Data){if(this.Data[i]&&this.Data[i].Value!=null){var item=this.Data[i].Value;if(!isNaN(item))result[i]=item;else if(item instanceof Array)//支持数组
3291
+ this.GetFittingMonthData=function(overlayData){var result=new Array();var preDate=null;for(var i=0,j=0;i<this.Data.length;){var date=this.Data[i].Date;if(j>=overlayData.length){result[i]=null;++i;continue;;}var overlayDate=overlayData[j].Date;if(overlayDate==date){var item=new SingleData();item.Date=overlayData[j].Date;item.Value=overlayData[j].Value;item.Text=overlayData[j].Text;result[i]=item;++j;++i;}else if(preDate!=null&&preDate<overlayDate&&date>overlayDate){var item=new SingleData();item.Date=date;item.OverlayDate=overlayData[j].Date;item.Value=overlayData[j].Value;item.Text=overlayData[j].Text;result[i]=item;++j;++i;}else if(overlayDate<date){++j;}else{result[i]=new SingleData();result[i].Date=date;++i;}preDate=date;}return result;};this.GetValue=function(){var result=[];for(var i in this.Data){if(this.Data[i]&&this.Data[i].Value!=null){var item=this.Data[i].Value;if(IFrameSplitOperator.IsNumber(item))result[i]=item;else if(IFrameSplitOperator.IsString(item))result[i]=item;else if(item instanceof Array)//支持数组
3292
3292
  result[i]=item;else result[i]=null;}else result[i]=null;}return result;};this.GetObject=function(){var result=[];for(var i in this.Data){if(this.Data[i]&&this.Data[i].Value){var item=this.Data[i].Value;result[i]=item;}else result[i]=null;}return result;};this.GetPeriodSingleData=function(period){var result=new Array();var index=0;var startDate=0;var weekCount=2;var newData=null;for(var i in this.Data){var isNewData=false;var dayData=this.Data[i];if(dayData==null||dayData.Date==null)continue;switch(period){case 1://周线
3293
3293
  var fridayDate=ChartData.GetFirday(dayData.Date);if(fridayDate!=startDate){isNewData=true;startDate=fridayDate;}break;case 21://双周
3294
3294
  var fridayDate=ChartData.GetFirday(dayData.Date);if(fridayDate!=startDate){++weekCount;if(weekCount>=2){isNewData=true;weekCount=0;}startDate=fridayDate;}break;case 2://月线
@@ -3970,7 +3970,10 @@ var drawCount=0;for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xP
3970
3970
  {var value=this.Data.Data[i];if(value==null){if(drawCount>0)this.Canvas.stroke();bFirstPoint=true;drawCount=0;ptFirst=null;continue;}if(isMinute){var x=this.ChartFrame.GetXFromIndex(j);}else{var left=xOffset;var right=xOffset+dataWidth;if(right>chartright)break;var x=left+(right-left)/2;}var y=this.GetYFromData(value,false);if(x>chartright)break;//断开
3971
3971
  if(this.BreakPoint&&this.BreakPoint.has(i)){if(drawCount>0)this.Canvas.stroke();bFirstPoint=true;drawCount=0;ptFirst=null;}if(bFirstPoint){this.Canvas.beginPath();if(bHScreen)this.Canvas.moveTo(y,x);//横屏坐标轴对调
3972
3972
  else this.Canvas.moveTo(x,y);bFirstPoint=false;ptFirst={X:x,Y:y};}else{if(bHScreen)this.Canvas.lineTo(y,x);else this.Canvas.lineTo(x,y);}++drawCount;}if(drawCount>0){if(drawCount==1&&ptFirst)//如果只有1个点, 画一个像素的横线
3973
- {if(bHScreen)this.Canvas.lineTo(ptFirst.Y,ptFirst.X+1*GetDevicePixelRatio());else this.Canvas.lineTo(ptFirst.X+1*GetDevicePixelRatio(),ptFirst.Y);}this.Canvas.stroke();}this.Canvas.restore();};}//面积图 支持横屏
3973
+ {if(bHScreen)this.Canvas.lineTo(ptFirst.Y,ptFirst.X+1*GetDevicePixelRatio());else this.Canvas.lineTo(ptFirst.X+1*GetDevicePixelRatio(),ptFirst.Y);}this.Canvas.stroke();}this.Canvas.restore();};}//标题
3974
+ function ChartIndexTitle(){this.newMethod=IChartPainting;//派生
3975
+ this.newMethod();delete this.newMethod;this.ClassName='ChartIndexTitle';//类名
3976
+ this.Draw=function(){};this.GetMaxMin=function(){return{Min:null,Max:null};};}//面积图 支持横屏
3974
3977
  function ChartArea(){this.newMethod=IChartPainting;//派生
3975
3978
  this.newMethod();delete this.newMethod;this.ClassName='ChartArea';//类名
3976
3979
  this.Color="rgb(255,193,37)";//线段颜色
@@ -6037,7 +6040,7 @@ var value=null;var preVaildItem=null;if(item.DataType=="StraightLine")//直线
6037
6040
  {value=item.Data.Data[0];valueText=this.FormatValue(value,item);}else if(item.ChartClassName=="ChartVolProfileVisibleRange"){aryText=this.FormatVPVRTitle(this.LastPoint,item);if(!aryText)return null;return{Text:null,ArrayText:aryText};}else{if(isShowLastData){var dataIndex=item.Data.Data.length-1;//显示最后一个数据
6038
6041
  }else{var index=Math.abs(this.CursorIndex);index=parseInt(index.toFixed(0));if(this.IsKLineFrame)index=this.CursorIndex;var dataIndex=item.Data.DataOffset+index;if(dataIndex>=item.Data.Data.length)dataIndex=item.Data.Data.length-1;if(dataIndex<0)return null;}if(item.DataType=="ChartMultiLine")//多线段数据
6039
6042
  {aryText=this.ForamtMultiLineTitle(dataIndex,item);if(!aryText)return null;return{Text:null,ArrayText:aryText};}else if(item.DataType=="ChartMultiPoint"){aryText=this.ForamtMultiPointTitle(dataIndex,item);if(!aryText)return null;return{Text:null,ArrayText:aryText};}else if(item.DataType=="ChartMultiBar"){aryText=this.ForamtMultiBarTitle(dataIndex,item);if(!aryText)return null;return{Text:null,ArrayText:aryText};}value=item.Data.Data[dataIndex];if(value==null&&item.ChartClassName=="ChartStepLine")//当前值无效,上一个值延续
6040
- {preVaildItem=this.GetPreVaildItem(item.Data.Data,dataIndex);if(!preVaildItem)return null;preText=this.FormatValue(preVaildItem.Item,item);if(item.Name){var dyValue=this.GetDynamicOutValue(item.Name,preText);if(dyValue)preText=dyValue;}valueText='--('+preText+')';return{Text:valueText,ArrayText:aryText};}if(value==null)return null;if(item.DataType=="HistoryData-Vol"){value=value.Vol;valueText=this.FormatValue(value,item);}else if(item.DataType=="MultiReport"){valueText=this.FormatMultiReport(value,item);}else if(item.DataType=="MULTI_POINT_LINE"){valueText=this.FromatMultiDataLine(value,item);if(!valueText)return null;}else if(item.DataType=="ChartStackedBar"){aryText=this.FromatStackedBarTitle(value,item);if(!aryText)return null;return{Text:null,ArrayText:aryText};}else if(item.DataType=="DRAWKLINE"){aryText=this.FromatKLineTitle(value,item);if(!aryText)return null;return{Text:null,ArrayText:aryText};}else if(g_ScriptIndexChartFactory.Has(item.DataType))//外部挂接
6043
+ {preVaildItem=this.GetPreVaildItem(item.Data.Data,dataIndex);if(!preVaildItem)return null;preText=this.FormatValue(preVaildItem.Item,item);if(item.Name){var dyValue=this.GetDynamicOutValue(item.Name,preText);if(dyValue)preText=dyValue;}valueText='--('+preText+')';return{Text:valueText,ArrayText:aryText};}if(value==null)return null;if(item.DataType=="HistoryData-Vol"){value=value.Vol;valueText=this.FormatValue(value,item);}else if(item.DataType=="MultiReport"){valueText=this.FormatMultiReport(value,item);}else if(item.DataType=="MULTI_POINT_LINE"){valueText=this.FromatMultiDataLine(value,item);if(!valueText)return null;}else if(item.DataType=="ChartStackedBar"){aryText=this.FromatStackedBarTitle(value,item);if(!aryText)return null;return{Text:null,ArrayText:aryText};}else if(item.DataType=="DRAWKLINE"){aryText=this.FromatKLineTitle(value,item);if(!aryText)return null;return{Text:null,ArrayText:aryText};}else if(item.DataType=="ChartIndexTitle"){var text=item.Data.Data[dataIndex];if(!IFrameSplitOperator.IsString(text))return null;return{Text:text,ArrayText:null};}else if(g_ScriptIndexChartFactory.Has(item.DataType))//外部挂接
6041
6044
  {var find=g_ScriptIndexChartFactory.Get(item.DataType);if(find&&find.FormatTitleCallback)return find.FormatTitleCallback(value,item,dataIndex);}else{if(this.GetEventCallback){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_INDEX_OUT_TEXT);if(event){var data={Item:item,Index:titleIndex,Data:this.Data,FrameID:this.Frame.Identify,DataIndex:dataIndex,Value:value,Out:null};event.Callback(event,data,this);if(data.Out)return data.Out;}}if(item.DataType=="ChartBand")//默认不输出
6042
6045
  return null;var arrowSuper=null;//独立颜色
6043
6046
  if(this.IsShowUpDownArrow){var preValue=null;if(dataIndex-1>=0)preValue=item.Data.Data[dataIndex-1];if(IFrameSplitOperator.IsNumber(preValue)){if(preValue>value)arrowSuper={Text:'↓',TextColor:this.UpDownArrowConfig.DownColor};else if(preValue<value)arrowSuper={Text:'↑',TextColor:this.UpDownArrowConfig.UpColor};else arrowSuper={Text:'→',TextColor:this.UpDownArrowConfig.UnchangeColor};if(this.TitleArrowType==1)arrowSuper.TextColor=item.Color;}}valueText=this.FormatValue(value,item);if(item.Name){var dyValue=this.GetDynamicOutValue(item.Name,valueText);if(dyValue)valueText=dyValue;}if(arrowSuper){var outItem={Name:null,Text:valueText,Color:item.Color,TextEx:[arrowSuper]};if(item.Name){var text=item.Name;var dyTitle=this.GetDynamicOutName(item.Name);//动态标题
@@ -11792,7 +11795,8 @@ if(IFrameSplitOperator.IsNonEmptyArray(varItem.LineDash))line.LineDash=varItem.L
11792
11795
  {}else{if(varItem.NoneName)hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(line.Data,null,line.Color);else hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(line.Data,varItem.Name,line.Color);this.SetTitleData(hqChart.TitlePaint[titleIndex].Data[id],line);}this.SetChartIndexName(line);hqChart.ChartPaint.push(line);};this.CreateArea=function(hqChart,windowIndex,varItem,id){var line=new ChartArea();line.Canvas=hqChart.Canvas;line.DrawType=1;line.Name=varItem.Name;line.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;line.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;line.Identify=this.Guid;if(varItem.Color)line.Color=this.GetColor(varItem.Color);else line.Color=this.GetDefaultColor(id);if(varItem.DownColor){line.AreaColor=varItem.DownColor;}else if(varItem.UpColor){line.AreaColor=varItem.UpColor;line.AreaDirection=1;}if(varItem.LineWidth){var width=parseInt(varItem.LineWidth.replace("LINETHICK",""));if(IFrameSplitOperator.IsPlusNumber(width))line.LineWidth=width;}if(IFrameSplitOperator.IsNonEmptyArray(varItem.LineDash))line.LineDash=varItem.LineDash;//虚线
11793
11796
  if(varItem.IsShow==false)line.IsShow=false;var titleIndex=windowIndex+1;line.Data.Data=varItem.Data;if(varItem.IsShowTitle===false)//NOTEXT 不绘制标题
11794
11797
  {}else if(IFrameSplitOperator.IsString(varItem.Name)&&varItem.Name.indexOf("NOTEXT")==0)//标题中包含NOTEXT不绘制标题
11795
- {}else{if(varItem.NoneName)hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(line.Data,null,line.Color);else hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(line.Data,varItem.Name,line.Color);hqChart.TitlePaint[titleIndex].Data[id].ChartClassName=line.ClassName;}this.SetChartIndexName(line);hqChart.ChartPaint.push(line);};this.CreateOverlayLine=function(hqChart,windowIndex,varItem,id,lineType){if(lineType==7)var line=new ChartStepLine();var line=new ChartSubLine();line.Canvas=hqChart.Canvas;line.DrawType=1;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;}if(varItem.IsDotLine)line.IsDotLine=true;//虚线
11798
+ {}else{if(varItem.NoneName)hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(line.Data,null,line.Color);else hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(line.Data,varItem.Name,line.Color);hqChart.TitlePaint[titleIndex].Data[id].ChartClassName=line.ClassName;}this.SetChartIndexName(line);hqChart.ChartPaint.push(line);};//标题显示,没有图形
11799
+ this.CreateTitle=function(hqChart,windowIndex,varItem,id){var chart=new ChartIndexTitle();chart.Canvas=hqChart.Canvas;chart.Name=varItem.Name;chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;chart.Identify=this.Guid;if(varItem.Color)chart.Color=this.GetColor(varItem.Color);else chart.Color=this.GetDefaultColor(id);chart.Data.Data=varItem.Data;var titleIndex=windowIndex+1;var titleData=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);titleData.DataType="ChartIndexTitle";hqChart.TitlePaint[titleIndex].Data[id]=titleData;this.SetChartIndexName(chart);hqChart.ChartPaint.push(chart);};this.CreateOverlayLine=function(hqChart,windowIndex,varItem,id,lineType){if(lineType==7)var line=new ChartStepLine();var line=new ChartSubLine();line.Canvas=hqChart.Canvas;line.DrawType=1;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;}if(varItem.IsDotLine)line.IsDotLine=true;//虚线
11796
11800
  if(varItem.IsShow==false)line.IsShow=false;var titleIndex=windowIndex+1;line.Data.Data=varItem.Data;hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(line.Data,varItem.Name,line.Color);hqChart.TitlePaint[titleIndex].Data[id].ChartClassName=line.ClassName;hqChart.ChartPaint.push(line);};this.CreateSingleLine=function(hqChart,windowIndex,varItem,id,lineType){var line=new ChartSingleLine();line.Canvas=hqChart.Canvas;line.DrawType=1;line.Name=varItem.Name;line.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;line.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;line.Identify=this.Guid;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;}if(varItem.IsDotLine)line.IsDotLine=true;//虚线
11797
11801
  if(varItem.IsShow==false)line.IsShow=false;var titleIndex=windowIndex+1;line.Data.Data=varItem.Data;this.ReloadChartResource(hqChart,windowIndex,line);if(varItem.IsShowTitle===false)//NOTEXT 不绘制标题
11798
11802
  {}else if(IFrameSplitOperator.IsString(varItem.Name)&&varItem.Name.indexOf("NOTEXT")==0)//标题中包含NOTEXT不绘制标题
@@ -11869,7 +11873,8 @@ if(this.YSplitScale)hqChart.Frame.SubFrame[windowIndex].Frame.YSplitScale=this.Y
11869
11873
  */for(var _i130=0;_i130<this.OutVar.length;++_i130){var _item26=this.OutVar[_i130];if(_item26.IsExData===true)continue;//扩展数据不显示图形
11870
11874
  if(_item26.Type==1000||_item26.Type==1001)continue;//数据集合, 字符串
11871
11875
  if(_item26.Type==0){if(_item26.IsOverlayLine)this.CreateOverlayLine(hqChart,windowIndex,_item26,_i130,_item26.Type);else if(_item26.IsSingleLine)this.CreateSingleLine(hqChart,windowIndex,_item26,_i130,_item26.Type);else this.CreateLine(hqChart,windowIndex,_item26,_i130,_item26.Type);}else if(_item26.Type==1){switch(_item26.Draw.DrawType){case'STICKLINE':this.CreateBar(hqChart,windowIndex,_item26,_i130);break;case'DRAWTEXT':this.CreateDrawTextV2(hqChart,windowIndex,_item26,_i130);break;case'SUPERDRAWTEXT':this.CreateText(hqChart,windowIndex,_item26,_i130);break;case'DRAWLINE':this.CreateStraightLine(hqChart,windowIndex,_item26,_i130);break;case'DRAWBAND':this.CreateBand(hqChart,windowIndex,_item26,_i130);break;case"FILLRGN":this.CreateFillRGN(hqChart,windowIndex,_item26,_i130);break;case"FILLRGN2":this.CreateFillRGN2(hqChart,windowIndex,_item26,_i130);break;case"FILLTOPRGN":case"FILLBOTTOMRGN":case"FILLVERTICALRGN":this.CreateFillBGRGN(hqChart,windowIndex,_item26,_i130);break;case"FLOATRGN":this.CreateFLOATRGN(hqChart,windowIndex,_item26,_i130);break;case'DRAWKLINE':case"DRAWKLINE1":this.CreateKLine(hqChart,windowIndex,_item26,_i130);break;case"DRAWOVERLAYKLINE":this.CreateOverlayKLine(hqChart,windowIndex,_item26,_i130);break;case"DRAWCOLORKLINE":this.CreateDrawColorKLine(hqChart,windowIndex,_item26,_i130);break;case'DRAWKLINE_IF':this.CreateKLine(hqChart,windowIndex,_item26,_i130);break;case'POLYLINE':this.CreatePolyLine(hqChart,windowIndex,_item26,_i130);break;case'DRAWGBK':case"DRAWGBK2":this.CreateBackgroud(hqChart,windowIndex,_item26,_i130);break;case"DRAWGBK_DIV":this.CreateBackgroundDiv(hqChart,windowIndex,_item26,_i130);break;case'DRAWTEXT_LINE':this.CreateTextLine(hqChart,windowIndex,_item26,_i130);break;case'DRAWNUMBER':this.CreateDrawNumber(hqChart,windowIndex,_item26,_i130);break;case"DRAWNUMBER_FIX":case'DRAWTEXT_FIX':this.CreateNumberText(hqChart,windowIndex,_item26,_i130);break;case'DRAWICON':this.CreateIcon(hqChart,windowIndex,_item26,_i130);break;case"ICON":this.CreateIcon(hqChart,windowIndex,_item26,_i130);break;case"TIPICON":this.CreateTipIcon(hqChart,windowIndex,_item26,_i130);break;case'DRAWCHANNEL':this.CreateChannel(hqChart,windowIndex,_item26,_i130);break;case'PARTLINE':this.CreatePartLine(hqChart,windowIndex,_item26,_i130);break;case'DRAWRECTREL':this.CreateRectangle(hqChart,windowIndex,_item26,_i130);break;case"DRAWTEXTABS":case"DRAWTEXTREL":this.CreateDrawText(hqChart,windowIndex,_item26,_i130);break;case"DRAWOVERLAYLINE":this.CreateScriptOverlayLine(hqChart,windowIndex,_item26,_i130);break;case"DRAWSL":this.CreateChartSlopeLine(hqChart,windowIndex,_item26,_i130);break;case"VERTLINE":this.CreateChartVericaltLine(hqChart,windowIndex,_item26,_i130);break;case"HORLINE":this.CreateChartHorizontalLine(hqChart,windowIndex,_item26,_i130);break;case'MULTI_LINE':this.CreateMultiLine(hqChart,windowIndex,_item26,_i130);break;case"MULTI_POINT":this.CreateMultiPoint(hqChart,windowIndex,_item26,_i130);break;case'MULTI_BAR':this.CreateMultiBar(hqChart,windowIndex,_item26,_i130);break;case'MULTI_TEXT':this.CreateMultiText(hqChart,windowIndex,_item26,_i130);break;case'MULTI_SVGICON':this.CreateMultiSVGIcon(hqChart,windowIndex,_item26,_i130);break;case"DRAWSVG":this.CreateChartDrawSVG(hqChart,windowIndex,_item26,_i130);break;case"MULTI_HTMLDOM":this.CreateMulitHtmlDom(hqChart,windowIndex,_item26,_i130);break;case"COLOR_KLINE":this.CreateColorKLine(hqChart,windowIndex,_item26,_i130);break;case"KLINE_BG":this.CreateBackgroud(hqChart,windowIndex,_item26,_i130);break;case"MULTI_POINT_LINE":this.CreateLineMultiData(hqChart,windowIndex,_item26,_i130);break;case"DRAW_SIMPLE_TABLE":this.CreateSimpleTable(hqChart,windowIndex,_item26,_i130);break;case"DRAW_SIMPLE_PIE":this.CreateSimplePie(hqChart,windowIndex,_item26,_i130);break;case"DRAW_SIMPLE_RADAR":this.CreateSimpleRadar(hqChart,windowIndex,_item26,_i130);break;case"DRAW_SIMPLE_DOUGHNUT":this.CreateSimpleDoughnut(hqChart,windowIndex,_item26,_i130);break;case"BUY":case"SELL":case"SELLSHORT":case"BUYSHORT":this.CreateTradeIcon(hqChart,windowIndex,_item26,_i130);break;case"DRAWLASTBARICON":case"DRAWLASTBARNUMBER":case"DRAWLASTBARTEXT":this.CreateDrawLastBarText(hqChart,windowIndex,_item26,_i130);break;case SCRIPT_CHART_NAME.OVERLAY_BARS:this.CreateStackedBar(hqChart,windowIndex,_item26,_i130);break;case SCRIPT_CHART_NAME.KLINE_TABLE:this.CreateKLineTable(hqChart,windowIndex,_item26,_i130);break;case SCRIPT_CHART_NAME.SCATTER_PLOT:this.CreateScatterPlot(hqChart,windowIndex,_item26,_i130);break;case SCRIPT_CHART_NAME.CLIP_COLOR_STICK:this.CreateClipColorStick(hqChart,windowIndex,_item26,_i130);break;default:{var find=g_ScriptIndexChartFactory.Get(_item26.Draw.DrawType);//外部挂接
11872
- if(find&&find.CreateChartCallback)find.CreateChartCallback(hqChart,windowIndex,_item26,_i130,this);}break;}}else if(_item26.Type==2){this.CreateMACD(hqChart,windowIndex,_item26,_i130);}else if(_item26.Type==3){this.CreatePointDot(hqChart,windowIndex,_item26,_i130,hisData);}else if(_item26.Type==4){this.CreateLineStick(hqChart,windowIndex,_item26,_i130);}else if(_item26.Type==5){this.CreateStick(hqChart,windowIndex,_item26,_i130);}else if(_item26.Type==6){this.CreateVolStick(hqChart,windowIndex,_item26,_i130,hisData);}else if(_item26.Type==7){this.CreateLine(hqChart,windowIndex,_item26,_i130,_item26.Type);}else if(_item26.Type==8){this.CreateLine(hqChart,windowIndex,_item26,_i130,_item26.Type);}else if(_item26.Type==9){this.CreateArea(hqChart,windowIndex,_item26,_i130);}var titlePaint=hqChart.TitlePaint[windowIndex+1];if(titlePaint&&titlePaint.Data&&_i130<titlePaint.Data.length)//设置标题数值 小数位数和格式
11876
+ if(find&&find.CreateChartCallback)find.CreateChartCallback(hqChart,windowIndex,_item26,_i130,this);}break;}}else if(_item26.Type==2){this.CreateMACD(hqChart,windowIndex,_item26,_i130);}else if(_item26.Type==3){this.CreatePointDot(hqChart,windowIndex,_item26,_i130,hisData);}else if(_item26.Type==4){this.CreateLineStick(hqChart,windowIndex,_item26,_i130);}else if(_item26.Type==5){this.CreateStick(hqChart,windowIndex,_item26,_i130);}else if(_item26.Type==6){this.CreateVolStick(hqChart,windowIndex,_item26,_i130,hisData);}else if(_item26.Type==7){this.CreateLine(hqChart,windowIndex,_item26,_i130,_item26.Type);}else if(_item26.Type==8){this.CreateLine(hqChart,windowIndex,_item26,_i130,_item26.Type);}else if(_item26.Type==9){this.CreateArea(hqChart,windowIndex,_item26,_i130);}else if(_item26.Type==10)//标题
11877
+ {this.CreateTitle(hqChart,windowIndex,_item26,_i130);}var titlePaint=hqChart.TitlePaint[windowIndex+1];if(titlePaint&&titlePaint.Data&&_i130<titlePaint.Data.length)//设置标题数值 小数位数和格式
11873
11878
  {if(this.StringFormat>0)titlePaint.Data[_i130].StringFormat=this.StringFormat;if(this.FloatPrecision>=0)titlePaint.Data[_i130].FloatPrecision=this.FloatPrecision;if(this.OutName&&this.OutName.length>0&&this.Arguments&&this.Arguments.length>0){titlePaint.SetDynamicTitle(this.OutName,this.Arguments);}}}var titleIndex=windowIndex+1;var titlePaint=hqChart.TitlePaint[titleIndex];titlePaint.Title=this.Name;titlePaint.Identify=this.Guid;//指标ID
11874
11879
  titlePaint.ArgumentsText=null;titlePaint.Script=this;titlePaint.IsShowMainIndexTitle=this.IsShowIndexTitle;if(!this.IsShortTitle){var indexParam='';for(var _i131=0;_i131<this.Arguments.length;++_i131){var _item27=this.Arguments[_i131];if(indexParam.length>0)indexParam+=',';indexParam+=_item27.Value.toString();}if(indexParam.length>0)titlePaint.ArgumentsText='('+indexParam+')';}if(this.TitleFont)titlePaint.Font=this.TitleFont;return true;};//给一个默认的颜色
11875
11880
  this.GetDefaultColor=function(id){var COLOR_ARRAY=null;//使用全局线段配置
@@ -14200,10 +14205,10 @@ this.UpdatMultiSVGIconV2Tooltip=function(data){var tooltipData=data.Tooltip;if(!
14200
14205
  this.UpdatChartOXTooltip=function(data){var tooltipData=data.Tooltip;if(!tooltipData.Data||!tooltipData.Data.Data)return;var item=tooltipData.Data.Data;var period=this.HQChart.Period;var aryText=[];if(ChartData.IsDayPeriod(period,true)){var strStartDate=IFrameSplitOperator.FormatDateString(item.Start.Date,"YYYY-MM-DD");var strEndDate=IFrameSplitOperator.FormatDateString(item.End.Date,"YYYY-MM-DD");aryText.push({Title:"起始时间",Text:strStartDate,Color:this.ValueColor});aryText.push({Title:"结束时间",Text:strEndDate,Color:this.ValueColor});}else if(ChartData.IsMinutePeriod(period,true)){var strStartDate=IFrameSplitOperator.FormatDateString(item.Start.Date);var strStartTime=IFrameSplitOperator.FormatTimeString(item.Start.Time,"HH:MM");var strEndDate=IFrameSplitOperator.FormatDateString(item.End.Date);var strEndTime=IFrameSplitOperator.FormatTimeString(item.End.Time,"HH:MM");aryText.push({Title:"起始时间",Text:strStartDate+' '+strStartTime,Color:this.ValueColor});aryText.push({Title:"结束时间",Text:strEndDate+' '+strEndTime,Color:this.ValueColor});}this.AryText=aryText;this.UpdateTableDOM();this.ShowTooltip(data);};//表头图标
14201
14206
  this.ReportHeaderIconTooltip=function(data){var tooltipData=data.Tooltip;if(!tooltipData.Data||!IFrameSplitOperator.IsNonEmptyArray(tooltipData.Data.AryText))return;this.AryText=tooltipData.Data.AryText;this.UpdateTableDOM();this.ShowTooltip(data);};//表格单元格截断内容
14202
14207
  this.ReportCellTruncateTooltip=function(data){var tooltipData=data.Tooltip;if(!tooltipData.Data||!IFrameSplitOperator.IsNonEmptyArray(tooltipData.Data.AryText))return;var item=tooltipData.Data.AryText[0];if(!item.Text)return;this.AryText=[{Title:item.Text,IsMergeCell:true}];this.UpdateTableDOM();this.ShowTooltip(data);};this.TReportIconTooltip=function(data){var tooltipData=data.Tooltip;if(!tooltipData.Data||!IFrameSplitOperator.IsNonEmptyArray(tooltipData.Data.AryText))return;this.AryText=tooltipData.Data.AryText;this.UpdateTableDOM();this.ShowTooltip(data);};this.UpdateTableDOM=function(){var index=0;for(index=0;index<this.AryText.length&&index<this.MaxRowCount;++index){var outItem=this.AryText[index];var item=this.AryData[index];if(outItem.HTMLTitle)item.TitleSpan.innerHTML=outItem.HTMLTitle;else item.TitleSpan.innerText=outItem.Title;item.TitleSpan.style.color=this.TextColor;if(outItem.HTMLText)item.TextSpan.innerHTML=outItem.HTMLText;else item.TextSpan.innerText=outItem.Text;item.TextSpan.style.color=outItem.Color;item.TextTd.style.color=outItem.Color;if(outItem.ClassName){item.TextSpan.className=outItem.ClassName;}else{if(item.TextSpan.className!=this.ValueAlign.Right)item.TextSpan.className=this.ValueAlign.Right;}if(outItem.IsMergeCell)//合并单元格
14203
- {item.TitleTd.colspan=2;item.TextTd.style.display="none";}else{if(item.TitleTd.colspan!=1)item.TitleTd.colspan=1;item.TextTd.style.display="";}item.Tr.style.display="";if(item.Tr2)item.Tr2.style.display="none";}for(;index<this.MaxRowCount;++index){var item=this.AryData[index];item.Tr.style.display="none";if(item.Tr2)item.Tr2.style.display="none";}};this.GetFormatKLineTooltipText=function(kItem){var data=kItem.Item;var symbol=kItem.Symbol;var upperSymbol=symbol.toUpperCase();var defaultfloatPrecision=GetfloatPrecision(symbol);//价格小数位数
14208
+ {item.TitleTd.colspan=2;item.TextTd.style.display="none";}else{if(item.TitleTd.colspan!=1)item.TitleTd.colspan=1;item.TextTd.style.display="";}item.Tr.style.display="";if(item.Tr2)item.Tr2.style.display="none";}for(;index<this.MaxRowCount;++index){var item=this.AryData[index];item.Tr.style.display="none";if(item.Tr2)item.Tr2.style.display="none";}};this.GetFormatKLineTooltipText=function(kItem){var data=kItem.Item;var symbol=kItem.Symbol;if(data&&data.Symbol)symbol=symbol;var upperSymbol="";if(symbol)upperSymbol=symbol.toUpperCase();var defaultfloatPrecision=GetfloatPrecision(symbol);//价格小数位数
14204
14209
  var unit=MARKET_SUFFIX_NAME.GetVolUnit(upperSymbol);//日期
14205
14210
  var dateItem=this.ForamtDate(data.Date,"YYYY/MM/DD/W",'FloatTooltip-Date');//时间
14206
- var timeItem=null;if(IFrameSplitOperator.IsNumber(data.Time))timeItem=this.FormatTime(data.Time,this.HQChart.Period,null,'FloatTooltip-Time');var overlayItem=null;if(kItem.IsOverlay||kItem.IsIndexKLine&&kItem.Name)overlayItem={Title:"",Text:kItem.Name,Color:this.TextColor,ClassName:this.ValueAlign.Left};var yClose=data.YClose;//昨收价|昨结算价
14211
+ var timeItem=null;if(IFrameSplitOperator.IsNumber(data.Time))timeItem=this.FormatTime(data.Time,this.HQChart.Period,null,'FloatTooltip-Time');var overlayItem=null;if(kItem.IsOverlay)overlayItem={Title:"",Text:kItem.Name,Color:this.TextColor,ClassName:this.ValueAlign.Left};else if(kItem.IsIndexKLine){if(kItem.Name)overlayItem={Title:"",Text:kItem.Name,Color:this.TextColor,ClassName:this.ValueAlign.Left};else if(data&&data.Name)overlayItem={Title:"",Text:data.Name,Color:this.TextColor,ClassName:this.ValueAlign.Left};}var yClose=data.YClose;//昨收价|昨结算价
14207
14212
  var aryText=[this.ForamtPrice(data.Open,yClose,defaultfloatPrecision,'FloatTooltip-Open'),this.ForamtPrice(data.High,yClose,defaultfloatPrecision,'FloatTooltip-High'),this.ForamtPrice(data.Low,yClose,defaultfloatPrecision,'FloatTooltip-Low'),this.ForamtPrice(data.Close,yClose,defaultfloatPrecision,'FloatTooltip-Close'),this.ForamtPrice(data.YClose,data.YClose,defaultfloatPrecision,'FloatTooltip-YClose'),this.FormatVol(data.Vol/unit,'FloatTooltip-Vol'),this.FormatAmount(data.Amount,'FloatTooltip-Amount'),this.FormatIncrease(data.Close,yClose,defaultfloatPrecision,'FloatTooltip-Increase'),this.FormatAmplitude(data.High,data.Low,yClose,defaultfloatPrecision,'FloatTooltip-Amplitude')];if(timeItem)aryText.unshift(timeItem);aryText.unshift(dateItem);if(overlayItem)aryText.unshift(overlayItem);//换手率
14208
14213
  if(IFrameSplitOperator.IsNumber(data.FlowCapital)){aryText.push(this.FormatExchange(data.Vol,data.FlowCapital,'FloatTooltip-Exchange'));}//持仓量 结算价
14209
14214
  if(MARKET_SUFFIX_NAME.IsFutures(upperSymbol)){aryText.push(this.FormatPosition(data.Position,'FloatTooltip-Position'));aryText.push(this.ForamtFClose(data.FClose,defaultfloatPrecision,'FloatTooltip-FClose'));aryText.push(this.ForamtFClose(data.YFClose,defaultfloatPrecision,'FloatTooltip-YSettlePrice'));}var event=this.HQChart.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_KLINE_FLOAT_TOOLTIP);if(event&&event.Callback){var sendData={AryText:aryText,Data:kItem,HQChart:this.HQChart};event.Callback(event,sendData,this);}return aryText;};//信息地雷
@@ -14363,7 +14368,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
14363
14368
  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);};}/********************************************************************************
14364
14369
  * 版本信息输出
14365
14370
  *
14366
- */var HQCHART_VERSION="1.1.14486";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();//把给外界调用的方法暴露出来
14371
+ */var HQCHART_VERSION="1.1.14491";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();//把给外界调用的方法暴露出来
14367
14372
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
14368
14373
  // BaseIndex:BaseIndex,
14369
14374
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.14487",
3
+ "version": "1.1.14492",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -1555,7 +1555,10 @@ function JSFloatTooltip()
1555
1555
  {
1556
1556
  var data=kItem.Item;
1557
1557
  var symbol=kItem.Symbol;
1558
- var upperSymbol=symbol.toUpperCase();
1558
+ if (data && data.Symbol) symbol=symbol;
1559
+ var upperSymbol="";
1560
+ if (symbol) upperSymbol=symbol.toUpperCase();
1561
+
1559
1562
  var defaultfloatPrecision=GetfloatPrecision(symbol);//价格小数位数
1560
1563
  var unit=MARKET_SUFFIX_NAME.GetVolUnit(upperSymbol);
1561
1564
 
@@ -1567,9 +1570,15 @@ function JSFloatTooltip()
1567
1570
  if (IFrameSplitOperator.IsNumber(data.Time)) timeItem=this.FormatTime(data.Time, this.HQChart.Period, null, 'FloatTooltip-Time');
1568
1571
 
1569
1572
  var overlayItem=null;
1570
- if (kItem.IsOverlay || (kItem.IsIndexKLine && kItem.Name))
1573
+ if (kItem.IsOverlay)
1571
1574
  overlayItem={ Title:"", Text:kItem.Name, Color:this.TextColor, ClassName:this.ValueAlign.Left };
1572
-
1575
+ else if (kItem.IsIndexKLine)
1576
+ {
1577
+ if (kItem.Name)
1578
+ overlayItem={ Title:"", Text:kItem.Name, Color:this.TextColor, ClassName:this.ValueAlign.Left };
1579
+ else if (data && data.Name )
1580
+ overlayItem={ Title:"", Text:data.Name, Color:this.TextColor, ClassName:this.ValueAlign.Left };
1581
+ }
1573
1582
 
1574
1583
 
1575
1584
  var yClose=data.YClose; //昨收价|昨结算价
@@ -58354,6 +58354,9 @@ HQData.APIIndex_DRAWKLINE=function(data, callback)
58354
58354
  IsShowTitle:true,
58355
58355
  };
58356
58356
 
58357
+
58358
+ var textData={ name:"", type:10, color:"rgb(148,0,211)", data:[], isshow:false }; //名字
58359
+
58357
58360
  var aryDate=[];
58358
58361
  var aryTime=[];
58359
58362
  for(var i=100;i<kData.Data.length-100;++i)
@@ -58374,14 +58377,16 @@ HQData.APIIndex_DRAWKLINE=function(data, callback)
58374
58377
  klineData.Draw.DrawData.push(newItem);
58375
58378
 
58376
58379
  aryDate.push(kItem.Date);
58377
- aryTime.push(kItem.Time)
58380
+ aryTime.push(kItem.Time);
58381
+
58382
+ textData.data.push(kItem.YClose.toFixed(2));
58378
58383
  }
58379
58384
 
58380
58385
  var apiData=
58381
58386
  {
58382
58387
  code:0,
58383
58388
  stock:{ name:hqchart.Name, symbol:hqchart.Symbol },
58384
- outdata: { date:aryDate, time:aryTime, outvar:[klineData] }
58389
+ outdata: { date:aryDate, time:aryTime, outvar:[textData, klineData] }
58385
58390
  };
58386
58391
 
58387
58392
  console.log('[HQData.APIIndex_DRAWKLINE] apiData ', apiData);
@@ -20745,7 +20745,7 @@ function ScriptIndex(name,script,args,option)
20745
20745
  hqChart.ChartPaint.push(line);
20746
20746
  }
20747
20747
 
20748
- this.CreateArea=function(hqChart, windowIndex, varItem, id,)
20748
+ this.CreateArea=function(hqChart, windowIndex, varItem, id)
20749
20749
  {
20750
20750
  var line=new ChartArea();
20751
20751
 
@@ -20801,6 +20801,29 @@ function ScriptIndex(name,script,args,option)
20801
20801
  hqChart.ChartPaint.push(line);
20802
20802
  }
20803
20803
 
20804
+ //标题显示,没有图形
20805
+ this.CreateTitle=function(hqChart, windowIndex, varItem, id)
20806
+ {
20807
+ var chart=new ChartIndexTitle();
20808
+
20809
+ chart.Canvas=hqChart.Canvas;
20810
+ chart.Name=varItem.Name;
20811
+ chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;
20812
+ chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;
20813
+ chart.Identify=this.Guid;
20814
+ if (varItem.Color) chart.Color=this.GetColor(varItem.Color);
20815
+ else chart.Color=this.GetDefaultColor(id);
20816
+ chart.Data.Data=varItem.Data;
20817
+
20818
+ var titleIndex=windowIndex+1;
20819
+ var titleData=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);
20820
+ titleData.DataType="ChartIndexTitle";
20821
+ hqChart.TitlePaint[titleIndex].Data[id]=titleData;
20822
+
20823
+ this.SetChartIndexName(chart);
20824
+ hqChart.ChartPaint.push(chart);
20825
+ }
20826
+
20804
20827
  this.CreateOverlayLine=function(hqChart,windowIndex,varItem,id,lineType)
20805
20828
  {
20806
20829
  if (lineType==7) var line=new ChartStepLine();
@@ -22644,6 +22667,10 @@ function ScriptIndex(name,script,args,option)
22644
22667
  {
22645
22668
  this.CreateArea(hqChart,windowIndex,item,i);
22646
22669
  }
22670
+ else if (item.Type==10) //标题
22671
+ {
22672
+ this.CreateTitle(hqChart,windowIndex,item,i);
22673
+ }
22647
22674
 
22648
22675
  var titlePaint=hqChart.TitlePaint[windowIndex+1];
22649
22676
  if (titlePaint && titlePaint.Data && i<titlePaint.Data.length) //设置标题数值 小数位数和格式
@@ -23386,7 +23386,9 @@ function ChartData()
23386
23386
  if (this.Data[i] && this.Data[i].Value!=null)
23387
23387
  {
23388
23388
  var item=this.Data[i].Value;
23389
- if (!isNaN(item))
23389
+ if (IFrameSplitOperator.IsNumber(item))
23390
+ result[i]=item;
23391
+ else if (IFrameSplitOperator.IsString(item))
23390
23392
  result[i]=item;
23391
23393
  else if (item instanceof Array) //支持数组
23392
23394
  result[i]=item;
@@ -33403,6 +33405,28 @@ function ChartLine()
33403
33405
  }
33404
33406
  }
33405
33407
 
33408
+
33409
+ //标题
33410
+ function ChartIndexTitle()
33411
+ {
33412
+ this.newMethod=IChartPainting; //派生
33413
+ this.newMethod();
33414
+ delete this.newMethod;
33415
+
33416
+ this.ClassName='ChartIndexTitle'; //类名
33417
+
33418
+ this.Draw=function()
33419
+ {
33420
+
33421
+ }
33422
+
33423
+ this.GetMaxMin=function()
33424
+ {
33425
+ return { Min:null, Max:null };
33426
+ }
33427
+ }
33428
+
33429
+
33406
33430
  //面积图 支持横屏
33407
33431
  function ChartArea()
33408
33432
  {
@@ -58579,6 +58603,7 @@ function DynamicChartTitlePainting()
58579
58603
  if (!aryText) return null;
58580
58604
  return { Text:null, ArrayText:aryText };
58581
58605
  }
58606
+
58582
58607
 
58583
58608
  value=item.Data.Data[dataIndex];
58584
58609
 
@@ -58627,6 +58652,12 @@ function DynamicChartTitlePainting()
58627
58652
  if (!aryText) return null;
58628
58653
  return { Text:null, ArrayText:aryText };
58629
58654
  }
58655
+ else if (item.DataType=="ChartIndexTitle")
58656
+ {
58657
+ var text=item.Data.Data[dataIndex];
58658
+ if (!IFrameSplitOperator.IsString(text)) return null;
58659
+ return { Text:text, ArrayText:null };
58660
+ }
58630
58661
  else if (g_ScriptIndexChartFactory.Has(item.DataType)) //外部挂接
58631
58662
  {
58632
58663
  var find=g_ScriptIndexChartFactory.Get(item.DataType);
@@ -2840,6 +2840,9 @@ HQData.APIIndex_DRAWKLINE=function(data, callback)
2840
2840
  IsShowTitle:true,
2841
2841
  };
2842
2842
 
2843
+
2844
+ var textData={ name:"", type:10, color:"rgb(148,0,211)", data:[], isshow:false }; //名字
2845
+
2843
2846
  var aryDate=[];
2844
2847
  var aryTime=[];
2845
2848
  for(var i=100;i<kData.Data.length-100;++i)
@@ -2860,14 +2863,16 @@ HQData.APIIndex_DRAWKLINE=function(data, callback)
2860
2863
  klineData.Draw.DrawData.push(newItem);
2861
2864
 
2862
2865
  aryDate.push(kItem.Date);
2863
- aryTime.push(kItem.Time)
2866
+ aryTime.push(kItem.Time);
2867
+
2868
+ textData.data.push(kItem.YClose.toFixed(2));
2864
2869
  }
2865
2870
 
2866
2871
  var apiData=
2867
2872
  {
2868
2873
  code:0,
2869
2874
  stock:{ name:hqchart.Name, symbol:hqchart.Symbol },
2870
- outdata: { date:aryDate, time:aryTime, outvar:[klineData] }
2875
+ outdata: { date:aryDate, time:aryTime, outvar:[textData, klineData] }
2871
2876
  };
2872
2877
 
2873
2878
  console.log('[HQData.APIIndex_DRAWKLINE] apiData ', apiData);
@@ -27311,7 +27311,9 @@ function ChartData()
27311
27311
  if (this.Data[i] && this.Data[i].Value!=null)
27312
27312
  {
27313
27313
  var item=this.Data[i].Value;
27314
- if (!isNaN(item))
27314
+ if (IFrameSplitOperator.IsNumber(item))
27315
+ result[i]=item;
27316
+ else if (IFrameSplitOperator.IsString(item))
27315
27317
  result[i]=item;
27316
27318
  else if (item instanceof Array) //支持数组
27317
27319
  result[i]=item;
@@ -37328,6 +37330,28 @@ function ChartLine()
37328
37330
  }
37329
37331
  }
37330
37332
 
37333
+
37334
+ //标题
37335
+ function ChartIndexTitle()
37336
+ {
37337
+ this.newMethod=IChartPainting; //派生
37338
+ this.newMethod();
37339
+ delete this.newMethod;
37340
+
37341
+ this.ClassName='ChartIndexTitle'; //类名
37342
+
37343
+ this.Draw=function()
37344
+ {
37345
+
37346
+ }
37347
+
37348
+ this.GetMaxMin=function()
37349
+ {
37350
+ return { Min:null, Max:null };
37351
+ }
37352
+ }
37353
+
37354
+
37331
37355
  //面积图 支持横屏
37332
37356
  function ChartArea()
37333
37357
  {
@@ -62504,6 +62528,7 @@ function DynamicChartTitlePainting()
62504
62528
  if (!aryText) return null;
62505
62529
  return { Text:null, ArrayText:aryText };
62506
62530
  }
62531
+
62507
62532
 
62508
62533
  value=item.Data.Data[dataIndex];
62509
62534
 
@@ -62552,6 +62577,12 @@ function DynamicChartTitlePainting()
62552
62577
  if (!aryText) return null;
62553
62578
  return { Text:null, ArrayText:aryText };
62554
62579
  }
62580
+ else if (item.DataType=="ChartIndexTitle")
62581
+ {
62582
+ var text=item.Data.Data[dataIndex];
62583
+ if (!IFrameSplitOperator.IsString(text)) return null;
62584
+ return { Text:text, ArrayText:null };
62585
+ }
62555
62586
  else if (g_ScriptIndexChartFactory.Has(item.DataType)) //外部挂接
62556
62587
  {
62557
62588
  var find=g_ScriptIndexChartFactory.Get(item.DataType);
@@ -123089,7 +123120,7 @@ function ScriptIndex(name,script,args,option)
123089
123120
  hqChart.ChartPaint.push(line);
123090
123121
  }
123091
123122
 
123092
- this.CreateArea=function(hqChart, windowIndex, varItem, id,)
123123
+ this.CreateArea=function(hqChart, windowIndex, varItem, id)
123093
123124
  {
123094
123125
  var line=new ChartArea();
123095
123126
 
@@ -123145,6 +123176,29 @@ function ScriptIndex(name,script,args,option)
123145
123176
  hqChart.ChartPaint.push(line);
123146
123177
  }
123147
123178
 
123179
+ //标题显示,没有图形
123180
+ this.CreateTitle=function(hqChart, windowIndex, varItem, id)
123181
+ {
123182
+ var chart=new ChartIndexTitle();
123183
+
123184
+ chart.Canvas=hqChart.Canvas;
123185
+ chart.Name=varItem.Name;
123186
+ chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;
123187
+ chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;
123188
+ chart.Identify=this.Guid;
123189
+ if (varItem.Color) chart.Color=this.GetColor(varItem.Color);
123190
+ else chart.Color=this.GetDefaultColor(id);
123191
+ chart.Data.Data=varItem.Data;
123192
+
123193
+ var titleIndex=windowIndex+1;
123194
+ var titleData=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);
123195
+ titleData.DataType="ChartIndexTitle";
123196
+ hqChart.TitlePaint[titleIndex].Data[id]=titleData;
123197
+
123198
+ this.SetChartIndexName(chart);
123199
+ hqChart.ChartPaint.push(chart);
123200
+ }
123201
+
123148
123202
  this.CreateOverlayLine=function(hqChart,windowIndex,varItem,id,lineType)
123149
123203
  {
123150
123204
  if (lineType==7) var line=new ChartStepLine();
@@ -124988,6 +125042,10 @@ function ScriptIndex(name,script,args,option)
124988
125042
  {
124989
125043
  this.CreateArea(hqChart,windowIndex,item,i);
124990
125044
  }
125045
+ else if (item.Type==10) //标题
125046
+ {
125047
+ this.CreateTitle(hqChart,windowIndex,item,i);
125048
+ }
124991
125049
 
124992
125050
  var titlePaint=hqChart.TitlePaint[windowIndex+1];
124993
125051
  if (titlePaint && titlePaint.Data && i<titlePaint.Data.length) //设置标题数值 小数位数和格式
@@ -144078,7 +144136,7 @@ function ScrollBarBGChart()
144078
144136
 
144079
144137
 
144080
144138
 
144081
- var HQCHART_VERSION="1.1.14486";
144139
+ var HQCHART_VERSION="1.1.14491";
144082
144140
 
144083
144141
  function PrintHQChartVersion()
144084
144142
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.14486";
8
+ var HQCHART_VERSION="1.1.14491";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -58372,6 +58372,9 @@ HQData.APIIndex_DRAWKLINE=function(data, callback)
58372
58372
  IsShowTitle:true,
58373
58373
  };
58374
58374
 
58375
+
58376
+ var textData={ name:"", type:10, color:"rgb(148,0,211)", data:[], isshow:false }; //名字
58377
+
58375
58378
  var aryDate=[];
58376
58379
  var aryTime=[];
58377
58380
  for(var i=100;i<kData.Data.length-100;++i)
@@ -58392,14 +58395,16 @@ HQData.APIIndex_DRAWKLINE=function(data, callback)
58392
58395
  klineData.Draw.DrawData.push(newItem);
58393
58396
 
58394
58397
  aryDate.push(kItem.Date);
58395
- aryTime.push(kItem.Time)
58398
+ aryTime.push(kItem.Time);
58399
+
58400
+ textData.data.push(kItem.YClose.toFixed(2));
58396
58401
  }
58397
58402
 
58398
58403
  var apiData=
58399
58404
  {
58400
58405
  code:0,
58401
58406
  stock:{ name:hqchart.Name, symbol:hqchart.Symbol },
58402
- outdata: { date:aryDate, time:aryTime, outvar:[klineData] }
58407
+ outdata: { date:aryDate, time:aryTime, outvar:[textData, klineData] }
58403
58408
  };
58404
58409
 
58405
58410
  console.log('[HQData.APIIndex_DRAWKLINE] apiData ', apiData);
@@ -27355,7 +27355,9 @@ function ChartData()
27355
27355
  if (this.Data[i] && this.Data[i].Value!=null)
27356
27356
  {
27357
27357
  var item=this.Data[i].Value;
27358
- if (!isNaN(item))
27358
+ if (IFrameSplitOperator.IsNumber(item))
27359
+ result[i]=item;
27360
+ else if (IFrameSplitOperator.IsString(item))
27359
27361
  result[i]=item;
27360
27362
  else if (item instanceof Array) //支持数组
27361
27363
  result[i]=item;
@@ -37372,6 +37374,28 @@ function ChartLine()
37372
37374
  }
37373
37375
  }
37374
37376
 
37377
+
37378
+ //标题
37379
+ function ChartIndexTitle()
37380
+ {
37381
+ this.newMethod=IChartPainting; //派生
37382
+ this.newMethod();
37383
+ delete this.newMethod;
37384
+
37385
+ this.ClassName='ChartIndexTitle'; //类名
37386
+
37387
+ this.Draw=function()
37388
+ {
37389
+
37390
+ }
37391
+
37392
+ this.GetMaxMin=function()
37393
+ {
37394
+ return { Min:null, Max:null };
37395
+ }
37396
+ }
37397
+
37398
+
37375
37399
  //面积图 支持横屏
37376
37400
  function ChartArea()
37377
37401
  {
@@ -62548,6 +62572,7 @@ function DynamicChartTitlePainting()
62548
62572
  if (!aryText) return null;
62549
62573
  return { Text:null, ArrayText:aryText };
62550
62574
  }
62575
+
62551
62576
 
62552
62577
  value=item.Data.Data[dataIndex];
62553
62578
 
@@ -62596,6 +62621,12 @@ function DynamicChartTitlePainting()
62596
62621
  if (!aryText) return null;
62597
62622
  return { Text:null, ArrayText:aryText };
62598
62623
  }
62624
+ else if (item.DataType=="ChartIndexTitle")
62625
+ {
62626
+ var text=item.Data.Data[dataIndex];
62627
+ if (!IFrameSplitOperator.IsString(text)) return null;
62628
+ return { Text:text, ArrayText:null };
62629
+ }
62599
62630
  else if (g_ScriptIndexChartFactory.Has(item.DataType)) //外部挂接
62600
62631
  {
62601
62632
  var find=g_ScriptIndexChartFactory.Get(item.DataType);
@@ -123133,7 +123164,7 @@ function ScriptIndex(name,script,args,option)
123133
123164
  hqChart.ChartPaint.push(line);
123134
123165
  }
123135
123166
 
123136
- this.CreateArea=function(hqChart, windowIndex, varItem, id,)
123167
+ this.CreateArea=function(hqChart, windowIndex, varItem, id)
123137
123168
  {
123138
123169
  var line=new ChartArea();
123139
123170
 
@@ -123189,6 +123220,29 @@ function ScriptIndex(name,script,args,option)
123189
123220
  hqChart.ChartPaint.push(line);
123190
123221
  }
123191
123222
 
123223
+ //标题显示,没有图形
123224
+ this.CreateTitle=function(hqChart, windowIndex, varItem, id)
123225
+ {
123226
+ var chart=new ChartIndexTitle();
123227
+
123228
+ chart.Canvas=hqChart.Canvas;
123229
+ chart.Name=varItem.Name;
123230
+ chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;
123231
+ chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;
123232
+ chart.Identify=this.Guid;
123233
+ if (varItem.Color) chart.Color=this.GetColor(varItem.Color);
123234
+ else chart.Color=this.GetDefaultColor(id);
123235
+ chart.Data.Data=varItem.Data;
123236
+
123237
+ var titleIndex=windowIndex+1;
123238
+ var titleData=new DynamicTitleData(chart.Data,varItem.Name,chart.Color);
123239
+ titleData.DataType="ChartIndexTitle";
123240
+ hqChart.TitlePaint[titleIndex].Data[id]=titleData;
123241
+
123242
+ this.SetChartIndexName(chart);
123243
+ hqChart.ChartPaint.push(chart);
123244
+ }
123245
+
123192
123246
  this.CreateOverlayLine=function(hqChart,windowIndex,varItem,id,lineType)
123193
123247
  {
123194
123248
  if (lineType==7) var line=new ChartStepLine();
@@ -125032,6 +125086,10 @@ function ScriptIndex(name,script,args,option)
125032
125086
  {
125033
125087
  this.CreateArea(hqChart,windowIndex,item,i);
125034
125088
  }
125089
+ else if (item.Type==10) //标题
125090
+ {
125091
+ this.CreateTitle(hqChart,windowIndex,item,i);
125092
+ }
125035
125093
 
125036
125094
  var titlePaint=hqChart.TitlePaint[windowIndex+1];
125037
125095
  if (titlePaint && titlePaint.Data && i<titlePaint.Data.length) //设置标题数值 小数位数和格式
@@ -151242,7 +151300,10 @@ function JSFloatTooltip()
151242
151300
  {
151243
151301
  var data=kItem.Item;
151244
151302
  var symbol=kItem.Symbol;
151245
- var upperSymbol=symbol.toUpperCase();
151303
+ if (data && data.Symbol) symbol=symbol;
151304
+ var upperSymbol="";
151305
+ if (symbol) upperSymbol=symbol.toUpperCase();
151306
+
151246
151307
  var defaultfloatPrecision=GetfloatPrecision(symbol);//价格小数位数
151247
151308
  var unit=MARKET_SUFFIX_NAME.GetVolUnit(upperSymbol);
151248
151309
 
@@ -151254,9 +151315,15 @@ function JSFloatTooltip()
151254
151315
  if (IFrameSplitOperator.IsNumber(data.Time)) timeItem=this.FormatTime(data.Time, this.HQChart.Period, null, 'FloatTooltip-Time');
151255
151316
 
151256
151317
  var overlayItem=null;
151257
- if (kItem.IsOverlay || (kItem.IsIndexKLine && kItem.Name))
151318
+ if (kItem.IsOverlay)
151258
151319
  overlayItem={ Title:"", Text:kItem.Name, Color:this.TextColor, ClassName:this.ValueAlign.Left };
151259
-
151320
+ else if (kItem.IsIndexKLine)
151321
+ {
151322
+ if (kItem.Name)
151323
+ overlayItem={ Title:"", Text:kItem.Name, Color:this.TextColor, ClassName:this.ValueAlign.Left };
151324
+ else if (data && data.Name )
151325
+ overlayItem={ Title:"", Text:data.Name, Color:this.TextColor, ClassName:this.ValueAlign.Left };
151326
+ }
151260
151327
 
151261
151328
 
151262
151329
  var yClose=data.YClose; //昨收价|昨结算价
@@ -153898,7 +153965,7 @@ function HQChartScriptWorker()
153898
153965
 
153899
153966
 
153900
153967
 
153901
- var HQCHART_VERSION="1.1.14486";
153968
+ var HQCHART_VERSION="1.1.14491";
153902
153969
 
153903
153970
  function PrintHQChartVersion()
153904
153971
  {