hqchart 1.1.13120 → 1.1.13123

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.
@@ -12079,7 +12079,7 @@ this.CanvasElement=document.createElement("canvas");this.CanvasElement.className
12079
12079
  var height=parseInt(this.DivElement.style.height.replace("px",""));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();//获取设备的分辨率
12080
12080
  this.CanvasElement.height*=pixelTatio;this.CanvasElement.width*=pixelTatio;JSConsole.Chart.Log('[JSReportChart::OnSize] devicePixelRatio='+window.devicePixelRatio+', height='+this.CanvasElement.height+', width='+this.CanvasElement.width);if(this.JSChartContainer&&this.JSChartContainer.OnSize){this.JSChartContainer.OnSize();}};this.SetOption=function(option){var chart=this.CreateJSReportChartContainer(option);if(!chart)return false;if(option.OnCreatedCallback)option.OnCreatedCallback(chart);this.JSChartContainer=chart;this.DivElement.JSChart=this;//div中保存一份
12081
12081
  if(option.Symbol)chart.Symbol=option.Symbol;if(option.Name)chart.Name=option.Name;var requestOption={Callback:null};if(chart.Symbol)requestOption.Callback=function(){chart.RequestMemberListData();};chart.RequestStockListData(requestOption);//下载码表
12082
- };this.CreateJSReportChartContainer=function(option){var chart=new JSReportChartContainer(this.CanvasElement);chart.Create(option);if(option.NetworkFilter)chart.NetworkFilter=option.NetworkFilter;if(IFrameSplitOperator.IsNonEmptyArray(option.Column))chart.SetColumn(option.Column);if(IFrameSplitOperator.IsNonEmptyArray(option.Tab))chart.SetTab(option.Tab);if(IFrameSplitOperator.IsNumber(option.TabSelected))chart.SetSelectedTab(option.TabSelected);if(IFrameSplitOperator.IsBool(option.EnableDragRow))chart.EnableDragRow=option.EnableDragRow;if(IFrameSplitOperator.IsNumber(option.DragRowType))chart.DragRowType=option.DragRowType;if(IFrameSplitOperator.IsBool(option.EnableDragHeader))chart.EnableDragHeader=option.EnableDragHeader;if(option.VScrollbar)chart.SetVScrollbar(option.VScrollbar);if(option.SortInfo){var item=option.SortInfo;if(IFrameSplitOperator.IsNumber(item.Field))chart.SortInfo.Field=item.Field;if(IFrameSplitOperator.IsNumber(item.Sort))chart.SortInfo.Sort=item.Sort;}this.SetChartBorder(chart,option);//是否自动更新
12082
+ };this.CreateJSReportChartContainer=function(option){var chart=new JSReportChartContainer(this.CanvasElement);chart.Create(option);if(option.NetworkFilter)chart.NetworkFilter=option.NetworkFilter;if(IFrameSplitOperator.IsNonEmptyArray(option.Column))chart.SetColumn(option.Column);if(IFrameSplitOperator.IsNonEmptyArray(option.Tab))chart.SetTab(option.Tab);if(IFrameSplitOperator.IsNumber(option.TabSelected))chart.SetSelectedTab(option.TabSelected);if(IFrameSplitOperator.IsBool(option.EnableDragRow))chart.EnableDragRow=option.EnableDragRow;if(IFrameSplitOperator.IsNumber(option.DragRowType))chart.DragRowType=option.DragRowType;if(IFrameSplitOperator.IsBool(option.EnableDragHeader))chart.EnableDragHeader=option.EnableDragHeader;if(option.VScrollbar)chart.SetVScrollbar(option.VScrollbar);if(option.SortInfo){var item=option.SortInfo;if(IFrameSplitOperator.IsNumber(item.Field))chart.SortInfo.Field=item.Field;if(IFrameSplitOperator.IsNumber(item.Sort))chart.SortInfo.Sort=item.Sort;}var reportChart=chart.GetReportChart();if(reportChart){if(IFrameSplitOperator.IsNumber(option.TextOverflowStyle))reportChart.TextOverflowStyle=option.TextOverflowStyle;}this.SetChartBorder(chart,option);//是否自动更新
12083
12083
  if(option.IsAutoUpdate!=null)chart.IsAutoUpdate=option.IsAutoUpdate;if(option.AutoUpdateFrequency>0)chart.AutoUpdateFrequency=option.AutoUpdateFrequency;if(IFrameSplitOperator.IsBool(option.EnableFilter))chart.EnableFilter=option.EnableFilter;//注册事件
12084
12084
  if(option.EventCallback){for(var i=0;i<option.EventCallback.length;++i){var item=option.EventCallback[i];chart.AddEventCallback(item);}}return chart;};this.SetChartBorder=function(chart,option){if(!option.Border)return;var item=option.Border;if(IFrameSplitOperator.IsNumber(option.Border.Left))chart.Frame.ChartBorder.Left=option.Border.Left;if(IFrameSplitOperator.IsNumber(option.Border.Right))chart.Frame.ChartBorder.Right=option.Border.Right;if(IFrameSplitOperator.IsNumber(option.Border.Top))chart.Frame.ChartBorder.Top=option.Border.Top;if(IFrameSplitOperator.IsNumber(option.Border.Bottom))chart.Frame.ChartBorder.Bottom=option.Border.Bottom;var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
12085
12085
  chart.Frame.ChartBorder.Left*=pixelTatio;chart.Frame.ChartBorder.Right*=pixelTatio;chart.Frame.ChartBorder.Top*=pixelTatio;chart.Frame.ChartBorder.Bottom*=pixelTatio;};/////////////////////////////////////////////////////////////////////////////
@@ -12361,7 +12361,8 @@ this.SelectedFixedRow=-1;//选中固定行ID
12361
12361
  this.IsDrawBorder=1;//是否绘制单元格边框
12362
12362
  this.ShowSymbol=[];//显示的股票列表 { Index:序号(排序用), Symbol:股票代码 }
12363
12363
  this.DragRow;//拖拽行
12364
- this.Tab;this.VScrollbar;this.GlobalOption;//涨跌颜色
12364
+ this.Tab;this.VScrollbar;this.GlobalOption;this.TextOverflowStyle=0;//输出内容比单元格长度大 0=裁剪 1=输出"####"
12365
+ //涨跌颜色
12365
12366
  this.UpColor=g_JSChartResource.Report.UpTextColor;this.DownColor=g_JSChartResource.Report.DownTextColor;this.UnchagneColor=g_JSChartResource.Report.UnchagneTextColor;this.BorderColor=g_JSChartResource.Report.BorderColor;//边框线
12366
12367
  this.SelectedColor=g_JSChartResource.Report.SelectedColor;//选中行
12367
12368
  //表头配置
@@ -12432,8 +12433,9 @@ switch(column.ColorType){case 1:drawInfo.TextColor=this.GetUpDownColor(value,0);
12432
12433
  this.GetCustomIconData=function(columnInfo,symbol,drawInfo,data){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_DRAW_CUSTOM_ICON);if(!event||!event.Callback)return false;var sendData={Symbol:symbol,Column:columnInfo,Data:data,Out:{Text:null,TextColor:null,TextAlign:null,Font:null}};event.Callback(event,sendData,this);if(sendData.Out.Text)drawInfo.Text=sendData.Out.Text;if(sendData.Out.TextColor)drawInfo.TextColor=sendData.Out.TextColor;if(sendData.Out.TextAlign)drawInfo.TextAlign=sendData.Out.TextAlign;if(sendData.Out.BGColor)drawInfo.BGColor=sendData.Out.BGColor;if(sendData.Out.Font)drawInfo.Font=sendData.Out.Font;return true;};this.GetPriceDrawInfo=function(price,stock,data,drawInfo,option){if(!IFrameSplitOperator.IsNumber(price))return false;drawInfo.Text=price.toFixed(data.Decimal);if(!IFrameSplitOperator.IsNumber(stock.YClose))drawInfo.TextColor=this.UnchagneColor;else drawInfo.TextColor=this.GetUpDownColor(price,stock.YClose);if(option&&option.LimitBG){if(IFrameSplitOperator.IsNumber(stock.LimitHigh)){if(price>=stock.LimitHigh){drawInfo.BGColor=this.LimitUpBGColor;drawInfo.TextColor=this.LimitTextColor;}}if(IFrameSplitOperator.IsNumber(stock.LimitLow)){if(price<=stock.LimitLow){drawInfo.BGColor=this.LimitDownBGColor;drawInfo.TextColor=this.LimitTextColor;}}}};this.GetUpDownColor=function(price,price2){if(price>price2)return this.UpColor;else if(price<price2)return this.DownColor;else return this.UnchagneColor;};//单独处理成交量显示
12433
12434
  this.FormatVolString=function(value,languageID){return IFrameSplitOperator.FormatVolString(value,languageID);};this.DrawItemBG=function(drawInfo){if(drawInfo.BGColor&&drawInfo.Rect)//绘制背景色
12434
12435
  {var rtItem=drawInfo.Rect;this.Canvas.fillStyle=drawInfo.BGColor;this.Canvas.fillRect(rtItem.Left,rtItem.Top,rtItem.Width,rtItem.Height);//画一个背景色, 不然是一个黑的背景
12435
- }};this.DrawItemText=function(text,textColor,textAlign,left,top,width,bgColor){if(!text)return;var x=left;if(textAlign=='center'){x=left+width/2;this.Canvas.textAlign="center";}else if(textAlign=='right'){x=left+width-2;this.Canvas.textAlign="right";}else{x+=2;this.Canvas.textAlign="left";}var textWidth=this.Canvas.measureText(text).width+1;var bClip=false;if(textWidth>=width){this.Canvas.save();bClip=true;var rtCell={Left:left,Top:top+this.ItemMergin.Top,Width:width,Height:this.RowHeight};this.Canvas.beginPath();this.Canvas.rect(rtCell.Left,rtCell.Top,rtCell.Width,rtCell.Height);//this.Canvas.stroke(); //调试用
12436
- this.Canvas.clip();}this.Canvas.textBaseline="middle";this.Canvas.fillStyle=textColor;this.Canvas.fillText(text,x,top+this.ItemMergin.Top+this.RowHeight/2);if(bClip)this.Canvas.restore();};//{ Text:, Symbol:{ Family:'iconfont', Size:, Data:[ { Text:'\ue631', Color:'#1c65db'}, ...] } ]}
12436
+ }};this.DrawItemText=function(text,textColor,textAlign,left,top,width,bgColor){if(!text)return;var x=left;if(textAlign=='center'){x=left+width/2;this.Canvas.textAlign="center";}else if(textAlign=='right'){x=left+width-2;this.Canvas.textAlign="right";}else{x+=2;this.Canvas.textAlign="left";}var textWidth=this.Canvas.measureText(text).width+1;var bClip=false;if(textWidth>=width)//长度超过单元格 裁剪
12437
+ {this.Canvas.save();bClip=true;var rtCell={Left:left,Top:top+this.ItemMergin.Top,Width:width,Height:this.RowHeight};this.Canvas.beginPath();this.Canvas.rect(rtCell.Left,rtCell.Top,rtCell.Width,rtCell.Height);//this.Canvas.stroke(); //调试用
12438
+ this.Canvas.clip();if(this.TextOverflowStyle==1){var count=text.length+5;text="";for(var i=0;i<count;++i){text+="#";}}}this.Canvas.textBaseline="middle";this.Canvas.fillStyle=textColor;this.Canvas.fillText(text,x,top+this.ItemMergin.Top+this.RowHeight/2);if(bClip)this.Canvas.restore();};//{ Text:, Symbol:{ Family:'iconfont', Size:, Data:[ { Text:'\ue631', Color:'#1c65db'}, ...] } ]}
12437
12439
  this.DrawItemTextEx=function(drawInfo,left,top,width){var text=drawInfo.Text;var clrText=drawInfo.TextColor;var symbol=drawInfo.Symbol;//符号
12438
12440
  var textAlign=drawInfo.TextAlign;var textWidth=this.Canvas.measureText(text).width+1;;var totalWidth=textWidth;var font=symbol.Size*GetDevicePixelRatio()+'px '+symbol.Family;this.Canvas.font=font;var aryIconWidth=[];for(var i=0;i<symbol.Data.length;++i){var item=symbol.Data[i];var iconWidth=this.Canvas.measureText(item.Text).width+1;if(totalWidth+iconWidth>width)break;totalWidth+=iconWidth;aryIconWidth[i]=iconWidth;}var x=left;var y=top+this.ItemMergin.Top+this.RowHeight/2;if(textAlign=='center'){x=left+(width-totalWidth)/2;}else if(textAlign=='right'){x=left+(width-totalWidth);}else{x+=2;}this.Canvas.textBaseline="middle";this.Canvas.textAlign="left";this.Canvas.font=this.ItemFont;this.Canvas.fillStyle=clrText;this.Canvas.fillText(text,x,y);x+=textWidth;this.Canvas.font=font;for(var i=0;i<aryIconWidth.length;++i){var item=symbol.Data[i];this.Canvas.fillStyle=item.Color;this.Canvas.fillText(item.Text,x,y);x+=aryIconWidth[i];}this.Canvas.font=this.ItemFont;};this.DrawIconItem=function(drawInfo,left,top,width){if(!drawInfo||!drawInfo.Font||!drawInfo.Text)return;var text=drawInfo.Text;var clrText=drawInfo.TextColor;var textAlign=drawInfo.TextAlign;this.Canvas.font=drawInfo.Font;var textWidth=this.Canvas.measureText(text).width+1;;var x=left;var y=top+this.ItemMergin.Top+this.RowHeight/2;if(textAlign=='center'){x=left+(width-textWidth)/2;}else if(textAlign=='right'){x=left+(width-textWidth);}else{x+=2;}this.Canvas.textBaseline="middle";this.Canvas.textAlign="left";this.Canvas.fillStyle=clrText;this.Canvas.fillText(text,x,y);this.Canvas.font=this.ItemFont;};//字体由外面设置
12439
12441
  this.TextEllipsis=function(text,maxWidth,maxText){if(!text)return null;if(text.length<maxText.length)return text;var start=maxText.length-3;if(start<0)return null;var newText=text.slice(0,start);for(var i=start;i<text.length;++i){var value=newText+text[i]+"...";var width=this.Canvas.measureText(value).width;if(width>maxWidth){newText+="...";break;}newText+=text[i];}return newText;};this.DrawMultiBar=function(colunmInfo,data,rtItem){if(!data.Source||!IFrameSplitOperator.IsNonEmptyArray(data.Source))return false;var barData=data.Source[colunmInfo.DataIndex];//{ Value:[0.4,0,2], Color:[0,1] };
@@ -13034,7 +13036,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
13034
13036
  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);};}/********************************************************************************
13035
13037
  * 版本信息输出
13036
13038
  *
13037
- */var HQCHART_VERSION="1.1.13119";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();//把给外界调用的方法暴露出来
13039
+ */var HQCHART_VERSION="1.1.13122";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();//把给外界调用的方法暴露出来
13038
13040
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
13039
13041
  // BaseIndex:BaseIndex,
13040
13042
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.13120",
3
+ "version": "1.1.13123",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -90,6 +90,12 @@ function JSReportChart(divElement)
90
90
  if (IFrameSplitOperator.IsNumber(item.Sort)) chart.SortInfo.Sort=item.Sort;
91
91
  }
92
92
 
93
+ var reportChart=chart.GetReportChart();
94
+ if (reportChart)
95
+ {
96
+ if (IFrameSplitOperator.IsNumber(option.TextOverflowStyle)) reportChart.TextOverflowStyle=option.TextOverflowStyle;
97
+ }
98
+
93
99
  this.SetChartBorder(chart, option);
94
100
 
95
101
  //是否自动更新
@@ -3192,6 +3198,7 @@ function ChartReport()
3192
3198
  this.VScrollbar;
3193
3199
 
3194
3200
  this.GlobalOption;
3201
+ this.TextOverflowStyle=0; //输出内容比单元格长度大 0=裁剪 1=输出"####"
3195
3202
 
3196
3203
  //涨跌颜色
3197
3204
  this.UpColor=g_JSChartResource.Report.UpTextColor;
@@ -4613,7 +4620,7 @@ function ChartReport()
4613
4620
 
4614
4621
  var textWidth=this.Canvas.measureText(text).width+1;
4615
4622
  var bClip=false;
4616
- if (textWidth>=width)
4623
+ if (textWidth>=width) //长度超过单元格 裁剪
4617
4624
  {
4618
4625
  this.Canvas.save();
4619
4626
  bClip=true;
@@ -4623,6 +4630,16 @@ function ChartReport()
4623
4630
  this.Canvas.rect(rtCell.Left, rtCell.Top, rtCell.Width, rtCell.Height);
4624
4631
  //this.Canvas.stroke(); //调试用
4625
4632
  this.Canvas.clip();
4633
+
4634
+ if (this.TextOverflowStyle==1)
4635
+ {
4636
+ var count=text.length+5;
4637
+ text="";
4638
+ for(var i=0;i<count;++i)
4639
+ {
4640
+ text+="#";
4641
+ }
4642
+ }
4626
4643
  }
4627
4644
 
4628
4645
  this.Canvas.textBaseline="middle";
@@ -122403,6 +122403,12 @@ function JSReportChart(divElement)
122403
122403
  if (IFrameSplitOperator.IsNumber(item.Sort)) chart.SortInfo.Sort=item.Sort;
122404
122404
  }
122405
122405
 
122406
+ var reportChart=chart.GetReportChart();
122407
+ if (reportChart)
122408
+ {
122409
+ if (IFrameSplitOperator.IsNumber(option.TextOverflowStyle)) reportChart.TextOverflowStyle=option.TextOverflowStyle;
122410
+ }
122411
+
122406
122412
  this.SetChartBorder(chart, option);
122407
122413
 
122408
122414
  //是否自动更新
@@ -125505,6 +125511,7 @@ function ChartReport()
125505
125511
  this.VScrollbar;
125506
125512
 
125507
125513
  this.GlobalOption;
125514
+ this.TextOverflowStyle=0; //输出内容比单元格长度大 0=裁剪 1=输出"####"
125508
125515
 
125509
125516
  //涨跌颜色
125510
125517
  this.UpColor=g_JSChartResource.Report.UpTextColor;
@@ -126926,7 +126933,7 @@ function ChartReport()
126926
126933
 
126927
126934
  var textWidth=this.Canvas.measureText(text).width+1;
126928
126935
  var bClip=false;
126929
- if (textWidth>=width)
126936
+ if (textWidth>=width) //长度超过单元格 裁剪
126930
126937
  {
126931
126938
  this.Canvas.save();
126932
126939
  bClip=true;
@@ -126936,6 +126943,16 @@ function ChartReport()
126936
126943
  this.Canvas.rect(rtCell.Left, rtCell.Top, rtCell.Width, rtCell.Height);
126937
126944
  //this.Canvas.stroke(); //调试用
126938
126945
  this.Canvas.clip();
126946
+
126947
+ if (this.TextOverflowStyle==1)
126948
+ {
126949
+ var count=text.length+5;
126950
+ text="";
126951
+ for(var i=0;i<count;++i)
126952
+ {
126953
+ text+="#";
126954
+ }
126955
+ }
126939
126956
  }
126940
126957
 
126941
126958
  this.Canvas.textBaseline="middle";
@@ -131473,7 +131490,7 @@ function ScrollBarBGChart()
131473
131490
 
131474
131491
 
131475
131492
 
131476
- var HQCHART_VERSION="1.1.13119";
131493
+ var HQCHART_VERSION="1.1.13122";
131477
131494
 
131478
131495
  function PrintHQChartVersion()
131479
131496
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13119";
8
+ var HQCHART_VERSION="1.1.13122";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -122447,6 +122447,12 @@ function JSReportChart(divElement)
122447
122447
  if (IFrameSplitOperator.IsNumber(item.Sort)) chart.SortInfo.Sort=item.Sort;
122448
122448
  }
122449
122449
 
122450
+ var reportChart=chart.GetReportChart();
122451
+ if (reportChart)
122452
+ {
122453
+ if (IFrameSplitOperator.IsNumber(option.TextOverflowStyle)) reportChart.TextOverflowStyle=option.TextOverflowStyle;
122454
+ }
122455
+
122450
122456
  this.SetChartBorder(chart, option);
122451
122457
 
122452
122458
  //是否自动更新
@@ -125549,6 +125555,7 @@ function ChartReport()
125549
125555
  this.VScrollbar;
125550
125556
 
125551
125557
  this.GlobalOption;
125558
+ this.TextOverflowStyle=0; //输出内容比单元格长度大 0=裁剪 1=输出"####"
125552
125559
 
125553
125560
  //涨跌颜色
125554
125561
  this.UpColor=g_JSChartResource.Report.UpTextColor;
@@ -126970,7 +126977,7 @@ function ChartReport()
126970
126977
 
126971
126978
  var textWidth=this.Canvas.measureText(text).width+1;
126972
126979
  var bClip=false;
126973
- if (textWidth>=width)
126980
+ if (textWidth>=width) //长度超过单元格 裁剪
126974
126981
  {
126975
126982
  this.Canvas.save();
126976
126983
  bClip=true;
@@ -126980,6 +126987,16 @@ function ChartReport()
126980
126987
  this.Canvas.rect(rtCell.Left, rtCell.Top, rtCell.Width, rtCell.Height);
126981
126988
  //this.Canvas.stroke(); //调试用
126982
126989
  this.Canvas.clip();
126990
+
126991
+ if (this.TextOverflowStyle==1)
126992
+ {
126993
+ var count=text.length+5;
126994
+ text="";
126995
+ for(var i=0;i<count;++i)
126996
+ {
126997
+ text+="#";
126998
+ }
126999
+ }
126983
127000
  }
126984
127001
 
126985
127002
  this.Canvas.textBaseline="middle";
@@ -134037,7 +134054,7 @@ function HQChartScriptWorker()
134037
134054
 
134038
134055
 
134039
134056
 
134040
- var HQCHART_VERSION="1.1.13119";
134057
+ var HQCHART_VERSION="1.1.13122";
134041
134058
 
134042
134059
  function PrintHQChartVersion()
134043
134060
  {