hqchart 1.1.14683 → 1.1.14688

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()
@@ -6562,10 +6599,12 @@ function ChartReport()
6562
6599
  else if (this.IsReserveNumber(column.Type))
6563
6600
  {
6564
6601
  this.FormatReserveNumber(column, stock, drawInfo);
6602
+ this.FormatDrawInfoEvent(stock, data, column, drawInfo);
6565
6603
  }
6566
6604
  else if (this.IsReserveString(column.Type))
6567
6605
  {
6568
6606
  this.FormatReserveString(column, stock, drawInfo);
6607
+ this.FormatDrawInfoEvent(stock, data, column, drawInfo);
6569
6608
  }
6570
6609
  else if (this.IsReserveProgressBarColumn(column.Type))
6571
6610
  {
@@ -6670,8 +6709,22 @@ function ChartReport()
6670
6709
  var buttonData={ Stock:stock, Index:index, ColumnIndex:columnIndex, Column:column, Rect:drawInfo.Botton.Rect, Type:drawInfo.Botton.Type, Data:drawInfo.Data };
6671
6710
  this.ButtonRect.push(buttonData);
6672
6711
  }
6712
+ }
6673
6713
 
6674
-
6714
+ this.FormatDrawInfoEvent=function(stock, data, column, drawInfo)
6715
+ {
6716
+ if (!column.EnableFormatDrawInfoEvent) return;
6717
+
6718
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_FORMAT_DRAW_INFO);
6719
+ if (!event || !event.Callback) return;
6720
+
6721
+ var sendData=
6722
+ {
6723
+ Stock:stock, Column:column, Data:data,
6724
+ DrawInfo:drawInfo
6725
+ };
6726
+
6727
+ event.Callback(event, sendData, this);
6675
6728
  }
6676
6729
 
6677
6730
  this.IsReserveProgressBarColumn=function(value)
@@ -7331,9 +7384,13 @@ function ChartReport()
7331
7384
 
7332
7385
  this.DrawItemBG=function(drawInfo)
7333
7386
  {
7334
- if (drawInfo.BGColor && drawInfo.Rect)//绘制背景色
7387
+ if (!drawInfo.BGColor) return;
7388
+
7389
+ var rtItem=drawInfo.Rect; //绘制背景色
7390
+ if (drawInfo.RectBG) rtItem=drawInfo.RectBG;
7391
+
7392
+ if (rtItem)
7335
7393
  {
7336
- var rtItem=drawInfo.Rect;
7337
7394
  this.Canvas.fillStyle=drawInfo.BGColor;
7338
7395
  this.Canvas.fillRect(rtItem.Left,rtItem.Top,rtItem.Width,rtItem.Height); //画一个背景色, 不然是一个黑的背景
7339
7396
  }
@@ -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;
@@ -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