hqchart 1.1.12720 → 1.1.12725

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.
@@ -1346,10 +1346,10 @@ this.CacheCanvasElement=null;if(bCacheCanvas)this.CacheCanvasElement=document.cr
1346
1346
  this.ModifyIndexDialog=new ModifyIndexDialog(divElement);this.ChangeIndexDialog=new ChangeIndexDialog(divElement);this.MinuteDialog=new MinuteDialog(divElement);//额外的画布
1347
1347
  this.MapExtraCanvasElement=new _map2.default();//key=画布名字, value={ Element:, Canvas:}
1348
1348
  this.CreateExtraCanvasElement=function(name,option){if(this.MapExtraCanvasElement.has(name))return this.MapExtraCanvasElement.get(name);var element=document.createElement("canvas");element.className='jschart-drawing-extra';element.id=Guid();if(name==JSChart.CorssCursorCanvasKey)element.setAttribute("tabindex",5);else element.setAttribute("tabindex",1);if(element.style){element.style.outline='none';element.style.position="absolute";element.style.left='0px';element.style.top='0px';element.style["pointer-events"]="none";}if(option){if(IFrameSplitOperator.IsNumber(option.TabIndex))element.setAttribute("tabindex",option.TabIndex);if(IFrameSplitOperator.IsNumber(option.ZIndex))element.style["z-index"]=option.ZIndex;}divElement.appendChild(element);var item={Element:element,Canvas:null};this.MapExtraCanvasElement.set(name,item);};this.GetExtraCanvas=function(name){if(!this.MapExtraCanvasElement.has(name))return null;var item=this.MapExtraCanvasElement.get(name);if(!item.Element)return null;if(!item.Canvas)item.Canvas=item.Element.getContext("2d");return item;};this.OnSize=function(option)//{ Type:1 新版本OnSize Redraw:是否重绘, XYSplit:是否重新计算分割线 }
1349
- {//画布大小通过div获取
1350
- var height=parseInt(this.DivElement.style.height.replace("px",""));if(this.ToolElement){//TODO调整工具条大小
1349
+ {//画布大小通过div获取 如果有style里的大小 使用style里的
1350
+ if(this.DivElement.style.height&&this.DivElement.style.width){var height=parseInt(this.DivElement.style.height.replace("px",""));var width=parseInt(this.DivElement.style.width.replace("px",""));}else{var height=this.DivElement.offsetHeight;var width=this.DivElement.offsetWidth;}if(this.ToolElement){//TODO调整工具条大小
1351
1351
  height-=this.ToolElement.style.height.replace("px","");//减去工具条的高度
1352
- }this.CanvasElement.height=height;this.CanvasElement.width=parseInt(this.DivElement.style.width.replace("px",""));this.CanvasElement.style.width=this.CanvasElement.width+'px';this.CanvasElement.style.height=this.CanvasElement.height+'px';var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
1352
+ }this.CanvasElement.height=height;this.CanvasElement.width=width;this.CanvasElement.style.width=this.CanvasElement.width+'px';this.CanvasElement.style.height=this.CanvasElement.height+'px';var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
1353
1353
  this.CanvasElement.height*=pixelTatio;this.CanvasElement.width*=pixelTatio;if(this.OffscreenCanvasElement){this.OffscreenCanvasElement.height=this.CanvasElement.height;this.OffscreenCanvasElement.width=this.CanvasElement.width;}if(this.CacheCanvasElement){this.CacheCanvasElement.height=this.CanvasElement.height;this.CacheCanvasElement.width=this.CanvasElement.width;}var _iteratorNormalCompletion=true;var _didIteratorError=false;var _iteratorError=undefined;try{for(var _iterator=(0,_getIterator3.default)(this.MapExtraCanvasElement),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){var mapItem=_step.value;var item=mapItem[1];var element=item.Element;if(!element)continue;element.height=this.CanvasElement.height;element.width=this.CanvasElement.width;element.style.width=this.CanvasElement.style.width;element.style.height=this.CanvasElement.style.height;}}catch(err){_didIteratorError=true;_iteratorError=err;}finally{try{if(!_iteratorNormalCompletion&&_iterator.return){_iterator.return();}}finally{if(_didIteratorError){throw _iteratorError;}}}JSConsole.Chart.Log('[JSChart::OnSize] devicePixelRatio='+window.devicePixelRatio+', height='+this.CanvasElement.height+', width='+this.CanvasElement.width);if(option&&option.Redraw==false)return;if(this.JSChartContainer){if(option&&option.XYSplit===true)this.JSChartContainer.ResetFrameXYSplit();if(this.JSChartContainer.OnSize&&option&&option.Type==1){this.JSChartContainer.OnSize();}else{if(this.JSChartContainer.Frame)this.JSChartContainer.Frame.SetSizeChage(true);this.JSChartContainer.Draw();}}};//手机屏需要调整 间距
1354
1354
  this.AdjustChartBorder=function(chart){var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
1355
1355
  chart.Frame.ChartBorder.Left*=pixelTatio;chart.Frame.ChartBorder.Right*=pixelTatio;chart.Frame.ChartBorder.Top*=pixelTatio;chart.Frame.ChartBorder.Bottom*=pixelTatio;if(chart.Frame.AutoLeftBorder){var item=chart.Frame.AutoLeftBorder;if(IFrameSplitOperator.IsNumber(item.MinWidth))item.MinWidth*=pixelTatio;if(IFrameSplitOperator.IsNumber(item.Blank))item.Blank*=pixelTatio;}if(chart.Frame.AutoRightBorder){var item=chart.Frame.AutoRightBorder;if(IFrameSplitOperator.IsNumber(item.MinWidth))item.MinWidth*=pixelTatio;if(IFrameSplitOperator.IsNumber(item.Blank))item.Blank*=pixelTatio;}};this.AdjustTitleHeight=function(chart){var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
@@ -4083,7 +4083,9 @@ var drawCount=0;var pointCount=0;this.Canvas.save();if(IFrameSplitOperator.IsPlu
4083
4083
  {if(isHScreen){this.Canvas.lineTo(left,x);this.Canvas.lineTo(left,ptFirst.X);this.SetFillStyle(this.AreaColor,this.ChartBorder.GetRightEx(),bottom,this.ChartBorder.GetLeftEx(),bottom);}else{this.Canvas.lineTo(x,bottom);this.Canvas.lineTo(ptFirst.X,bottom);this.SetFillStyle(this.AreaColor,left,this.ChartBorder.GetTopEx(),left,bottom);}this.Canvas.fill();}pointCount=0;drawCount=0;}}if(drawCount>0){if(drawCount==1)//如果线段只有1个点 线段无法画出来 直接画点
4084
4084
  {this.Canvas.beginPath();if(isHScreen)this.Canvas.arc(ptFirst.Y,ptFirst.X,1,0,360,false);else this.Canvas.arc(ptFirst.X,ptFirst.Y,1,0,360,false);this.Canvas.closePath();this.Canvas.fillStyle=this.Color;this.Canvas.fill();}else{this.Canvas.stroke();if(this.IsDrawArea)//画面积
4085
4085
  {if(isHScreen){this.Canvas.lineTo(left,x);this.Canvas.lineTo(left,ptFirst.X);this.SetFillStyle(this.AreaColor,this.ChartBorder.GetRightEx(),bottom,this.ChartBorder.GetLeftEx(),bottom);}else{this.Canvas.lineTo(x,bottom);this.Canvas.lineTo(ptFirst.X,bottom);this.SetFillStyle(this.AreaColor,left,this.ChartBorder.GetTopEx(),left,bottom);}this.Canvas.fill();}}}this.Canvas.restore();this.DrawColorLine();this.DrawAfterClose();//收盘集合竞价
4086
- this.DrawMultiDayAfterClose();if(this.GetEventCallback){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DRAW_MINUTE_LAST_POINT);if(event){var data={LastPoint:{X:this.LastPoint.X,Y:this.LastPoint.Y},Price:this.LastPoint.Price,Data:this.LastPoint.Data};event.Callback(event,data,this);}}};//画领先指标
4086
+ this.DrawMultiDayAfterClose();if(this.GetEventCallback){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DRAW_MINUTE_LAST_POINT);if(event){var pixelRatio=GetDevicePixelRatio();var data={InterLastPoint:{X:this.LastPoint.X,Y:this.LastPoint.Y},//内部点 给画布用
4087
+ LastPoint:{X:this.LastPoint.X/pixelRatio,Y:this.LastPoint.Y/pixelRatio},//外部点 给DOM用
4088
+ Price:this.LastPoint.Price,Data:this.LastPoint.Data,PixelRatio:pixelRatio};event.Callback(event,data,this);}}};//画领先指标
4087
4089
  this.DrawLead=function(){if(!this.LeadData)return;var isHScreen=this.ChartFrame.IsHScreen===true;//if (isHScreen) return;
4088
4090
  //var dataWidth=this.ChartFrame.DataWidth;
4089
4091
  //var distanceWidth=this.ChartFrame.DistanceWidth;
@@ -12893,7 +12895,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
12893
12895
  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);};}/********************************************************************************
12894
12896
  * 版本信息输出
12895
12897
  *
12896
- */var HQCHART_VERSION="1.1.12718";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();//把给外界调用的方法暴露出来
12898
+ */var HQCHART_VERSION="1.1.12724";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();//把给外界调用的方法暴露出来
12897
12899
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
12898
12900
  // BaseIndex:BaseIndex,
12899
12901
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.12720",
3
+ "version": "1.1.12725",
4
4
  "description": "stock chart",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -4251,8 +4251,18 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4251
4251
 
4252
4252
  this.OnSize=function(option) //{ Type:1 新版本OnSize Redraw:是否重绘, XYSplit:是否重新计算分割线 }
4253
4253
  {
4254
- //画布大小通过div获取
4255
- var height=parseInt(this.DivElement.style.height.replace("px",""));
4254
+ //画布大小通过div获取 如果有style里的大小 使用style里的
4255
+ if (this.DivElement.style.height && this.DivElement.style.width)
4256
+ {
4257
+ var height=parseInt(this.DivElement.style.height.replace("px",""));
4258
+ var width=parseInt(this.DivElement.style.width.replace("px",""));
4259
+ }
4260
+ else
4261
+ {
4262
+ var height=this.DivElement.offsetHeight;
4263
+ var width=this.DivElement.offsetWidth;
4264
+ }
4265
+
4256
4266
  if (this.ToolElement)
4257
4267
  {
4258
4268
  //TODO调整工具条大小
@@ -4260,7 +4270,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4260
4270
  }
4261
4271
 
4262
4272
  this.CanvasElement.height=height;
4263
- this.CanvasElement.width=parseInt(this.DivElement.style.width.replace("px",""));
4273
+ this.CanvasElement.width=width;
4264
4274
  this.CanvasElement.style.width=this.CanvasElement.width+'px';
4265
4275
  this.CanvasElement.style.height=this.CanvasElement.height+'px';
4266
4276
 
@@ -36082,7 +36092,14 @@ function ChartMinutePriceLine()
36082
36092
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DRAW_MINUTE_LAST_POINT);
36083
36093
  if (event)
36084
36094
  {
36085
- var data={ LastPoint:{X:this.LastPoint.X, Y:this.LastPoint.Y}, Price:this.LastPoint.Price, Data:this.LastPoint.Data };
36095
+ var pixelRatio=GetDevicePixelRatio();
36096
+ var data=
36097
+ {
36098
+ InterLastPoint:{X:this.LastPoint.X, Y:this.LastPoint.Y}, //内部点 给画布用
36099
+ LastPoint:{X:this.LastPoint.X/pixelRatio, Y:this.LastPoint.Y/pixelRatio}, //外部点 给DOM用
36100
+ Price:this.LastPoint.Price, Data:this.LastPoint.Data,
36101
+ PixelRatio:pixelRatio,
36102
+ };
36086
36103
  event.Callback(event,data,this);
36087
36104
  }
36088
36105
  }
@@ -130952,7 +130969,7 @@ function ScrollBarBGChart()
130952
130969
 
130953
130970
 
130954
130971
 
130955
- var HQCHART_VERSION="1.1.12718";
130972
+ var HQCHART_VERSION="1.1.12724";
130956
130973
 
130957
130974
  function PrintHQChartVersion()
130958
130975
  {
@@ -4295,8 +4295,18 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4295
4295
 
4296
4296
  this.OnSize=function(option) //{ Type:1 新版本OnSize Redraw:是否重绘, XYSplit:是否重新计算分割线 }
4297
4297
  {
4298
- //画布大小通过div获取
4299
- var height=parseInt(this.DivElement.style.height.replace("px",""));
4298
+ //画布大小通过div获取 如果有style里的大小 使用style里的
4299
+ if (this.DivElement.style.height && this.DivElement.style.width)
4300
+ {
4301
+ var height=parseInt(this.DivElement.style.height.replace("px",""));
4302
+ var width=parseInt(this.DivElement.style.width.replace("px",""));
4303
+ }
4304
+ else
4305
+ {
4306
+ var height=this.DivElement.offsetHeight;
4307
+ var width=this.DivElement.offsetWidth;
4308
+ }
4309
+
4300
4310
  if (this.ToolElement)
4301
4311
  {
4302
4312
  //TODO调整工具条大小
@@ -4304,7 +4314,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4304
4314
  }
4305
4315
 
4306
4316
  this.CanvasElement.height=height;
4307
- this.CanvasElement.width=parseInt(this.DivElement.style.width.replace("px",""));
4317
+ this.CanvasElement.width=width;
4308
4318
  this.CanvasElement.style.width=this.CanvasElement.width+'px';
4309
4319
  this.CanvasElement.style.height=this.CanvasElement.height+'px';
4310
4320
 
@@ -36126,7 +36136,14 @@ function ChartMinutePriceLine()
36126
36136
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DRAW_MINUTE_LAST_POINT);
36127
36137
  if (event)
36128
36138
  {
36129
- var data={ LastPoint:{X:this.LastPoint.X, Y:this.LastPoint.Y}, Price:this.LastPoint.Price, Data:this.LastPoint.Data };
36139
+ var pixelRatio=GetDevicePixelRatio();
36140
+ var data=
36141
+ {
36142
+ InterLastPoint:{X:this.LastPoint.X, Y:this.LastPoint.Y}, //内部点 给画布用
36143
+ LastPoint:{X:this.LastPoint.X/pixelRatio, Y:this.LastPoint.Y/pixelRatio}, //外部点 给DOM用
36144
+ Price:this.LastPoint.Price, Data:this.LastPoint.Data,
36145
+ PixelRatio:pixelRatio,
36146
+ };
36130
36147
  event.Callback(event,data,this);
36131
36148
  }
36132
36149
  }
@@ -131110,7 +131127,7 @@ function HQChartScriptWorker()
131110
131127
 
131111
131128
 
131112
131129
 
131113
- var HQCHART_VERSION="1.1.12718";
131130
+ var HQCHART_VERSION="1.1.12724";
131114
131131
 
131115
131132
  function PrintHQChartVersion()
131116
131133
  {