hqchart 1.1.14683 → 1.1.14691

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.
@@ -221,6 +221,7 @@ function JSReportChart(divElement)
221
221
  {
222
222
  if (IFrameSplitOperator.IsNumber(option.TextOverflowStyle)) reportChart.TextOverflowStyle=option.TextOverflowStyle;
223
223
  if (IFrameSplitOperator.IsNumber(option.MultiSelectModel)) reportChart.MultiSelectModel=option.MultiSelectModel;
224
+ if (IFrameSplitOperator.IsNumber(option.SelectedStyle)) reportChart.SelectedStyle=option.SelectedStyle;
224
225
  }
225
226
 
226
227
  this.SetChartBorder(chart, option);
@@ -4731,6 +4732,7 @@ function ChartReport()
4731
4732
  this.SelectedModel=0; //选中模式 0=SelectedRow表示当前屏索引
4732
4733
  this.SelectedRow=-1; //选中行ID
4733
4734
  this.SelectedFixedRow=-1; //选中固定行ID
4735
+ this.SelectedStyle=1; //选中行样式 1=整行填充 2=底部绘制直线
4734
4736
  this.IsDrawBorder=1; //是否绘制单元格边框
4735
4737
  this.HeaderRowCount=1; //表头行数
4736
4738
 
@@ -4755,6 +4757,7 @@ function ChartReport()
4755
4757
 
4756
4758
  this.BorderColor=g_JSChartResource.Report.BorderColor; //边框线
4757
4759
  this.SelectedColor=g_JSChartResource.Report.SelectedColor; //选中行
4760
+ this.SelectedLineConfig={ Color:g_JSChartResource.Report.SelectedLine.Color, Width:g_JSChartResource.Report.SelectedLine.Width }; //选中行底部线段
4758
4761
 
4759
4762
  //表头配置
4760
4763
  this.HeaderFontConfig={ Size:g_JSChartResource.Report.Header.Font.Size, Name:g_JSChartResource.Report.Header.Font.Name };
@@ -4875,6 +4878,8 @@ function ChartReport()
4875
4878
  this.IsShowAllColumn=false; //是否已显示所有列
4876
4879
  this.DevicePixelRatio=GetDevicePixelRatio(); //分辨率
4877
4880
 
4881
+ this.AryFullSelectedRow=[]; //选中行
4882
+
4878
4883
  //{
4879
4884
  // Type:列id, Title:标题, TextAlign:文字对齐方式, MaxText:文字最大宽度 , TextColor:文字颜色, Sort:0=不支持排序 1=本地排序 0=远程排序,
4880
4885
  // Icon:{ Family:"iconfont", Size:12, Symbol:"", Margin: { Left:, Bottom }}
@@ -5019,8 +5024,11 @@ function ChartReport()
5019
5024
  if (IFrameSplitOperator.IsNumber(item.Sort)) colItem.Sort=item.Sort;
5020
5025
  if (IFrameSplitOperator.IsNumber(item.FixedWidth)) colItem.FixedWidth=item.FixedWidth;
5021
5026
  if (IFrameSplitOperator.IsBool(item.EnableDragWidth)) colItem.EnableDragWidth=item.EnableDragWidth;
5027
+
5028
+ colItem.IsDrawCallback=false;
5022
5029
  if (IFrameSplitOperator.IsBool(item.IsDrawCallback)) colItem.IsDrawCallback=item.IsDrawCallback;
5023
- else colItem.IsDrawCallback=false;
5030
+
5031
+ if (IFrameSplitOperator.IsBool(item.EnableFormatDrawInfoEvent)) colItem.EnableFormatDrawInfoEvent=item.EnableFormatDrawInfoEvent;
5024
5032
 
5025
5033
  if (IFrameSplitOperator.IsNumber(item.FloatPrecision)) colItem.FloatPrecision=item.FloatPrecision; //小数位数
5026
5034
  if (IFrameSplitOperator.IsNumber(item.ColorType)) colItem.ColorType=item.ColorType; //0=默认 1=(>0, =0, <0) 2=(>=0, <0)
@@ -5362,6 +5370,7 @@ function ChartReport()
5362
5370
  this.ShowSymbol=[];
5363
5371
  this.TooltipRect=[];
5364
5372
  this.ButtonRect=[];
5373
+ this.AryFullSelectedRow=[];
5365
5374
  this.DevicePixelRatio=GetDevicePixelRatio()
5366
5375
  this.LastMouseStatus=lastMouseStatus;
5367
5376
 
@@ -5386,6 +5395,7 @@ function ChartReport()
5386
5395
 
5387
5396
  this.ClipClient();
5388
5397
  this.DrawBorder();
5398
+ this.DrawSelectedRow();
5389
5399
  this.Canvas.restore();
5390
5400
 
5391
5401
  this.DrawDragRow();
@@ -5400,6 +5410,7 @@ function ChartReport()
5400
5410
 
5401
5411
  this.LastMouseStatus=null;
5402
5412
  this.SizeChange=false;
5413
+ this.AryFullSelectedRow=[];
5403
5414
  }
5404
5415
 
5405
5416
  this.DrawDragHeaderBG=function()
@@ -5942,6 +5953,8 @@ function ChartReport()
5942
5953
  var left=this.RectClient.Left;
5943
5954
  var rowWidth=this.RectClient.Right-this.RectClient.Left;
5944
5955
 
5956
+ var arySelectedRow=[];
5957
+
5945
5958
  //固定行
5946
5959
  var textTop=top;
5947
5960
  this.Canvas.font=this.ItemFixedFont;
@@ -6033,8 +6046,16 @@ function ChartReport()
6033
6046
 
6034
6047
  if (bFillRow)
6035
6048
  {
6036
- this.Canvas.fillStyle=this.SelectedColor;
6037
- this.Canvas.fillRect(left,textTop,rowWidth,this.RowHeight);
6049
+ var rtRowBG={ Left:left, Top:textTop, Width:rowWidth, Height:this.RowHeight };
6050
+ rtRowBG.Right=rtRowBG.Left+rtRowBG.Width;
6051
+ rtRowBG.Bottom=rtRowBG.Top+rtRowBG.Height;
6052
+ this.AryFullSelectedRow.push(rtRowBG);
6053
+
6054
+ if (this.SelectedStyle===1)
6055
+ {
6056
+ this.Canvas.fillStyle=this.SelectedColor;
6057
+ this.Canvas.fillRect(rtRowBG.Left,rtRowBG.Top,rtRowBG.Width,rtRowBG.Height);
6058
+ }
6038
6059
  }
6039
6060
 
6040
6061
  this.DrawRow(symbol, textTop, i);
@@ -6043,6 +6064,22 @@ function ChartReport()
6043
6064
 
6044
6065
  textTop+=this.RowHeight;
6045
6066
  }
6067
+
6068
+
6069
+ }
6070
+
6071
+ this.DrawSelectedRow=function()
6072
+ {
6073
+ if (this.SelectedStyle===2 && IFrameSplitOperator.IsNonEmptyArray(this.AryFullSelectedRow))
6074
+ {
6075
+ this.Canvas.fillStyle=this.SelectedLineConfig.Color;
6076
+ var lineWidth=this.SelectedLineConfig.Width;
6077
+ for(var i=0;i<this.AryFullSelectedRow.length;++i)
6078
+ {
6079
+ var rtBG=this.AryFullSelectedRow[i];
6080
+ this.Canvas.fillRect(rtBG.Left,rtBG.Bottom-lineWidth,rtBG.Width,lineWidth);
6081
+ }
6082
+ }
6046
6083
  }
6047
6084
 
6048
6085
  this.GetSelectedSymbol=function()
@@ -6484,10 +6521,12 @@ function ChartReport()
6484
6521
  else if (column.Type==REPORT_COLUMN_ID.CUSTOM_NUMBER_TEXT_ID)
6485
6522
  {
6486
6523
  this.GetCustomNumberDrawInfo(data, column, drawInfo);
6524
+ this.FormatDrawInfoEvent(stock, data, column, drawInfo);
6487
6525
  }
6488
6526
  else if (column.Type==REPORT_COLUMN_ID.CUSTOM_DATETIME_TEXT_ID)
6489
6527
  {
6490
6528
  this.GetCustomDateTimeDrawInfo(data, column, drawInfo);
6529
+ this.FormatDrawInfoEvent(stock, data, column, drawInfo);
6491
6530
  }
6492
6531
  else if (column.Type==REPORT_COLUMN_ID.CUSTOM_ICON_ID)
6493
6532
  {
@@ -6510,10 +6549,12 @@ function ChartReport()
6510
6549
  else if (column.Type==REPORT_COLUMN_ID.TIME_ID)
6511
6550
  {
6512
6551
  this.FormaTimeDrawInfo(column, stock, drawInfo, data);
6552
+ this.FormatDrawInfoEvent(stock, data, column, drawInfo);
6513
6553
  }
6514
6554
  else if (column.Type==REPORT_COLUMN_ID.DATE_ID)
6515
6555
  {
6516
6556
  this.FormaDateDrawInfo(column, stock, drawInfo, data);
6557
+ this.FormatDrawInfoEvent(stock, data, column, drawInfo);
6517
6558
  }
6518
6559
  else if (column.Type==REPORT_COLUMN_ID.CHECKBOX_ID)
6519
6560
  {
@@ -6562,10 +6603,12 @@ function ChartReport()
6562
6603
  else if (this.IsReserveNumber(column.Type))
6563
6604
  {
6564
6605
  this.FormatReserveNumber(column, stock, drawInfo);
6606
+ this.FormatDrawInfoEvent(stock, data, column, drawInfo);
6565
6607
  }
6566
6608
  else if (this.IsReserveString(column.Type))
6567
6609
  {
6568
6610
  this.FormatReserveString(column, stock, drawInfo);
6611
+ this.FormatDrawInfoEvent(stock, data, column, drawInfo);
6569
6612
  }
6570
6613
  else if (this.IsReserveProgressBarColumn(column.Type))
6571
6614
  {
@@ -6670,8 +6713,22 @@ function ChartReport()
6670
6713
  var buttonData={ Stock:stock, Index:index, ColumnIndex:columnIndex, Column:column, Rect:drawInfo.Botton.Rect, Type:drawInfo.Botton.Type, Data:drawInfo.Data };
6671
6714
  this.ButtonRect.push(buttonData);
6672
6715
  }
6716
+ }
6673
6717
 
6674
-
6718
+ this.FormatDrawInfoEvent=function(stock, data, column, drawInfo)
6719
+ {
6720
+ if (!column.EnableFormatDrawInfoEvent) return;
6721
+
6722
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_FORMAT_DRAW_INFO);
6723
+ if (!event || !event.Callback) return;
6724
+
6725
+ var sendData=
6726
+ {
6727
+ Stock:stock, Column:column, Data:data,
6728
+ DrawInfo:drawInfo
6729
+ };
6730
+
6731
+ event.Callback(event, sendData, this);
6675
6732
  }
6676
6733
 
6677
6734
  this.IsReserveProgressBarColumn=function(value)
@@ -6957,12 +7014,6 @@ function ChartReport()
6957
7014
  this.GetCustomStringDrawInfo=function(data, column, drawInfo)
6958
7015
  {
6959
7016
  var value=this.GetExtendData(data, column);
6960
- if (column.IsDrawCallback) //外部处理输出格式
6961
- {
6962
- this.GetCustomTextDrawInfo(column, data.Symbol, value, drawInfo, data);
6963
- return;
6964
- }
6965
-
6966
7017
  if (!IFrameSplitOperator.IsString(value)) return;
6967
7018
  drawInfo.Text=value;
6968
7019
  }
@@ -6970,12 +7021,6 @@ function ChartReport()
6970
7021
  this.GetCustomNumberDrawInfo=function(data, column, drawInfo)
6971
7022
  {
6972
7023
  var value=this.GetExtendData(data, column);
6973
- if (column.IsDrawCallback) //外部处理输出格式
6974
- {
6975
- this.GetCustomTextDrawInfo(column, data.Symbol, value, drawInfo, data);
6976
- return;
6977
- }
6978
-
6979
7024
  if (!IFrameSplitOperator.IsNumber(value)) return;
6980
7025
 
6981
7026
  //格式化输出
@@ -7017,12 +7062,6 @@ function ChartReport()
7017
7062
  var value=this.GetExtendData(data, column);
7018
7063
  if (!IFrameSplitOperator.IsNumber(value)) return;
7019
7064
 
7020
- if (column.IsDrawCallback) //外部处理输出格式
7021
- {
7022
- this.GetCustomTextDrawInfo(column, data.Symbol, value, drawInfo, data);
7023
- return;
7024
- }
7025
-
7026
7065
  if (column.ValueType==0)
7027
7066
  {
7028
7067
  if (column.FormatType==1)
@@ -7331,9 +7370,13 @@ function ChartReport()
7331
7370
 
7332
7371
  this.DrawItemBG=function(drawInfo)
7333
7372
  {
7334
- if (drawInfo.BGColor && drawInfo.Rect)//绘制背景色
7373
+ if (!drawInfo.BGColor) return;
7374
+
7375
+ var rtItem=drawInfo.Rect; //绘制背景色
7376
+ if (drawInfo.RectBG) rtItem=drawInfo.RectBG;
7377
+
7378
+ if (rtItem)
7335
7379
  {
7336
- var rtItem=drawInfo.Rect;
7337
7380
  this.Canvas.fillStyle=drawInfo.BGColor;
7338
7381
  this.Canvas.fillRect(rtItem.Left,rtItem.Top,rtItem.Width,rtItem.Height); //画一个背景色, 不然是一个黑的背景
7339
7382
  }
@@ -8154,42 +8197,9 @@ function ChartReport()
8154
8197
  }
8155
8198
  }
8156
8199
 
8157
- //外部配置显示格式 颜色 对齐方式
8158
- this.GetCustomTextDrawInfo=function(columnInfo, symbol, value, drawInfo, data)
8159
- {
8160
- var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DRAW_CUSTOM_TEXT);
8161
- if (!event || !event.Callback) return false;
8162
-
8163
- var sendData=
8164
- {
8165
- Symbol:symbol, Column:columnInfo, Value:value, Data:data,
8166
- Out:{ Text:null, TextColor:null, TextAlign:null }
8167
- };
8168
-
8169
- event.Callback(event,sendData,this);
8170
-
8171
- if (sendData.Out.Text) drawInfo.Text=sendData.Out.Text;
8172
- if (sendData.Out.TextColor) drawInfo.TextColor=sendData.Out.TextColor;
8173
- if (sendData.Out.TextAlign) drawInfo.TextAlign=sendData.Out.TextAlign;
8174
- if (sendData.Out.BGColor) drawInfo.BGColor=sendData.Out.BGColor;
8175
-
8176
- return true;
8177
- }
8178
-
8179
8200
  this.FormatDrawInfo=function(column, stock, drawInfo, data)
8180
8201
  {
8181
- if (!column.IsDrawCallback) return false;
8182
-
8183
- var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_FORMAT_DRAW_INFO);
8184
- if (!event || !event.Callback) return false;
8185
-
8186
- var sendData=
8187
- {
8188
- Stock:stock, Column:column, Data:data,
8189
- DrawInfo:drawInfo
8190
- };
8191
-
8192
- event.Callback(event,sendData,this);
8202
+ this.FormatDrawInfoEvent(stock, data, column, drawInfo);
8193
8203
  }
8194
8204
 
8195
8205
  this.GetFixedRowTextDrawInfo=function(rowIndex, colIndex, columnInfo, drawInfo)
@@ -88,6 +88,14 @@ function GetBlackStyle()
88
88
  Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
89
89
  Day: { Color:"rgb(153,153,153)", BGColor:"rgb(51,51,51)", BorderColor:"rgb(51,51,51)", Margin:{ Left:5, Top:2, Bottom:2, Right:5 } },
90
90
  Night: { Color:"rgb(153,153,153)", BGColor:"rgb(51,51,51)", BorderColor:"rgb(51,51,51)", Margin:{ Left:5, Top:2, Bottom:2, Right:5 } },
91
+ },
92
+
93
+ BuySellBar:
94
+ {
95
+ BuyColor:"rgb(102, 33, 33)",
96
+ SellColor:"rgb(20, 63, 31)",
97
+ Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
98
+ TextColor:"rgb(220,220,220)",
91
99
  }
92
100
  },
93
101
 
@@ -702,6 +710,7 @@ function GetBlackStyle()
702
710
  {
703
711
  BorderColor:'rgb(38,38,41)', //边框线
704
712
  SelectedColor:"rgb(49,48,56)", //选中行
713
+ SelectedLine:{ Color:"rgb(250,250,250)" },
705
714
  Header:
706
715
  {
707
716
  Color:"RGB(245,245,245)",
@@ -197,6 +197,7 @@ HQData.Minute_RequestMinuteData=function(data, callback)
197
197
  data.PreventDefault=true;
198
198
  var symbol=data.Request.Data.symbol[0]; //请求的股票代码
199
199
  var callcation=data.Request.Data.callcation; //集合竞价
200
+ var bBuySellBar=data.Request.Data.IsShowBuySellBar;
200
201
  console.log(`[HQData::RequestMinuteData] Symbol=${symbol}`);
201
202
 
202
203
  setTimeout(()=>{
@@ -227,6 +228,29 @@ HQData.Minute_RequestMinuteData=function(data, callback)
227
228
  stockItem.beforeinfo=beforeinfo;
228
229
  }
229
230
 
231
+ var lastPrice=stockItem.minute[stockItem.minute.length-1].price;
232
+
233
+
234
+ if (bBuySellBar) //盘口分析
235
+ {
236
+ var aryBuy=[];
237
+ var value=lastPrice+0.01;
238
+ for(var i=0;i<10;++i)
239
+ {
240
+ aryBuy.push({Price:value, Type:1, Vol:HQData.GetRandomTestData(1000,10000) });
241
+ value+=0.02;
242
+ }
243
+
244
+ var arySell=[];
245
+ for(var i=0;i<10;++i)
246
+ {
247
+ arySell.push({Price:value, Type:2, Vol:HQData.GetRandomTestData(1000,10000) });
248
+ value+=0.02;
249
+ }
250
+
251
+ stockItem.BuySellData={ AryBuy:aryBuy, ArySell:arySell };
252
+ }
253
+
230
254
  //测试用 这里可以修改数据
231
255
  //var lastItem=srcStock.minute[srcStock.minute.length-1];
232
256
  //lastItem.price+=Math.ceil(Math.random()*10)/1000*lastItem.price;
@@ -238,7 +262,7 @@ HQData.Minute_RequestMinuteData=function(data, callback)
238
262
  }
239
263
  */
240
264
 
241
- //stockItem.minute.length=50;
265
+ stockItem.minute.length=50;
242
266
 
243
267
  var hqchartData={code:0, stock:[stockItem] };
244
268
 
@@ -336,6 +360,7 @@ HQData.Minute_RequestHistoryMinuteData=function(data, callback)
336
360
  var symbol=data.Request.Data.symbol; //请求的股票代码
337
361
  var dayCount=data.Request.Data.daycount;
338
362
  var callcation=data.Request.Data.callcation; //集合竞价
363
+ var bBuySellBar=data.Request.Data.IsShowBuySellBar;
339
364
 
340
365
  console.log(`[HQData::Minute_RequestHistoryMinuteData] Symbol=${symbol}`);
341
366
 
@@ -372,6 +397,29 @@ HQData.Minute_RequestHistoryMinuteData=function(data, callback)
372
397
  item.beforeinfo=beforeinfo;
373
398
  }
374
399
  }
400
+
401
+ if (bBuySellBar) //盘口分析
402
+ {
403
+ var dayItem=aryDay[0];
404
+ var lastPrice=dayItem.minute[dayItem.minute.length-1][4];
405
+
406
+ var aryBuy=[];
407
+ var value=lastPrice+0.01;
408
+ for(var i=0;i<10;++i)
409
+ {
410
+ aryBuy.push({Price:value, Type:1, Vol:HQData.GetRandomTestData(1000,10000) });
411
+ value+=0.02;
412
+ }
413
+
414
+ var arySell=[];
415
+ for(var i=0;i<10;++i)
416
+ {
417
+ arySell.push({Price:value, Type:2, Vol:HQData.GetRandomTestData(1000,10000) });
418
+ value+=0.02;
419
+ }
420
+
421
+ dayItem.BuySellData={ AryBuy:aryBuy, ArySell:arySell };
422
+ }
375
423
 
376
424
  var hqchartData={code:0, data:aryDay, name:symbol, symbol: symbol};
377
425