hqchart 1.1.12669 → 1.1.12674

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.
@@ -1427,7 +1427,7 @@ chart.EnableBorderDrag=false;if(option.Frame){for(var i=0;i<option.Frame.length;
1427
1427
  }if(IFrameSplitOperator.IsBool(item.IsShowRightText)){chart.Frame.SubFrame[i].Frame.IsShowYText[1]=item.IsShowRightText;chart.Frame.SubFrame[i].Frame.YSplitOperator.IsShowRightText=item.IsShowRightText;//显示右边刻度
1428
1428
  }if(item.Height>=0)chart.Frame.SubFrame[i].Height=item.Height;if(item.Custom)chart.Frame.SubFrame[i].Frame.YSplitOperator.Custom=item.Custom;if(item.RightTextFormat>0)chart.Frame.SubFrame[i].Frame.YSplitOperator.RightTextFormat=item.RightTextFormat;if(IFrameSplitOperator.IsNumber(item.TitleHeight))chart.Frame.SubFrame[i].Frame.ChartBorder.TitleHeight=item.TitleHeight;if(IFrameSplitOperator.IsNumber(item.BorderLine))chart.Frame.SubFrame[i].Frame.BorderLine=item.BorderLine;if(IFrameSplitOperator.IsBool(item.EnableRemoveZero))chart.Frame.SubFrame[i].Frame.YSplitOperator.EnableRemoveZero=item.EnableRemoveZero;if(IFrameSplitOperator.IsNumber(item.FloatPrecision))chart.Frame.SubFrame[i].Frame.YSplitOperator.FloatPrecision=item.FloatPrecision;if(IFrameSplitOperator.IsBool(item.IsShowXLine))chart.Frame.SubFrame[i].Frame.IsShowXLine=item.IsShowXLine;if(IFrameSplitOperator.IsBool(item.IsShowYLine))chart.Frame.SubFrame[i].Frame.IsShowYLine=item.IsShowYLine;if(IFrameSplitOperator.IsNumber(item.YTextBaseline))chart.Frame.SubFrame[i].Frame.YTextBaseline=item.YTextBaseline;}}chart.UpdateXShowText();if(option.MinuteLine){if(option.MinuteLine.IsDrawAreaPrice==false)chart.ChartPaint[0].IsDrawArea=false;if(option.MinuteLine.IsShowLead==false)chart.IsShowLead=false;if(option.MinuteLine.IsShowAveragePrice==false){chart.ChartPaint[1].IsShow=false;chart.TitlePaint[0].IsShowAveragePrice=false;//标题栏均线也不显示
1429
1429
  for(var i=0;i<chart.ExtendChartPaint.length;++i){var item=chart.ExtendChartPaint[i];if(item.ClassName=="MinuteTooltipPaint")item.IsShowAveragePrice=false;}}if(option.MinuteLine.SplitType>0)chart.Frame.SubFrame[0].Frame.YSplitOperator.SplitType=option.MinuteLine.SplitType;}this.AdjustTitleHeight(chart);if(option.DisableMouseEvent===true){//取消鼠标事件
1430
- this.CanvasElement.onmousemove=function(e){};this.CanvasElement.oncontextmenu=function(e){};this.CanvasElement.ondblclick=function(e){};this.CanvasElement.onmousedown=function(e){};this.CanvasElement.onmouseout=function(e){};this.CanvasElement.onmouseleave=function(e){};}return chart;};//历史分钟走势图
1430
+ this.CanvasElement.onmousemove=function(e){};this.CanvasElement.oncontextmenu=function(e){};this.CanvasElement.ondblclick=function(e){};this.CanvasElement.onmousedown=function(e){};this.CanvasElement.onmouseout=function(e){};this.CanvasElement.onmouseleave=function(e){};}if(option.ExtendChart){for(var i=0;i<option.ExtendChart.length;++i){var item=option.ExtendChart[i];chart.CreateExtendChart(item.Name,item);}}return chart;};//历史分钟走势图
1431
1431
  this.CreateHistoryMinuteChartContainer=function(option){var chart=new HistoryMinuteChartContainer(this.CanvasElement);var windowsCount=2;if(option.Windows&&option.Windows.length>0)windowsCount+=option.Windows.length;//指标窗口从第3个窗口开始
1432
1432
  chart.Create(windowsCount);//创建子窗口
1433
1433
  if(option.IsShowCorssCursorInfo==false)//取消显示十字光标刻度信息
@@ -3670,10 +3670,12 @@ this.DrawOrderFlow_Style4=function(){var isHScreen=this.ChartFrame.IsHScreen===t
3670
3670
  var kBarWidth=this.OrderFlow_Style4.KBarWidth;if(dataWidth+distanceWidth<kBarWidth*3)kBarWidth=1;for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j,xOffset+=dataWidth+distanceWidth,++this.ShowRange.DataCount){var data=this.Data.Data[i];this.ShowRange.End=i;if(data.Open==null||data.High==null||data.Low==null||data.Close==null)continue;var left=xOffset;var right=xOffset+dataWidth;if(right>chartright)break;var x=left+(right-left)/2;var yLow=this.GetYFromData(data.Low,false);var yHigh=this.GetYFromData(data.High,false);var yOpen=this.GetYFromData(data.Open,false);var yClose=this.GetYFromData(data.Close,false);var y=yHigh;this.DrawKRange.End=i;var barLeft=left+this.OrderFlow_Style4.LeftMargin;var barRight=right+distanceWidth-this.OrderFlow_Style4.RightMargin;if(this.OrderFlow_Style4.KBarType==1){var kbarTop=Math.min(yOpen,yClose);var kbarBottom=Math.max(yOpen,yClose);var kbarLeft=ToFixedRect(left)+this.OrderFlow_Style4.LeftMargin;var kbarRight=barLeft+kBarWidth;if(data.Open<data.Close)this.Canvas.fillStyle=upColor;else if(data.Open>data.Close)this.Canvas.fillStyle=downColor;else this.Canvas.fillStyle=unchagneColor;var cellHeight=0;if(data.OrderFlow&&IFrameSplitOperator.IsNumber(data.OrderFlow.PriceOffset))cellHeight=this.GetPriceYOffset(data.OrderFlow.PriceOffset);this.Canvas.fillRect(kbarLeft,ToFixedRect(kbarTop-cellHeight/2),kBarWidth,ToFixedRect(kbarBottom-kbarTop+cellHeight));barLeft=kbarRight+1;}var yKline={Low:yLow,High:yHigh,Open:yOpen,Close:yClose};var xKLine={Left:barLeft,Center:x,Right:barRight,DataWidth:barRight-barLeft};xKLine.Center=xKLine.Left+xKLine.DataWidth/2;this.DrawOrderFlowBar_Style4(data.OrderFlow,data,xKLine,yKline,isHScreen);}};this.DrawOrderFlowBar_Style4=function(orderFlow,kItem,xKLine,yKline,isHScreen){var top=Math.min(yKline.Open,yKline.Close);var bottom=Math.max(yKline.Open,yKline.Close);var barHeight=Math.abs(yKline.Open-yKline.Close);var cellHeight=0;if(orderFlow&&IFrameSplitOperator.IsNumber(orderFlow.PriceOffset))cellHeight=this.GetPriceYOffset(orderFlow.PriceOffset);var textFont=this.GetDynamicOrderFlowFont(cellHeight,xKLine.DataWidth/2);this.IsShowOrderText=cellHeight>5&&xKLine.DataWidth>10;if(this.OrderFlow.AlwaysShowOrderText)this.IsShowOrderText=true;this.Canvas.textBaseline='middle';this.Canvas.textAlign='left';this.Canvas.font=textFont;var volBarSpace=this.OrderFlow_Style4.VolBarSpace;if(cellHeight<=4)volBarSpace=0;//太细了 间距就不要了
3671
3671
  if(orderFlow&&IFrameSplitOperator.IsNonEmptyArray(orderFlow.Order)){if(!orderFlow.Summary)orderFlow.Summary={};if(!orderFlow.Summary.VolMaxMin)//计算最大最小值
3672
3672
  {var volMaxMin={Max:null,Min:null};for(var i=0;i<orderFlow.Order.length;++i){var item=orderFlow.Order.length[i];if(volMaxMin.Max==null||volMaxMin.Max<item.Vol.Value)volMaxMin.Max=item.Vol.Value;if(volMaxMin.Min==null||volMaxMin.Min>item.Vol.Value)volMaxMin.Min=item.Vol.Value;}orderFlow.Summary.VolMaxMin=volMaxMin;}var preItem=null;//上一个矩形框
3673
- var max=orderFlow.Summary.VolMaxMin.Max,min=orderFlow.Summary.VolMaxMin.Min;for(var i=0;i<orderFlow.Order.length;++i){var item=orderFlow.Order[i];var yPrice=this.GetYFromData(item.Price,false);if(!item.Vol)continue;if(!IFrameSplitOperator.IsNumber(item.Vol.Value))continue;var barWidth=xKLine.Right-xKLine.Left;var volWidth=barWidth*(item.Vol.Value-min)/(max-min);var rect={Left:xKLine.Left,Right:xKLine.Right,Bottom:yPrice+cellHeight/2,Top:yPrice-cellHeight/2};rect.Right=rect.Left+volWidth;if(preItem&&item.Price>preItem.Price){rect.Bottom=preItem.Rect.Top-volBarSpace;}rect.Width=rect.Right-rect.Left;rect.Height=rect.Bottom-rect.Top;var rtDraw={Left:ToFixedRect(rect.Left),Top:ToFixedRect(rect.Top),Width:ToFixedRect(rect.Width),Height:ToFixedRect(rect.Height)};rtDraw.Bottom=rtDraw.Top+rtDraw.Height;rtDraw.Right=rtDraw.Left+rtDraw.Width;if(rtDraw.Width<1)rtDraw.Width=1;if(item.Vol.BG)//背景色
3673
+ var max=orderFlow.Summary.VolMaxMin.Max,min=orderFlow.Summary.VolMaxMin.Min;for(var i=0;i<orderFlow.Order.length;++i){var item=orderFlow.Order[i];var yPrice=this.GetYFromData(item.Price,false);if(!item.Vol)continue;if(IFrameSplitOperator.IsNonEmptyArray(item.AryVol)){var barWidth=xKLine.Right-xKLine.Left;var xVolLeft=xKLine.Left;var xVolRight=xVolLeft;var totalVol=0;var rtDraw={Bottom:yPrice+cellHeight/2,Top:yPrice-cellHeight/2};for(var j=0;j<item.AryVol.length;++j){var itemVol=item.AryVol[j];if(!IFrameSplitOperator.IsNumber(itemVol.Value))continue;totalVol+=itemVol.Value;xVolRight=barWidth*(totalVol-min)/(max-min)+xKLine.Left;var rtBar={Left:xVolLeft,Right:xVolRight,Bottom:yPrice+cellHeight/2,Top:yPrice-cellHeight/2};if(preItem&&item.Price>preItem.Price){rtBar.Bottom=preItem.Rect.Top-volBarSpace;}rtBar.Width=rtBar.Right-rtBar.Left;rtBar.Height=rtBar.Bottom-rtBar.Top;rtDraw={Left:ToFixedRect(rtBar.Left),Top:ToFixedRect(rtBar.Top),Width:ToFixedRect(rtBar.Width),Height:ToFixedRect(rtBar.Height)};rtDraw.Bottom=rtDraw.Top+rtDraw.Height;rtDraw.Right=rtDraw.Left+rtDraw.Width;if(rtDraw.Width<1)rtDraw.Width=1;if(itemVol.BG)//背景色
3674
+ {this.Canvas.fillStyle=itemVol.BG;this.Canvas.fillRect(rtDraw.Left,rtDraw.Top,rtDraw.Width,rtDraw.Height);}xVolLeft=rtDraw.Right;}rtDraw.Left=xKLine.Left;rtDraw.Width=rtDraw.Right-rtDraw.Left;if(item.Vol.Text&&this.IsShowOrderText)//文字
3675
+ {this.Canvas.fillStyle=item.Vol.Color;if(item.Vol.Font){var itemFont=this.GetDynamicOrderFlowFont(cellHeight,barWidth/2,item.Vol.Font);this.Canvas.font=itemFont;this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);this.Canvas.font=textFont;}else{this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);}}preItem={Price:item.Price,Rect:rtDraw};}else if(IFrameSplitOperator.IsNumber(item.Vol.Value)){var barWidth=xKLine.Right-xKLine.Left;var volWidth=barWidth*(item.Vol.Value-min)/(max-min);var rect={Left:xKLine.Left,Right:xKLine.Right,Bottom:yPrice+cellHeight/2,Top:yPrice-cellHeight/2};rect.Right=rect.Left+volWidth;if(preItem&&item.Price>preItem.Price){rect.Bottom=preItem.Rect.Top-volBarSpace;}rect.Width=rect.Right-rect.Left;rect.Height=rect.Bottom-rect.Top;var rtDraw={Left:ToFixedRect(rect.Left),Top:ToFixedRect(rect.Top),Width:ToFixedRect(rect.Width),Height:ToFixedRect(rect.Height)};rtDraw.Bottom=rtDraw.Top+rtDraw.Height;rtDraw.Right=rtDraw.Left+rtDraw.Width;if(rtDraw.Width<1)rtDraw.Width=1;if(item.Vol.BG)//背景色
3674
3676
  {this.Canvas.fillStyle=item.Vol.BG;this.Canvas.fillRect(rtDraw.Left,rtDraw.Top,rtDraw.Width,rtDraw.Height);}if(item.Vol.BorderColor)//边框
3675
3677
  {this.Canvas.strokeStyle=item.Vol.BorderColor;this.Canvas.strokeRect(ToFixedPoint(rtDraw.Left),ToFixedPoint(rtDraw.Top),rtDraw.Width,rtDraw.Height);}if(item.Vol.Text&&this.IsShowOrderText)//文字
3676
- {this.Canvas.fillStyle=item.Vol.Color;if(item.Vol.Font){var itemFont=this.GetDynamicOrderFlowFont(cellHeight,barWidth/2,item.Vol.Font);this.Canvas.font=itemFont;this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);this.Canvas.font=textFont;}else{this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);}}preItem={Price:item.Price,Rect:rtDraw};}}};//////////////////////////////////////////////////////////////
3678
+ {this.Canvas.fillStyle=item.Vol.Color;if(item.Vol.Font){var itemFont=this.GetDynamicOrderFlowFont(cellHeight,barWidth/2,item.Vol.Font);this.Canvas.font=itemFont;this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);this.Canvas.font=textFont;}else{this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);}}preItem={Price:item.Price,Rect:rtDraw};}else{continue;}}}};//////////////////////////////////////////////////////////////
3677
3679
  // high low bar
3678
3680
  //
3679
3681
  ///////////////////////////////////////////////////////////////
@@ -12828,7 +12830,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
12828
12830
  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);};}/********************************************************************************
12829
12831
  * 版本信息输出
12830
12832
  *
12831
- */var HQCHART_VERSION="1.1.12668";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();//把给外界调用的方法暴露出来
12833
+ */var HQCHART_VERSION="1.1.12673";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();//把给外界调用的方法暴露出来
12832
12834
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
12833
12835
  // BaseIndex:BaseIndex,
12834
12836
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "hqchart",
3
3
  "description": "stock chart",
4
4
  "author": "jones2000",
5
- "version": "1.1.12669",
5
+ "version": "1.1.12674",
6
6
  "main": "lib/main.js",
7
7
  "private": false,
8
8
  "license": "Apache License 2.0",
@@ -1230,6 +1230,15 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
1230
1230
  this.CanvasElement.onmouseleave=(e)=>{ }
1231
1231
  }
1232
1232
 
1233
+ if (option.ExtendChart)
1234
+ {
1235
+ for(var i=0;i<option.ExtendChart.length;++i)
1236
+ {
1237
+ var item=option.ExtendChart[i];
1238
+ chart.CreateExtendChart(item.Name, item);
1239
+ }
1240
+ }
1241
+
1233
1242
  return chart;
1234
1243
 
1235
1244
  }
@@ -25484,57 +25493,122 @@ function ChartKLine()
25484
25493
  var item=orderFlow.Order[i];
25485
25494
  var yPrice=this.GetYFromData(item.Price, false);
25486
25495
  if (!item.Vol) continue;
25487
- if (!IFrameSplitOperator.IsNumber(item.Vol.Value)) continue;
25488
-
25489
- var barWidth=xKLine.Right-xKLine.Left;
25490
- var volWidth=barWidth*(item.Vol.Value-min)/(max-min);
25491
- var rect={ Left:xKLine.Left, Right:xKLine.Right, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
25492
- rect.Right=rect.Left+volWidth;
25493
25496
 
25494
- if (preItem && item.Price>preItem.Price)
25497
+ if (IFrameSplitOperator.IsNonEmptyArray(item.AryVol))
25495
25498
  {
25496
- rect.Bottom=preItem.Rect.Top-volBarSpace;
25497
- }
25499
+ var barWidth=xKLine.Right-xKLine.Left;
25498
25500
 
25499
- rect.Width=rect.Right-rect.Left;
25500
- rect.Height=rect.Bottom-rect.Top;
25501
-
25502
-
25503
- var rtDraw={ Left:ToFixedRect(rect.Left), Top:ToFixedRect(rect.Top), Width:ToFixedRect(rect.Width), Height:ToFixedRect(rect.Height) };
25504
- rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
25505
- rtDraw.Right=rtDraw.Left+rtDraw.Width;
25506
- if (rtDraw.Width<1) rtDraw.Width=1;
25501
+ var xVolLeft=xKLine.Left;
25502
+ var xVolRight=xVolLeft;
25503
+ var totalVol=0;
25504
+ var rtDraw={ Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
25505
+ for(var j=0;j<item.AryVol.length;++j)
25506
+ {
25507
+ var itemVol=item.AryVol[j];
25508
+ if (!IFrameSplitOperator.IsNumber(itemVol.Value)) continue;
25509
+ totalVol+=itemVol.Value;
25510
+ xVolRight=barWidth*(totalVol-min)/(max-min)+xKLine.Left;
25511
+ var rtBar={ Left:xVolLeft, Right:xVolRight, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
25512
+ if (preItem && item.Price>preItem.Price)
25513
+ {
25514
+ rtBar.Bottom=preItem.Rect.Top-volBarSpace;
25515
+ }
25516
+ rtBar.Width=rtBar.Right-rtBar.Left;
25517
+ rtBar.Height=rtBar.Bottom-rtBar.Top;
25507
25518
 
25508
- if (item.Vol.BG) //背景色
25509
- {
25510
- this.Canvas.fillStyle=item.Vol.BG;
25511
- this.Canvas.fillRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
25512
- }
25519
+ rtDraw={ Left:ToFixedRect(rtBar.Left), Top:ToFixedRect(rtBar.Top), Width:ToFixedRect(rtBar.Width), Height:ToFixedRect(rtBar.Height) };
25520
+ rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
25521
+ rtDraw.Right=rtDraw.Left+rtDraw.Width;
25522
+ if (rtDraw.Width<1) rtDraw.Width=1;
25513
25523
 
25514
- if (item.Vol.BorderColor) //边框
25515
- {
25516
- this.Canvas.strokeStyle = item.Vol.BorderColor;
25517
- this.Canvas.strokeRect(ToFixedPoint(rtDraw.Left), ToFixedPoint(rtDraw.Top), rtDraw.Width, rtDraw.Height);
25518
- }
25524
+ if (itemVol.BG) //背景色
25525
+ {
25526
+ this.Canvas.fillStyle=itemVol.BG;
25527
+ this.Canvas.fillRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
25528
+ }
25519
25529
 
25520
- if (item.Vol.Text && this.IsShowOrderText) //文字
25521
- {
25522
- this.Canvas.fillStyle=item.Vol.Color;
25530
+ xVolLeft=rtDraw.Right;
25531
+ }
25523
25532
 
25524
- if (item.Vol.Font)
25533
+ rtDraw.Left=xKLine.Left;
25534
+ rtDraw.Width=rtDraw.Right-rtDraw.Left;
25535
+ if (item.Vol.Text && this.IsShowOrderText) //文字
25525
25536
  {
25526
- var itemFont=this.GetDynamicOrderFlowFont(cellHeight, barWidth/2, item.Vol.Font);
25527
- this.Canvas.font=itemFont;
25528
- this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);
25529
- this.Canvas.font=textFont;
25537
+ this.Canvas.fillStyle=item.Vol.Color;
25538
+
25539
+ if (item.Vol.Font)
25540
+ {
25541
+ var itemFont=this.GetDynamicOrderFlowFont(cellHeight, barWidth/2, item.Vol.Font);
25542
+ this.Canvas.font=itemFont;
25543
+ this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);
25544
+ this.Canvas.font=textFont;
25545
+ }
25546
+ else
25547
+ {
25548
+ this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
25549
+ }
25530
25550
  }
25531
- else
25551
+
25552
+ preItem={ Price: item.Price, Rect:rtDraw };
25553
+ }
25554
+ else if (IFrameSplitOperator.IsNumber(item.Vol.Value))
25555
+ {
25556
+ var barWidth=xKLine.Right-xKLine.Left;
25557
+ var volWidth=barWidth*(item.Vol.Value-min)/(max-min);
25558
+ var rect={ Left:xKLine.Left, Right:xKLine.Right, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
25559
+ rect.Right=rect.Left+volWidth;
25560
+
25561
+ if (preItem && item.Price>preItem.Price)
25532
25562
  {
25533
- this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
25563
+ rect.Bottom=preItem.Rect.Top-volBarSpace;
25534
25564
  }
25565
+
25566
+ rect.Width=rect.Right-rect.Left;
25567
+ rect.Height=rect.Bottom-rect.Top;
25568
+
25569
+
25570
+ var rtDraw={ Left:ToFixedRect(rect.Left), Top:ToFixedRect(rect.Top), Width:ToFixedRect(rect.Width), Height:ToFixedRect(rect.Height) };
25571
+ rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
25572
+ rtDraw.Right=rtDraw.Left+rtDraw.Width;
25573
+ if (rtDraw.Width<1) rtDraw.Width=1;
25574
+
25575
+ if (item.Vol.BG) //背景色
25576
+ {
25577
+ this.Canvas.fillStyle=item.Vol.BG;
25578
+ this.Canvas.fillRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
25579
+ }
25580
+
25581
+ if (item.Vol.BorderColor) //边框
25582
+ {
25583
+ this.Canvas.strokeStyle = item.Vol.BorderColor;
25584
+ this.Canvas.strokeRect(ToFixedPoint(rtDraw.Left), ToFixedPoint(rtDraw.Top), rtDraw.Width, rtDraw.Height);
25585
+ }
25586
+
25587
+ if (item.Vol.Text && this.IsShowOrderText) //文字
25588
+ {
25589
+ this.Canvas.fillStyle=item.Vol.Color;
25590
+
25591
+ if (item.Vol.Font)
25592
+ {
25593
+ var itemFont=this.GetDynamicOrderFlowFont(cellHeight, barWidth/2, item.Vol.Font);
25594
+ this.Canvas.font=itemFont;
25595
+ this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);
25596
+ this.Canvas.font=textFont;
25597
+ }
25598
+ else
25599
+ {
25600
+ this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
25601
+ }
25602
+ }
25603
+
25604
+ preItem={ Price: item.Price, Rect:rtDraw };
25535
25605
  }
25536
-
25537
- preItem={ Price: item.Price, Rect:rtDraw };
25606
+ else
25607
+ {
25608
+ continue;
25609
+ }
25610
+
25611
+
25538
25612
  }
25539
25613
  }
25540
25614
  }
@@ -5374,6 +5374,15 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5374
5374
  this.CanvasElement.onmouseleave=(e)=>{ }
5375
5375
  }
5376
5376
 
5377
+ if (option.ExtendChart)
5378
+ {
5379
+ for(var i=0;i<option.ExtendChart.length;++i)
5380
+ {
5381
+ var item=option.ExtendChart[i];
5382
+ chart.CreateExtendChart(item.Name, item);
5383
+ }
5384
+ }
5385
+
5377
5386
  return chart;
5378
5387
 
5379
5388
  }
@@ -29628,57 +29637,122 @@ function ChartKLine()
29628
29637
  var item=orderFlow.Order[i];
29629
29638
  var yPrice=this.GetYFromData(item.Price, false);
29630
29639
  if (!item.Vol) continue;
29631
- if (!IFrameSplitOperator.IsNumber(item.Vol.Value)) continue;
29632
-
29633
- var barWidth=xKLine.Right-xKLine.Left;
29634
- var volWidth=barWidth*(item.Vol.Value-min)/(max-min);
29635
- var rect={ Left:xKLine.Left, Right:xKLine.Right, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
29636
- rect.Right=rect.Left+volWidth;
29637
29640
 
29638
- if (preItem && item.Price>preItem.Price)
29641
+ if (IFrameSplitOperator.IsNonEmptyArray(item.AryVol))
29639
29642
  {
29640
- rect.Bottom=preItem.Rect.Top-volBarSpace;
29641
- }
29643
+ var barWidth=xKLine.Right-xKLine.Left;
29642
29644
 
29643
- rect.Width=rect.Right-rect.Left;
29644
- rect.Height=rect.Bottom-rect.Top;
29645
-
29646
-
29647
- var rtDraw={ Left:ToFixedRect(rect.Left), Top:ToFixedRect(rect.Top), Width:ToFixedRect(rect.Width), Height:ToFixedRect(rect.Height) };
29648
- rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
29649
- rtDraw.Right=rtDraw.Left+rtDraw.Width;
29650
- if (rtDraw.Width<1) rtDraw.Width=1;
29645
+ var xVolLeft=xKLine.Left;
29646
+ var xVolRight=xVolLeft;
29647
+ var totalVol=0;
29648
+ var rtDraw={ Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
29649
+ for(var j=0;j<item.AryVol.length;++j)
29650
+ {
29651
+ var itemVol=item.AryVol[j];
29652
+ if (!IFrameSplitOperator.IsNumber(itemVol.Value)) continue;
29653
+ totalVol+=itemVol.Value;
29654
+ xVolRight=barWidth*(totalVol-min)/(max-min)+xKLine.Left;
29655
+ var rtBar={ Left:xVolLeft, Right:xVolRight, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
29656
+ if (preItem && item.Price>preItem.Price)
29657
+ {
29658
+ rtBar.Bottom=preItem.Rect.Top-volBarSpace;
29659
+ }
29660
+ rtBar.Width=rtBar.Right-rtBar.Left;
29661
+ rtBar.Height=rtBar.Bottom-rtBar.Top;
29651
29662
 
29652
- if (item.Vol.BG) //背景色
29653
- {
29654
- this.Canvas.fillStyle=item.Vol.BG;
29655
- this.Canvas.fillRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
29656
- }
29663
+ rtDraw={ Left:ToFixedRect(rtBar.Left), Top:ToFixedRect(rtBar.Top), Width:ToFixedRect(rtBar.Width), Height:ToFixedRect(rtBar.Height) };
29664
+ rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
29665
+ rtDraw.Right=rtDraw.Left+rtDraw.Width;
29666
+ if (rtDraw.Width<1) rtDraw.Width=1;
29657
29667
 
29658
- if (item.Vol.BorderColor) //边框
29659
- {
29660
- this.Canvas.strokeStyle = item.Vol.BorderColor;
29661
- this.Canvas.strokeRect(ToFixedPoint(rtDraw.Left), ToFixedPoint(rtDraw.Top), rtDraw.Width, rtDraw.Height);
29662
- }
29668
+ if (itemVol.BG) //背景色
29669
+ {
29670
+ this.Canvas.fillStyle=itemVol.BG;
29671
+ this.Canvas.fillRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
29672
+ }
29663
29673
 
29664
- if (item.Vol.Text && this.IsShowOrderText) //文字
29665
- {
29666
- this.Canvas.fillStyle=item.Vol.Color;
29674
+ xVolLeft=rtDraw.Right;
29675
+ }
29667
29676
 
29668
- if (item.Vol.Font)
29677
+ rtDraw.Left=xKLine.Left;
29678
+ rtDraw.Width=rtDraw.Right-rtDraw.Left;
29679
+ if (item.Vol.Text && this.IsShowOrderText) //文字
29669
29680
  {
29670
- var itemFont=this.GetDynamicOrderFlowFont(cellHeight, barWidth/2, item.Vol.Font);
29671
- this.Canvas.font=itemFont;
29672
- this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);
29673
- this.Canvas.font=textFont;
29681
+ this.Canvas.fillStyle=item.Vol.Color;
29682
+
29683
+ if (item.Vol.Font)
29684
+ {
29685
+ var itemFont=this.GetDynamicOrderFlowFont(cellHeight, barWidth/2, item.Vol.Font);
29686
+ this.Canvas.font=itemFont;
29687
+ this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);
29688
+ this.Canvas.font=textFont;
29689
+ }
29690
+ else
29691
+ {
29692
+ this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
29693
+ }
29674
29694
  }
29675
- else
29695
+
29696
+ preItem={ Price: item.Price, Rect:rtDraw };
29697
+ }
29698
+ else if (IFrameSplitOperator.IsNumber(item.Vol.Value))
29699
+ {
29700
+ var barWidth=xKLine.Right-xKLine.Left;
29701
+ var volWidth=barWidth*(item.Vol.Value-min)/(max-min);
29702
+ var rect={ Left:xKLine.Left, Right:xKLine.Right, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
29703
+ rect.Right=rect.Left+volWidth;
29704
+
29705
+ if (preItem && item.Price>preItem.Price)
29676
29706
  {
29677
- this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
29707
+ rect.Bottom=preItem.Rect.Top-volBarSpace;
29678
29708
  }
29709
+
29710
+ rect.Width=rect.Right-rect.Left;
29711
+ rect.Height=rect.Bottom-rect.Top;
29712
+
29713
+
29714
+ var rtDraw={ Left:ToFixedRect(rect.Left), Top:ToFixedRect(rect.Top), Width:ToFixedRect(rect.Width), Height:ToFixedRect(rect.Height) };
29715
+ rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
29716
+ rtDraw.Right=rtDraw.Left+rtDraw.Width;
29717
+ if (rtDraw.Width<1) rtDraw.Width=1;
29718
+
29719
+ if (item.Vol.BG) //背景色
29720
+ {
29721
+ this.Canvas.fillStyle=item.Vol.BG;
29722
+ this.Canvas.fillRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
29723
+ }
29724
+
29725
+ if (item.Vol.BorderColor) //边框
29726
+ {
29727
+ this.Canvas.strokeStyle = item.Vol.BorderColor;
29728
+ this.Canvas.strokeRect(ToFixedPoint(rtDraw.Left), ToFixedPoint(rtDraw.Top), rtDraw.Width, rtDraw.Height);
29729
+ }
29730
+
29731
+ if (item.Vol.Text && this.IsShowOrderText) //文字
29732
+ {
29733
+ this.Canvas.fillStyle=item.Vol.Color;
29734
+
29735
+ if (item.Vol.Font)
29736
+ {
29737
+ var itemFont=this.GetDynamicOrderFlowFont(cellHeight, barWidth/2, item.Vol.Font);
29738
+ this.Canvas.font=itemFont;
29739
+ this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);
29740
+ this.Canvas.font=textFont;
29741
+ }
29742
+ else
29743
+ {
29744
+ this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
29745
+ }
29746
+ }
29747
+
29748
+ preItem={ Price: item.Price, Rect:rtDraw };
29679
29749
  }
29680
-
29681
- preItem={ Price: item.Price, Rect:rtDraw };
29750
+ else
29751
+ {
29752
+ continue;
29753
+ }
29754
+
29755
+
29682
29756
  }
29683
29757
  }
29684
29758
  }
@@ -130309,7 +130383,7 @@ function ScrollBarBGChart()
130309
130383
 
130310
130384
 
130311
130385
 
130312
- var HQCHART_VERSION="1.1.12668";
130386
+ var HQCHART_VERSION="1.1.12673";
130313
130387
 
130314
130388
  function PrintHQChartVersion()
130315
130389
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.12668";
8
+ var HQCHART_VERSION="1.1.12673";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -5418,6 +5418,15 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5418
5418
  this.CanvasElement.onmouseleave=(e)=>{ }
5419
5419
  }
5420
5420
 
5421
+ if (option.ExtendChart)
5422
+ {
5423
+ for(var i=0;i<option.ExtendChart.length;++i)
5424
+ {
5425
+ var item=option.ExtendChart[i];
5426
+ chart.CreateExtendChart(item.Name, item);
5427
+ }
5428
+ }
5429
+
5421
5430
  return chart;
5422
5431
 
5423
5432
  }
@@ -29672,57 +29681,122 @@ function ChartKLine()
29672
29681
  var item=orderFlow.Order[i];
29673
29682
  var yPrice=this.GetYFromData(item.Price, false);
29674
29683
  if (!item.Vol) continue;
29675
- if (!IFrameSplitOperator.IsNumber(item.Vol.Value)) continue;
29676
-
29677
- var barWidth=xKLine.Right-xKLine.Left;
29678
- var volWidth=barWidth*(item.Vol.Value-min)/(max-min);
29679
- var rect={ Left:xKLine.Left, Right:xKLine.Right, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
29680
- rect.Right=rect.Left+volWidth;
29681
29684
 
29682
- if (preItem && item.Price>preItem.Price)
29685
+ if (IFrameSplitOperator.IsNonEmptyArray(item.AryVol))
29683
29686
  {
29684
- rect.Bottom=preItem.Rect.Top-volBarSpace;
29685
- }
29687
+ var barWidth=xKLine.Right-xKLine.Left;
29686
29688
 
29687
- rect.Width=rect.Right-rect.Left;
29688
- rect.Height=rect.Bottom-rect.Top;
29689
-
29690
-
29691
- var rtDraw={ Left:ToFixedRect(rect.Left), Top:ToFixedRect(rect.Top), Width:ToFixedRect(rect.Width), Height:ToFixedRect(rect.Height) };
29692
- rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
29693
- rtDraw.Right=rtDraw.Left+rtDraw.Width;
29694
- if (rtDraw.Width<1) rtDraw.Width=1;
29689
+ var xVolLeft=xKLine.Left;
29690
+ var xVolRight=xVolLeft;
29691
+ var totalVol=0;
29692
+ var rtDraw={ Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
29693
+ for(var j=0;j<item.AryVol.length;++j)
29694
+ {
29695
+ var itemVol=item.AryVol[j];
29696
+ if (!IFrameSplitOperator.IsNumber(itemVol.Value)) continue;
29697
+ totalVol+=itemVol.Value;
29698
+ xVolRight=barWidth*(totalVol-min)/(max-min)+xKLine.Left;
29699
+ var rtBar={ Left:xVolLeft, Right:xVolRight, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
29700
+ if (preItem && item.Price>preItem.Price)
29701
+ {
29702
+ rtBar.Bottom=preItem.Rect.Top-volBarSpace;
29703
+ }
29704
+ rtBar.Width=rtBar.Right-rtBar.Left;
29705
+ rtBar.Height=rtBar.Bottom-rtBar.Top;
29695
29706
 
29696
- if (item.Vol.BG) //背景色
29697
- {
29698
- this.Canvas.fillStyle=item.Vol.BG;
29699
- this.Canvas.fillRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
29700
- }
29707
+ rtDraw={ Left:ToFixedRect(rtBar.Left), Top:ToFixedRect(rtBar.Top), Width:ToFixedRect(rtBar.Width), Height:ToFixedRect(rtBar.Height) };
29708
+ rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
29709
+ rtDraw.Right=rtDraw.Left+rtDraw.Width;
29710
+ if (rtDraw.Width<1) rtDraw.Width=1;
29701
29711
 
29702
- if (item.Vol.BorderColor) //边框
29703
- {
29704
- this.Canvas.strokeStyle = item.Vol.BorderColor;
29705
- this.Canvas.strokeRect(ToFixedPoint(rtDraw.Left), ToFixedPoint(rtDraw.Top), rtDraw.Width, rtDraw.Height);
29706
- }
29712
+ if (itemVol.BG) //背景色
29713
+ {
29714
+ this.Canvas.fillStyle=itemVol.BG;
29715
+ this.Canvas.fillRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
29716
+ }
29707
29717
 
29708
- if (item.Vol.Text && this.IsShowOrderText) //文字
29709
- {
29710
- this.Canvas.fillStyle=item.Vol.Color;
29718
+ xVolLeft=rtDraw.Right;
29719
+ }
29711
29720
 
29712
- if (item.Vol.Font)
29721
+ rtDraw.Left=xKLine.Left;
29722
+ rtDraw.Width=rtDraw.Right-rtDraw.Left;
29723
+ if (item.Vol.Text && this.IsShowOrderText) //文字
29713
29724
  {
29714
- var itemFont=this.GetDynamicOrderFlowFont(cellHeight, barWidth/2, item.Vol.Font);
29715
- this.Canvas.font=itemFont;
29716
- this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);
29717
- this.Canvas.font=textFont;
29725
+ this.Canvas.fillStyle=item.Vol.Color;
29726
+
29727
+ if (item.Vol.Font)
29728
+ {
29729
+ var itemFont=this.GetDynamicOrderFlowFont(cellHeight, barWidth/2, item.Vol.Font);
29730
+ this.Canvas.font=itemFont;
29731
+ this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);
29732
+ this.Canvas.font=textFont;
29733
+ }
29734
+ else
29735
+ {
29736
+ this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
29737
+ }
29718
29738
  }
29719
- else
29739
+
29740
+ preItem={ Price: item.Price, Rect:rtDraw };
29741
+ }
29742
+ else if (IFrameSplitOperator.IsNumber(item.Vol.Value))
29743
+ {
29744
+ var barWidth=xKLine.Right-xKLine.Left;
29745
+ var volWidth=barWidth*(item.Vol.Value-min)/(max-min);
29746
+ var rect={ Left:xKLine.Left, Right:xKLine.Right, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
29747
+ rect.Right=rect.Left+volWidth;
29748
+
29749
+ if (preItem && item.Price>preItem.Price)
29720
29750
  {
29721
- this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
29751
+ rect.Bottom=preItem.Rect.Top-volBarSpace;
29722
29752
  }
29753
+
29754
+ rect.Width=rect.Right-rect.Left;
29755
+ rect.Height=rect.Bottom-rect.Top;
29756
+
29757
+
29758
+ var rtDraw={ Left:ToFixedRect(rect.Left), Top:ToFixedRect(rect.Top), Width:ToFixedRect(rect.Width), Height:ToFixedRect(rect.Height) };
29759
+ rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
29760
+ rtDraw.Right=rtDraw.Left+rtDraw.Width;
29761
+ if (rtDraw.Width<1) rtDraw.Width=1;
29762
+
29763
+ if (item.Vol.BG) //背景色
29764
+ {
29765
+ this.Canvas.fillStyle=item.Vol.BG;
29766
+ this.Canvas.fillRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
29767
+ }
29768
+
29769
+ if (item.Vol.BorderColor) //边框
29770
+ {
29771
+ this.Canvas.strokeStyle = item.Vol.BorderColor;
29772
+ this.Canvas.strokeRect(ToFixedPoint(rtDraw.Left), ToFixedPoint(rtDraw.Top), rtDraw.Width, rtDraw.Height);
29773
+ }
29774
+
29775
+ if (item.Vol.Text && this.IsShowOrderText) //文字
29776
+ {
29777
+ this.Canvas.fillStyle=item.Vol.Color;
29778
+
29779
+ if (item.Vol.Font)
29780
+ {
29781
+ var itemFont=this.GetDynamicOrderFlowFont(cellHeight, barWidth/2, item.Vol.Font);
29782
+ this.Canvas.font=itemFont;
29783
+ this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);
29784
+ this.Canvas.font=textFont;
29785
+ }
29786
+ else
29787
+ {
29788
+ this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
29789
+ }
29790
+ }
29791
+
29792
+ preItem={ Price: item.Price, Rect:rtDraw };
29723
29793
  }
29724
-
29725
- preItem={ Price: item.Price, Rect:rtDraw };
29794
+ else
29795
+ {
29796
+ continue;
29797
+ }
29798
+
29799
+
29726
29800
  }
29727
29801
  }
29728
29802
  }
@@ -130467,7 +130541,7 @@ function HQChartScriptWorker()
130467
130541
 
130468
130542
 
130469
130543
 
130470
- var HQCHART_VERSION="1.1.12668";
130544
+ var HQCHART_VERSION="1.1.12673";
130471
130545
 
130472
130546
  function PrintHQChartVersion()
130473
130547
  {