hqchart 1.1.12669 → 1.1.12678

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.
@@ -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
  }
@@ -10850,8 +10859,137 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
10850
10859
  this.Frame.ResetXYSplit();
10851
10860
  }
10852
10861
 
10862
+ this.UpdateFrameMaxMinV2=function()
10863
+ {
10864
+ var mapFrame=new Map(); //key=frameid, value:{ ChartPaint:[] }
10865
+ for(var i=0;i<this.Frame.SubFrame.length;++i)
10866
+ {
10867
+ var subItem=this.Frame.SubFrame[i];
10868
+ if (!subItem || !subItem.Frame) continue;
10869
+
10870
+ var frame=subItem.Frame;
10871
+ var key=frame.Identify;
10872
+ var item=
10873
+ {
10874
+ ID:key, Frame:frame, ChartPaint:[] , Max:null, Min:null,
10875
+ OverlayFrame:[], //共享坐标
10876
+ SingleOverlay:[] //独立坐标
10877
+ };
10878
+
10879
+ for(var j=0;j<subItem.OverlayIndex.length;++j)
10880
+ {
10881
+ var overlayItem=subItem.OverlayIndex[j];
10882
+ var overlayFrame=overlayItem.Frame;
10883
+ if (overlayFrame.IsShareY)
10884
+ {
10885
+ if (!overlayFrame.MainFrame) continue;
10886
+ if (overlayFrame.IsCalculateYMaxMin===false) continue; //叠加坐标Y轴不调整
10887
+ item.OverlayFrame.push(overlayFrame);
10888
+ for(var k=0; k<overlayItem.ChartPaint.length; ++k)
10889
+ {
10890
+ var chart=overlayItem.ChartPaint[k];
10891
+ item.ChartPaint.push(chart);
10892
+ }
10893
+ }
10894
+ else
10895
+ {
10896
+ item.SingleOverlay.push(overlayItem);
10897
+ }
10898
+
10899
+ }
10900
+
10901
+ mapFrame.set(key, item);
10902
+ }
10903
+
10904
+ for(var i=0;i<this.ChartPaint.length;++i)
10905
+ {
10906
+ var chart=this.ChartPaint[i];
10907
+ var key=chart.ChartFrame.Identify;
10908
+ if (!mapFrame.has(key)) continue;
10909
+
10910
+ var finder=mapFrame.get(key);
10911
+ finder.ChartPaint.push(chart);
10912
+ }
10913
+
10914
+ for(var i=0;i<this.OverlayChartPaint.length;++i)
10915
+ {
10916
+ var chart=this.OverlayChartPaint[i];
10917
+ if (!chart.ChartFrame) continue;
10918
+ var key=chart.ChartFrame.Identify;
10919
+ if (!mapFrame.has(key)) continue;
10920
+
10921
+ var finder=mapFrame.get(key);
10922
+ finder.ChartPaint.push(chart);
10923
+ }
10924
+
10925
+ for(var mapItem of mapFrame)
10926
+ {
10927
+ var item=mapItem[1];
10928
+ var frame=item.Frame;
10929
+ //计算主框架最大最小
10930
+ for(var i=0;i<item.ChartPaint.length;++i)
10931
+ {
10932
+ var chart=item.ChartPaint[i];
10933
+ if (chart.IsShow==false) continue; //隐藏的图形不计算
10934
+ if (chart.NotSupportMessage) continue;
10935
+ if (!chart.ChartFrame) continue;
10936
+
10937
+ var range=chart.GetMaxMin();
10938
+ if (range==null || range.Max==null || range.Min==null) continue;
10939
+
10940
+ if (item.Max==null || item.Max<range.Max) item.Max=range.Max;
10941
+ if (item.Min==null || item.Min>range.Min) item.Min=range.Min;
10942
+ }
10943
+
10944
+ if (item.Frame.YSpecificMaxMin) //固定坐标
10945
+ {
10946
+ item.Min=item.Frame.YSpecificMaxMin.Max;
10947
+ item.Max=item.Frame.YSpecificMaxMin.Min;
10948
+ }
10949
+
10950
+ if (!IFrameSplitOperator.IsNumber(frame.YMaxMin.Max) || frame.YMaxMin.Max!=item.Max)
10951
+ {
10952
+ frame.YMaxMin.Max=item.Max;
10953
+ frame.XYSplit=true;
10954
+ }
10955
+
10956
+ if (!IFrameSplitOperator.IsNumber(frame.YMaxMin.Min) || frame.YMaxMin.Min!=item.Min)
10957
+ {
10958
+ frame.YMaxMin.Min=item.Min
10959
+ frame.XYSplit=true;
10960
+ }
10961
+
10962
+ if (frame.XYSplit)
10963
+ {
10964
+ var max=10, min=0;
10965
+ if (item.Max!=null) max=item.Max;
10966
+ if (item.Min!=null) min=item.Min;
10967
+
10968
+ frame.HorizontalMax=max;
10969
+ frame.HorizontalMin=min;
10970
+
10971
+ for(var j=0;j<item.OverlayFrame.length;++j)
10972
+ {
10973
+ item.OverlayFrame[j].XYSplit=true;
10974
+ }
10975
+ }
10976
+
10977
+
10978
+ //独立坐标叠加指标
10979
+ for(var i=0;i<item.SingleOverlay.length;++i)
10980
+ {
10981
+ var overlayItem=item.SingleOverlay[i];
10982
+ overlayItem.UpdateFrameMaxMin();
10983
+ }
10984
+ }
10985
+ }
10986
+
10853
10987
  this.UpdateFrameMaxMin=function()
10854
10988
  {
10989
+ this.UpdateFrameMaxMinV2();
10990
+
10991
+ return;
10992
+
10855
10993
  var frameMaxMinData=new Array();
10856
10994
 
10857
10995
  var chartPaint=new Array();
@@ -13225,6 +13363,9 @@ function IChartFramePainting()
13225
13363
  this.HorizontalMin; //Y轴最小值
13226
13364
  this.XPointCount=10; //X轴数据个数
13227
13365
 
13366
+ //Y轴原始的最大值 最小值
13367
+ this.YMaxMin={ Max:null, Min:null };
13368
+
13228
13369
  this.YSplitOperator; //Y轴分割
13229
13370
  this.XSplitOperator; //X轴分割
13230
13371
  this.Data; //主数据
@@ -29672,57 +29813,122 @@ function ChartKLine()
29672
29813
  var item=orderFlow.Order[i];
29673
29814
  var yPrice=this.GetYFromData(item.Price, false);
29674
29815
  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
29816
 
29682
- if (preItem && item.Price>preItem.Price)
29817
+ if (IFrameSplitOperator.IsNonEmptyArray(item.AryVol))
29683
29818
  {
29684
- rect.Bottom=preItem.Rect.Top-volBarSpace;
29685
- }
29819
+ var barWidth=xKLine.Right-xKLine.Left;
29686
29820
 
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;
29821
+ var xVolLeft=xKLine.Left;
29822
+ var xVolRight=xVolLeft;
29823
+ var totalVol=0;
29824
+ var rtDraw={ Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
29825
+ for(var j=0;j<item.AryVol.length;++j)
29826
+ {
29827
+ var itemVol=item.AryVol[j];
29828
+ if (!IFrameSplitOperator.IsNumber(itemVol.Value)) continue;
29829
+ totalVol+=itemVol.Value;
29830
+ xVolRight=barWidth*(totalVol-min)/(max-min)+xKLine.Left;
29831
+ var rtBar={ Left:xVolLeft, Right:xVolRight, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
29832
+ if (preItem && item.Price>preItem.Price)
29833
+ {
29834
+ rtBar.Bottom=preItem.Rect.Top-volBarSpace;
29835
+ }
29836
+ rtBar.Width=rtBar.Right-rtBar.Left;
29837
+ rtBar.Height=rtBar.Bottom-rtBar.Top;
29695
29838
 
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
- }
29839
+ rtDraw={ Left:ToFixedRect(rtBar.Left), Top:ToFixedRect(rtBar.Top), Width:ToFixedRect(rtBar.Width), Height:ToFixedRect(rtBar.Height) };
29840
+ rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
29841
+ rtDraw.Right=rtDraw.Left+rtDraw.Width;
29842
+ if (rtDraw.Width<1) rtDraw.Width=1;
29701
29843
 
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
- }
29844
+ if (itemVol.BG) //背景色
29845
+ {
29846
+ this.Canvas.fillStyle=itemVol.BG;
29847
+ this.Canvas.fillRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
29848
+ }
29707
29849
 
29708
- if (item.Vol.Text && this.IsShowOrderText) //文字
29709
- {
29710
- this.Canvas.fillStyle=item.Vol.Color;
29850
+ xVolLeft=rtDraw.Right;
29851
+ }
29711
29852
 
29712
- if (item.Vol.Font)
29853
+ rtDraw.Left=xKLine.Left;
29854
+ rtDraw.Width=rtDraw.Right-rtDraw.Left;
29855
+ if (item.Vol.Text && this.IsShowOrderText) //文字
29713
29856
  {
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;
29857
+ this.Canvas.fillStyle=item.Vol.Color;
29858
+
29859
+ if (item.Vol.Font)
29860
+ {
29861
+ var itemFont=this.GetDynamicOrderFlowFont(cellHeight, barWidth/2, item.Vol.Font);
29862
+ this.Canvas.font=itemFont;
29863
+ this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);
29864
+ this.Canvas.font=textFont;
29865
+ }
29866
+ else
29867
+ {
29868
+ this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
29869
+ }
29718
29870
  }
29719
- else
29871
+
29872
+ preItem={ Price: item.Price, Rect:rtDraw };
29873
+ }
29874
+ else if (IFrameSplitOperator.IsNumber(item.Vol.Value))
29875
+ {
29876
+ var barWidth=xKLine.Right-xKLine.Left;
29877
+ var volWidth=barWidth*(item.Vol.Value-min)/(max-min);
29878
+ var rect={ Left:xKLine.Left, Right:xKLine.Right, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
29879
+ rect.Right=rect.Left+volWidth;
29880
+
29881
+ if (preItem && item.Price>preItem.Price)
29882
+ {
29883
+ rect.Bottom=preItem.Rect.Top-volBarSpace;
29884
+ }
29885
+
29886
+ rect.Width=rect.Right-rect.Left;
29887
+ rect.Height=rect.Bottom-rect.Top;
29888
+
29889
+
29890
+ var rtDraw={ Left:ToFixedRect(rect.Left), Top:ToFixedRect(rect.Top), Width:ToFixedRect(rect.Width), Height:ToFixedRect(rect.Height) };
29891
+ rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
29892
+ rtDraw.Right=rtDraw.Left+rtDraw.Width;
29893
+ if (rtDraw.Width<1) rtDraw.Width=1;
29894
+
29895
+ if (item.Vol.BG) //背景色
29896
+ {
29897
+ this.Canvas.fillStyle=item.Vol.BG;
29898
+ this.Canvas.fillRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
29899
+ }
29900
+
29901
+ if (item.Vol.BorderColor) //边框
29720
29902
  {
29721
- this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
29903
+ this.Canvas.strokeStyle = item.Vol.BorderColor;
29904
+ this.Canvas.strokeRect(ToFixedPoint(rtDraw.Left), ToFixedPoint(rtDraw.Top), rtDraw.Width, rtDraw.Height);
29722
29905
  }
29906
+
29907
+ if (item.Vol.Text && this.IsShowOrderText) //文字
29908
+ {
29909
+ this.Canvas.fillStyle=item.Vol.Color;
29910
+
29911
+ if (item.Vol.Font)
29912
+ {
29913
+ var itemFont=this.GetDynamicOrderFlowFont(cellHeight, barWidth/2, item.Vol.Font);
29914
+ this.Canvas.font=itemFont;
29915
+ this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);
29916
+ this.Canvas.font=textFont;
29917
+ }
29918
+ else
29919
+ {
29920
+ this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
29921
+ }
29922
+ }
29923
+
29924
+ preItem={ Price: item.Price, Rect:rtDraw };
29723
29925
  }
29724
-
29725
- preItem={ Price: item.Price, Rect:rtDraw };
29926
+ else
29927
+ {
29928
+ continue;
29929
+ }
29930
+
29931
+
29726
29932
  }
29727
29933
  }
29728
29934
  }
@@ -130467,7 +130673,7 @@ function HQChartScriptWorker()
130467
130673
 
130468
130674
 
130469
130675
 
130470
- var HQCHART_VERSION="1.1.12668";
130676
+ var HQCHART_VERSION="1.1.12677";
130471
130677
 
130472
130678
  function PrintHQChartVersion()
130473
130679
  {
@@ -68,7 +68,8 @@ function IChartFramePainting()
68
68
 
69
69
  this.HorizontalMax; //Y轴最大值
70
70
  this.HorizontalMin; //Y轴最小值
71
- this.XPointCount = 10; //X轴数据个数
71
+ this.XPointCount = 10; //X轴数据个数
72
+ this.YMaxMin={ Max:null, Min:null }; //Y轴原始的最大值 最小值
72
73
 
73
74
  this.YSplitOperator; //Y轴分割
74
75
  this.XSplitOperator; //X轴分割
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.12666";
8
+ var HQCHART_VERSION="1.1.12676";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -2630,8 +2630,135 @@ function JSChartContainer(uielement)
2630
2630
  if (typeof (this.Frame.ResetXYSplit) == 'function') this.Frame.ResetXYSplit();
2631
2631
  }
2632
2632
 
2633
+ this.UpdateFrameMaxMinV2=function()
2634
+ {
2635
+ var mapFrame=new Map(); //key=frameid, value:{ ChartPaint:[] }
2636
+ for(var i=0;i<this.Frame.SubFrame.length;++i)
2637
+ {
2638
+ var subItem=this.Frame.SubFrame[i];
2639
+ if (!subItem || !subItem.Frame) continue;
2640
+
2641
+ var frame=subItem.Frame;
2642
+ var key=frame.Identify;
2643
+ var item=
2644
+ {
2645
+ ID:key, Frame:frame, ChartPaint:[] , Max:null, Min:null,
2646
+ OverlayFrame:[], //共享坐标
2647
+ SingleOverlay:[] //独立坐标
2648
+ };
2649
+
2650
+ for(var j=0;j<subItem.OverlayIndex.length;++j)
2651
+ {
2652
+ var overlayItem=subItem.OverlayIndex[j];
2653
+ var overlayFrame=overlayItem.Frame;
2654
+ if (overlayFrame.IsShareY)
2655
+ {
2656
+ if (!overlayFrame.MainFrame) continue;
2657
+ if (overlayFrame.IsCalculateYMaxMin===false) continue; //叠加坐标Y轴不调整
2658
+ item.OverlayFrame.push(overlayFrame);
2659
+ for(var k=0; k<overlayItem.ChartPaint.length; ++k)
2660
+ {
2661
+ var chart=overlayItem.ChartPaint[k];
2662
+ item.ChartPaint.push(chart);
2663
+ }
2664
+ }
2665
+ else
2666
+ {
2667
+ item.SingleOverlay.push(overlayItem);
2668
+ }
2669
+
2670
+ }
2671
+
2672
+ mapFrame.set(key, item);
2673
+ }
2674
+
2675
+ for(var i=0;i<this.ChartPaint.length;++i)
2676
+ {
2677
+ var chart=this.ChartPaint[i];
2678
+ var key=chart.ChartFrame.Identify;
2679
+ if (!mapFrame.has(key)) continue;
2680
+
2681
+ var finder=mapFrame.get(key);
2682
+ finder.ChartPaint.push(chart);
2683
+ }
2684
+
2685
+ for(var i=0;i<this.OverlayChartPaint.length;++i)
2686
+ {
2687
+ var chart=this.OverlayChartPaint[i];
2688
+ if (!chart.ChartFrame) continue;
2689
+ var key=chart.ChartFrame.Identify;
2690
+ if (!mapFrame.has(key)) continue;
2691
+
2692
+ var finder=mapFrame.get(key);
2693
+ finder.ChartPaint.push(chart);
2694
+ }
2695
+
2696
+ for(var mapItem of mapFrame)
2697
+ {
2698
+ var item=mapItem[1];
2699
+ var frame=item.Frame;
2700
+ //计算主框架最大最小
2701
+ for(var i=0;i<item.ChartPaint.length;++i)
2702
+ {
2703
+ var chart=item.ChartPaint[i];
2704
+ if (chart.IsShow==false) continue; //隐藏的图形不计算
2705
+ if (chart.NotSupportMessage) continue;
2706
+ if (!chart.ChartFrame) continue;
2707
+
2708
+ var range=chart.GetMaxMin();
2709
+ if (range==null || range.Max==null || range.Min==null) continue;
2710
+
2711
+ if (item.Max==null || item.Max<range.Max) item.Max=range.Max;
2712
+ if (item.Min==null || item.Min>range.Min) item.Min=range.Min;
2713
+ }
2714
+
2715
+ if (item.Frame.YSpecificMaxMin) //固定坐标
2716
+ {
2717
+ item.Min=item.Frame.YSpecificMaxMin.Max;
2718
+ item.Max=item.Frame.YSpecificMaxMin.Min;
2719
+ }
2720
+
2721
+ if (!IFrameSplitOperator.IsNumber(frame.YMaxMin.Max) || frame.YMaxMin.Max!=item.Max)
2722
+ {
2723
+ frame.YMaxMin.Max=item.Max;
2724
+ frame.XYSplit=true;
2725
+ }
2726
+
2727
+ if (!IFrameSplitOperator.IsNumber(frame.YMaxMin.Min) || frame.YMaxMin.Min!=item.Min)
2728
+ {
2729
+ frame.YMaxMin.Min=item.Min
2730
+ frame.XYSplit=true;
2731
+ }
2732
+
2733
+ if (frame.XYSplit)
2734
+ {
2735
+ var max=10, min=0;
2736
+ if (item.Max!=null) max=item.Max;
2737
+ if (item.Min!=null) min=item.Min;
2738
+
2739
+ frame.HorizontalMax=max;
2740
+ frame.HorizontalMin=min;
2741
+
2742
+ for(var j=0;j<item.OverlayFrame.length;++j)
2743
+ {
2744
+ item.OverlayFrame[j].XYSplit=true;
2745
+ }
2746
+ }
2747
+
2748
+
2749
+ //独立坐标叠加指标
2750
+ for(var i=0;i<item.SingleOverlay.length;++i)
2751
+ {
2752
+ var overlayItem=item.SingleOverlay[i];
2753
+ overlayItem.UpdateFrameMaxMin();
2754
+ }
2755
+ }
2756
+ }
2633
2757
  this.UpdateFrameMaxMin = function ()
2634
2758
  {
2759
+ this.UpdateFrameMaxMinV2();
2760
+ return;
2761
+
2635
2762
  var frameMaxMinData = new Array();
2636
2763
  var chartPaint = new Array();
2637
2764