hqchart 1.1.13057 → 1.1.13062

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.
@@ -2799,7 +2799,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
2799
2799
  {
2800
2800
  IsValueFullRange:false ,
2801
2801
  IsDisplayLatest:false,
2802
- SelectedBorder:{ Mode:0, SelFrame:0 } //边框选中模式 Mode:0=禁用 1=右侧标记选中 2=指标窗口标记选中
2802
+ SelectedBorder:{ Mode:0, SelFrame:0 }, //边框选中模式 Mode:0=禁用 1=右侧标记选中 2=指标窗口标记选中
2803
+ SelectedXBorder: { Mode:0, Date:null } //X边框选中模式 Mode:0=禁用 分时图图有效
2803
2804
  //XDateFormat (多日分时图x轴底部日期格式)
2804
2805
  };
2805
2806
 
@@ -3252,6 +3253,20 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3252
3253
  }
3253
3254
  }
3254
3255
 
3256
+ if (this.GlobalOption.SelectedXBorder && this.GlobalOption.SelectedXBorder.Mode>=1)
3257
+ {
3258
+ if (this.PtInMulitDayMinute)
3259
+ {
3260
+ var item=this.GlobalOption.SelectedXBorder;
3261
+ var selectedDate=this.PtInMulitDayMinute(x,y);
3262
+ if (item.Date!=selectedDate)
3263
+ {
3264
+ item.Date=selectedDate
3265
+ bDrawDynamicInfo=true;
3266
+ }
3267
+ }
3268
+ }
3269
+
3255
3270
  if (this.TryClickCrossCursor(x,y, e))
3256
3271
  {
3257
3272
  return;
@@ -5056,6 +5071,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5056
5071
  this.DrawSelectedStatus();
5057
5072
 
5058
5073
  this.DrawSelectedBorder();
5074
+ if (this.DrawSelectedXBorder) this.DrawSelectedXBorder();
5059
5075
 
5060
5076
  var moveonPoint=null;
5061
5077
  if (this.LastMouseStatus && this.LastMouseStatus.MoveOnPoint) moveonPoint=this.LastMouseStatus.MoveOnPoint;
@@ -5482,6 +5498,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5482
5498
 
5483
5499
  this.DrawSelectedStatus();
5484
5500
  this.DrawSelectedBorder();
5501
+ if (this.DrawSelectedXBorder) this.DrawSelectedXBorder();
5485
5502
 
5486
5503
  var moveonPoint=null;
5487
5504
  if (this.LastMouseStatus && this.LastMouseStatus.MoveOnPoint) moveonPoint=this.LastMouseStatus.MoveOnPoint;
@@ -50988,6 +51005,13 @@ function DynamicChartTitlePainting()
50988
51005
  this.MerginLeft=g_JSChartResource.IndexTitleMerginLeft; //标题输出左边间距
50989
51006
 
50990
51007
  this.Buttons=[]; //按钮
51008
+
51009
+ this.UpDownArrowConfig=
51010
+ {
51011
+ UpColor:g_JSChartResource.IndexTitle.UpDownArrow.UpColor,
51012
+ DownColor:g_JSChartResource.IndexTitle.UpDownArrow.DownColor,
51013
+ UnchangeColor:g_JSChartResource.IndexTitle.UpDownArrow.UnchangeColor
51014
+ };
50991
51015
 
50992
51016
 
50993
51017
  //动态标题
@@ -51528,27 +51552,68 @@ function DynamicChartTitlePainting()
51528
51552
  else text=titleItem.Text;
51529
51553
 
51530
51554
  var space=this.ParamSpace*GetDevicePixelRatio();
51531
- var textWidth=this.Canvas.measureText(text).width+space;
51532
- if ((left+textWidth)>right) break;
51555
+ var indexTextWidth=this.Canvas.measureText(text).width; //标题+数值长度
51556
+ var textWidth=indexTextWidth;
51557
+
51558
+ if (IFrameSplitOperator.IsNonEmptyArray(titleItem.TextEx))
51559
+ {
51560
+ var xLeft=left;
51561
+ for(var n=0; n<titleItem.TextEx.length; ++n)
51562
+ {
51563
+ var outItem=titleItem.TextEx[n];
51564
+ var outTextWidth=this.Canvas.measureText(outItem.Text).width+2;
51565
+ outItem.Width=outTextWidth;
51566
+ outItem.Left=xLeft;
51567
+
51568
+ textWidth+=outTextWidth;
51569
+ xLeft+=outTextWidth;
51570
+ }
51571
+ }
51572
+
51573
+ if ((left+textWidth+space)>right) break;
51533
51574
 
51534
51575
  if (titleItem.BG) //背景
51535
51576
  {
51536
51577
  var textHeight=this.Canvas.measureText("擎").width+2;
51537
- var textWidth=this.Canvas.measureText(text).width+2;
51538
51578
  var rtBG={ Left:left, Top:bottom-textHeight/2, Width:textWidth, Height:textHeight };
51539
51579
  this.Canvas.fillStyle=titleItem.BG;
51540
51580
  this.Canvas.fillRect(rtBG.Left,rtBG.Top-1, rtBG.Width, rtBG.Height);
51541
51581
 
51542
51582
  this.Canvas.fillStyle=titleItem.Color;
51543
- this.Canvas.fillText(text,rtBG.Left+1,bottom,textWidth);
51583
+ this.Canvas.fillText(text,rtBG.Left+1,bottom,indexTextWidth);
51584
+ left+=indexTextWidth;
51585
+
51586
+ if (IFrameSplitOperator.IsNonEmptyArray(titleItem.TextEx))
51587
+ {
51588
+ for(var n=0; n<titleItem.TextEx.length; ++n)
51589
+ {
51590
+ var outItem=titleItem.TextEx[n];
51591
+ this.Canvas.fillStyle=outItem.TextColor;
51592
+ this.Canvas.fillText(outItem.Text,left,bottom,outItem.Width);
51593
+ left+=outItem.Width;
51594
+ }
51595
+ }
51544
51596
 
51545
- left+=(textWidth+space);
51597
+ left+=space;
51546
51598
  }
51547
51599
  else
51548
51600
  {
51549
51601
  this.Canvas.fillStyle=titleItem.Color;
51550
- this.Canvas.fillText(text,left,bottom,textWidth);
51551
- left+=textWidth;
51602
+ this.Canvas.fillText(text,left,bottom,indexTextWidth);
51603
+ left+=indexTextWidth;
51604
+
51605
+ if (IFrameSplitOperator.IsNonEmptyArray(titleItem.TextEx))
51606
+ {
51607
+ for(var n=0; n<titleItem.TextEx.length; ++n)
51608
+ {
51609
+ var outItem=titleItem.TextEx[n];
51610
+ this.Canvas.fillStyle=outItem.TextColor;
51611
+ this.Canvas.fillText(outItem.Text,left,bottom,outItem.Width);
51612
+ left+=outItem.Width;
51613
+ }
51614
+ }
51615
+
51616
+ left+=space;
51552
51617
  }
51553
51618
  }
51554
51619
  }
@@ -51731,7 +51796,7 @@ function DynamicChartTitlePainting()
51731
51796
  }
51732
51797
  }
51733
51798
 
51734
- var arrow=null;
51799
+ var arrowSuper=null; //独立颜色
51735
51800
 
51736
51801
  if (this.IsShowUpDownArrow)
51737
51802
  {
@@ -51739,9 +51804,9 @@ function DynamicChartTitlePainting()
51739
51804
  if (dataIndex-1>=0) preValue=item.Data.Data[dataIndex-1];
51740
51805
  if (IFrameSplitOperator.IsNumber(preValue))
51741
51806
  {
51742
- if (preValue>value) arrow='↓';
51743
- else if (preValue<value) arrow='↑';
51744
- else arrow='→';
51807
+ if (preValue>value) arrowSuper={ Text:'↓', TextColor:this.UpDownArrowConfig.DownColor };
51808
+ else if (preValue<value) arrowSuper={ Text:'↑', TextColor:this.UpDownArrowConfig.UpColor};
51809
+ else arrowSuper={ Text:'→', TextColor:this.UpDownArrowConfig.UnchangeColor };
51745
51810
  }
51746
51811
  }
51747
51812
 
@@ -51752,7 +51817,21 @@ function DynamicChartTitlePainting()
51752
51817
  if (dyValue) valueText=dyValue;
51753
51818
  }
51754
51819
 
51755
- if (arrow) valueText+=arrow;
51820
+ if (arrowSuper)
51821
+ {
51822
+ var outItem={ Name:null, Text:valueText, Color:item.Color, TextEx:[arrowSuper] };
51823
+ if (item.Name)
51824
+ {
51825
+ var text=item.Name;
51826
+ var dyTitle=this.GetDynamicOutName(item.Name); //动态标题
51827
+ if (dyTitle) text=dyTitle;
51828
+ outItem.Name=text;
51829
+ }
51830
+ //outItem.BG='rgb(100,100,100)';
51831
+
51832
+ aryText=[outItem];
51833
+ valueText=null;
51834
+ }
51756
51835
  }
51757
51836
  }
51758
51837
 
@@ -62591,6 +62670,16 @@ function JSChartResource()
62591
62670
  this.OverlayIndexTitleBGColor='rgba(255,255,255,0.7)';
62592
62671
  this.IndexTitleMerginLeft=1; //指标输出左边间距
62593
62672
 
62673
+ this.IndexTitle=
62674
+ {
62675
+ UpDownArrow: //数值涨跌箭头
62676
+ {
62677
+ UpColor:"rgb(238,21,21)", //上涨
62678
+ DownColor:"rgb(25,158,0)", //下跌
62679
+ UnchangeColor:"rgb(0,0,0)" //不变
62680
+ }
62681
+ }
62682
+
62594
62683
  this.Title={
62595
62684
  TradeIndexColor:'rgb(105,105,105)', //交易指标颜色
62596
62685
  ColorIndexColor:'rgb(112,128,144)', //五彩K线颜色
@@ -63699,6 +63788,18 @@ function JSChartResource()
63699
63788
  if (style.SelFrameBorderColor) this.SelFrameBorderColor=style.SelFrameBorderColor;
63700
63789
  if (IFrameSplitOperator.IsNumber(style.IndexTitleMerginLeft)) this.IndexTitleMerginLeft = style.IndexTitleMerginLeft;
63701
63790
 
63791
+ if (style.IndexTitle)
63792
+ {
63793
+ var item=style.IndexTitle;
63794
+ if (item.UpDownArrow)
63795
+ {
63796
+ var subItem=item.UpDownArrow;
63797
+ if (subItem.UpColor) this.IndexTitle.UpDownArrow.UpColor = subItem.UpColor;
63798
+ if (subItem.DownColor) this.IndexTitle.UpDownArrow.DownColor = subItem.DownColor;
63799
+ if (subItem.UnchangeColor) this.IndexTitle.UpDownArrow.UnchangeColor = subItem.UnchangeColor;
63800
+ }
63801
+ }
63802
+
63702
63803
  if (style.Frame)
63703
63804
  {
63704
63805
  if (style.Frame.XBottomOffset) this.Frame.XBottomOffset=style.Frame.XBottomOffset;
@@ -72463,7 +72564,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
72463
72564
  this.DataStatus={ MultiDay:false, LatestDay:false }; //MultiDay=多日 LatestDay:当天
72464
72565
 
72465
72566
  this.ZoomStepPixel=50;
72466
-
72467
72567
 
72468
72568
  //集合竞价设置 obj={ Left:true/false, Right:true/false, MultiDay:{Left:, Right:} }
72469
72569
  this.SetCallCationDataBorder=function(obj)
@@ -77451,6 +77551,105 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
77451
77551
 
77452
77552
  return false;
77453
77553
  }
77554
+
77555
+ this.ClearSelectedXBorder=function()
77556
+ {
77557
+ if (!this.GlobalOption || !this.GlobalOption.SelectedXBorder) return;
77558
+ var item=this.GlobalOption.SelectedXBorder;
77559
+ item.Date=null;
77560
+ }
77561
+
77562
+ this.DrawSelectedXBorder=function()
77563
+ {
77564
+ if (this.DayCount<=1) return null;
77565
+ if (this.Frame.IsHScreen===true) return null;
77566
+
77567
+ if (!this.GlobalOption || !this.GlobalOption.SelectedXBorder) return;
77568
+ var item=this.GlobalOption.SelectedXBorder;
77569
+ if (!IFrameSplitOperator.IsPlusNumber(item.Mode)) return;
77570
+ if (!IFrameSplitOperator.IsPlusNumber(item.Date)) return;
77571
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.DayData)) return;
77572
+
77573
+ var rtSelected=null;
77574
+ var dayIndex=item.DayIndex;
77575
+ var border=this.Frame.ChartBorder.GetBorder();
77576
+ var rtClient={ Left:border.Left, Top:border.Top, Right:border.Right, Bottom: border.Bottom };
77577
+ rtClient.Width=rtClient.Right-rtClient.Left;
77578
+ var mainFrame=this.Frame.SubFrame[0].Frame; //主图框架
77579
+ var xPointCount=mainFrame.XPointCount;
77580
+ var minuteCount=mainFrame.MinuteCount;
77581
+ var lDayCount=xPointCount/minuteCount;
77582
+ var dayWidth=rtClient.Width/lDayCount;
77583
+
77584
+ if (border.DayBorder)
77585
+ {
77586
+
77587
+ }
77588
+ else
77589
+ {
77590
+ var dayIndex=-1;
77591
+ for(var i=0;i<this.DayData.length;++i)
77592
+ {
77593
+ var dayItem=this.DayData[i];
77594
+ if (dayItem.Date==item.Date)
77595
+ {
77596
+ dayIndex=this.DayData.length-1-i;
77597
+ break;
77598
+ }
77599
+ }
77600
+
77601
+ if (dayIndex<0) return;
77602
+
77603
+ rtSelected={ Left:border.Left+dayIndex*dayWidth, Width:dayWidth, Top:border.Bottom, Bottom:border.ChartHeight };
77604
+ rtSelected.Right=rtSelected.Left+rtSelected.Width;
77605
+ rtSelected.Height=rtSelected.Bottom-rtSelected.Top;
77606
+ }
77607
+
77608
+
77609
+ mainFrame.Canvas.strokeStyle=g_JSChartResource.SelFrameBorderColor;
77610
+ mainFrame.Canvas.strokeRect(ToFixedPoint(rtSelected.Left),ToFixedPoint(rtSelected.Top),ToFixedRect(rtSelected.Width),ToFixedRect(rtSelected.Height)-1);
77611
+ }
77612
+
77613
+ this.PtInMulitDayMinute=function(x,y)
77614
+ {
77615
+ if (this.DayCount<=1) return null;
77616
+ if (this.Frame.IsHScreen===true) return null;
77617
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.DayData)) return null;
77618
+
77619
+ var border=this.Frame.ChartBorder.GetBorder();
77620
+ var rtClient={ Left:border.Left, Top:border.Top, Right:border.Right, Bottom: border.Bottom };
77621
+ rtClient.Width=rtClient.Right-rtClient.Left;
77622
+ if (!(x>rtClient.Left && x<rtClient.Right && y>rtClient.Top && y<rtClient.Bottom)) return null; //不在窗口里面
77623
+
77624
+ if (border.DayBorder)
77625
+ {
77626
+
77627
+ }
77628
+ else
77629
+ {
77630
+ var mainFrame=this.Frame.SubFrame[0].Frame; //主图框架
77631
+ var xPointCount=mainFrame.XPointCount;
77632
+ var minuteCount=mainFrame.MinuteCount;
77633
+ var lDayCount=xPointCount/minuteCount;
77634
+ var dayWidth=rtClient.Width/lDayCount;
77635
+ var rtDay={ Left:rtClient.Left, Right:dayWidth+rtClient.Left };
77636
+ for(var i=0;i<lDayCount;++i)
77637
+ {
77638
+ if (x>=rtDay.Left && x<=rtDay.Right)
77639
+ {
77640
+ var dayItem=this.DayData[this.DayData.length-1-i];
77641
+ if (!dayItem) return null;
77642
+
77643
+ return dayItem.Date;
77644
+ }
77645
+
77646
+ rtDay.Left+=dayWidth;
77647
+ rtDay.Right+=dayWidth;
77648
+ }
77649
+ }
77650
+
77651
+ return null;
77652
+ }
77454
77653
  }
77455
77654
 
77456
77655
  //盘前数据
@@ -97,6 +97,16 @@ function GetBlackStyle()
97
97
  DownTextColor: "rgb(25,158,0)",
98
98
  UnchagneTextColor: "rgb(190, 190 ,190)",
99
99
  CloseLineColor: 'rgb(250,250,250)',
100
+
101
+ IndexTitle:
102
+ {
103
+ UpDownArrow: //数值涨跌箭头
104
+ {
105
+ UpColor:"rgb(238,21,21)", //上涨
106
+ DownColor:"rgb(25,158,0)", //下跌
107
+ UnchangeColor:"rgb(190, 190 ,190)" //不变
108
+ }
109
+ },
100
110
 
101
111
  Title:
102
112
  {
@@ -51,6 +51,10 @@ HQData.NetworkFilter=function(data, callback)
51
51
  HQData.AnnouncementInfo_RequestData(data,callback);
52
52
  break;
53
53
 
54
+ case "JSSymbolData::GetLatestData":
55
+ HQData.RequestLatestData(data,callback);
56
+ break;
57
+
54
58
 
55
59
 
56
60
 
@@ -282,3 +286,36 @@ HQData.TradeDetail_RequestData=function(data,callback)
282
286
 
283
287
  callback(TEST_TRADE_DETAL_DATA);
284
288
  }
289
+
290
+ HQData.RequestLatestData=function(data,callback)
291
+ {
292
+ data.PreventDefault=true;
293
+ var symbol=data.Request.Data.symbol[0];
294
+ var id=data.Args[0];
295
+ var value=1;
296
+ switch(id)
297
+ {
298
+ case 3:
299
+ value=KLINE_1DAY_DATA.stock[0].yclose;
300
+ break;
301
+ case 4:
302
+ value=KLINE_1DAY_DATA.stock[0].open;
303
+ break;
304
+ case 5:
305
+ value=KLINE_1DAY_DATA.stock[0].high;
306
+ break;
307
+ case 6:
308
+ value=KLINE_1DAY_DATA.stock[0].low;
309
+ break;
310
+ case 7:
311
+ value=KLINE_1DAY_DATA.stock[0].price;
312
+ break;
313
+ case 8:
314
+ value=KLINE_1DAY_DATA.stock[0].vol;
315
+ break;
316
+ }
317
+
318
+ var hqchartData={ symbol:symbol, ver:2.0, data:[ {id:id, value:value }]};
319
+
320
+ callback(hqchartData);
321
+ }