hqchart 1.1.14626 → 1.1.14630

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.
@@ -6610,7 +6610,7 @@ JSChart.GetfloatPrecision=function(symbol)
6610
6610
  //获取不带后缀的代码
6611
6611
  JSChart.GetShortSymbol=function(symbol)
6612
6612
  {
6613
- if (IFrameSplitOperator.IsString(symbol)) return null;
6613
+ if (!IFrameSplitOperator.IsString(symbol)) return null;
6614
6614
  var pos=symbol.lastIndexOf(".");
6615
6615
  if (pos<=0) return symbol;
6616
6616
 
@@ -36693,28 +36693,87 @@ function ChartKLineTable()
36693
36693
  this.ClassName='ChartKlineTable'; //类名
36694
36694
  this.Data;
36695
36695
  this.RowName;
36696
- this.IsShowRowName=false;
36696
+ this.RowNamePosition=1; //0=不显示 1=左边内部 2=左边外部 3=右边外部
36697
36697
  this.BGColor; //背景色
36698
+ this.BorderColor; //分割线颜色
36698
36699
 
36699
36700
  this.RowCount=5; //行数
36700
36701
  this.RowHeight=10; //行高
36702
+ this.RowHeightType=1; //0=均分 1=固定高度
36701
36703
  this.TextFontConfig=CloneData(g_JSChartResource.ChartKLineTable.TextFont);
36702
36704
  this.ItemMergin=CloneData(g_JSChartResource.ChartKLineTable.ItemMergin);
36703
36705
 
36704
36706
  this.TextFont;
36705
36707
  this.TextColor='rgb(0,0,0)';
36706
- this.NameColor="rgb(0,0,0)";
36707
36708
 
36708
- this.Draw=function()
36709
+ this.AryTableData=[];
36710
+ this.MapCache=null; //key=date/date-time value={ Date:, Time:, Data:[ ] }
36711
+ this.GetKValue=ChartData.GetKValue;
36712
+
36713
+ this.BuildCacheData=function()
36709
36714
  {
36710
- if (!this.IsShow || this.ChartFrame.IsMinSize) return;
36711
- if (this.NotSupportMessage)
36715
+ var mapData=new Map();
36716
+ this.MapCache=mapData;
36717
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryTableData)) return;
36718
+
36719
+ for(var i=0;i<this.AryTableData.length;++i)
36712
36720
  {
36713
- this.DrawNotSupportmessage();
36714
- return;
36721
+ var item=this.AryTableData[i];
36722
+ var key=this.BuildKey(item);
36723
+ mapData.set(key,item);
36715
36724
  }
36725
+ }
36716
36726
 
36717
- if (!this.Data || !this.Data.Data) return;
36727
+ //绘制背景色
36728
+ this.DrawBG=function(rtBG)
36729
+ {
36730
+ if (!this.BGColor) return;
36731
+
36732
+ if (this.BGColor)
36733
+ {
36734
+ this.Canvas.fillStyle=this.BGColor;
36735
+ this.Canvas.fillRect(rtBG.Left+1, rtBG.Top, rtBG.Width-1, rtBG.Height);
36736
+ }
36737
+ }
36738
+
36739
+ this.DrawBorder=function(rtBG)
36740
+ {
36741
+ if (!this.BorderColor) return;
36742
+
36743
+ var yLine=rtBG.Top;
36744
+ for(var i=0;i<30;++i)
36745
+ {
36746
+ this.Canvas.beginPath();
36747
+ this.Canvas.moveTo(rtBG.Left,ToFixedPoint(yLine));
36748
+ this.Canvas.lineTo(rtBG.Right,ToFixedPoint(yLine));
36749
+ this.Canvas.stroke();
36750
+
36751
+ yLine+=this.RowHeight;
36752
+ if (yLine>=rtBG.Bottom) break;
36753
+ }
36754
+ }
36755
+
36756
+ //计算行高
36757
+ this.CalculateRowHeight=function(rtBG)
36758
+ {
36759
+ if (this.RowHeightType==1)
36760
+ {
36761
+ this.RowHeight=this.TextFontConfig.FontMaxSize+this.ItemMergin.Top+this.ItemMergin.Bottom;
36762
+ }
36763
+ else
36764
+ {
36765
+ this.RowHeight=rtBG.Height/this.RowCount;
36766
+ }
36767
+ }
36768
+
36769
+ this.Draw=function()
36770
+ {
36771
+ if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
36772
+ if (this.IsShowIndexTitleOnly()) return;
36773
+ if (this.IsHideScriptIndex()) return;
36774
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryTableData)) return;
36775
+ if (!this.MapCache || this.MapCache.size<=0) return;
36776
+ if(!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return;
36718
36777
 
36719
36778
  var isHScreen=(this.ChartFrame.IsHScreen===true);
36720
36779
  if (isHScreen) return;
@@ -36725,24 +36784,22 @@ function ChartKLineTable()
36725
36784
  var xPointCount=this.ChartFrame.XPointCount;
36726
36785
  var border=this.ChartFrame.GetBorder();
36727
36786
  var height=border.Bottom-border.TopTitle;
36728
- this.RowHeight=height/this.RowCount;
36729
36787
  var xOffset=border.LeftEx+g_JSChartResource.FrameLeftMargin;
36730
36788
  var chartright=border.RightEx;
36731
36789
  var top=border.TopTitle;
36732
36790
  var bottom=border.Bottom;
36733
36791
 
36734
- if (this.BGColor)
36735
- {
36736
- this.Canvas.fillStyle=this.BGColor;
36737
- var left=border.LeftEx;
36738
- var width=border.RightEx-border.LeftEx;
36739
- var height=bottom-top;
36740
- this.Canvas.fillRect(left, top, width, height);
36741
- }
36792
+ //绘制背景
36793
+ var rtBG={ Left:border.LeftEx, Top:top, Right:border.RightEx, Bottom:bottom };
36794
+ rtBG.Width=rtBG.Right-rtBG.Left;
36795
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
36796
+ this.DrawBG(rtBG);
36742
36797
 
36798
+ this.CalculateRowHeight(rtBG);
36799
+
36743
36800
  var itemHeight=this.RowHeight;
36744
36801
  var itemWidth=dataWidth+distanceWidth;
36745
- if (itemHeight-this.ItemMergin.Top-this.ItemMergin.Bottom>0) itemHeight=itemHeight-this.ItemMergin.Left-this.ItemMergin.Right;
36802
+ if (itemHeight-this.ItemMergin.Top-this.ItemMergin.Bottom>0) itemHeight=itemHeight-this.ItemMergin.Top-this.ItemMergin.Bottom;
36746
36803
  if (itemWidth-this.ItemMergin.Left-this.ItemMergin.Right>0) itemWidth=itemWidth-this.ItemMergin.Left-this.ItemMergin.Right;
36747
36804
 
36748
36805
  var font=this.GetDynamicTextFont(itemHeight, itemWidth);
@@ -36751,8 +36808,8 @@ function ChartKLineTable()
36751
36808
 
36752
36809
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
36753
36810
  {
36754
- var item=this.Data.Data[i];
36755
- if (!item) continue;
36811
+ var kItem=this.Data.Data[i];
36812
+ if (!kItem) continue;
36756
36813
 
36757
36814
  var left=xOffset;
36758
36815
  var right=xOffset+dataWidth+distanceWidth;
@@ -36760,15 +36817,20 @@ function ChartKLineTable()
36760
36817
  var x=left+(right-left)/2;
36761
36818
  if (x>chartright) break;
36762
36819
 
36763
- if (j==0 && this.IsShowRowName)
36764
- {
36765
- this.DrawRowName(top, bottom, left, right);
36766
- }
36767
- else
36768
- {
36769
- this.DrawRow(item, top, bottom, left, right); //绘制一列
36770
- }
36820
+ var bDrawName=false;
36821
+ if (j==0 && this.RowNamePosition===1) bDrawName=true;
36822
+ if (bDrawName) this.DrawRowName(top, bottom, left, right);
36823
+
36824
+ var key=this.BuildKey(kItem);
36825
+ if (!this.MapCache.has(key)) continue;
36826
+ var mapItem=this.MapCache.get(key);
36827
+
36828
+ if (!bDrawName) this.DrawRow(mapItem, top, bottom, left, right); //绘制一列
36771
36829
  }
36830
+
36831
+ if (this.RowNamePosition==3) this.DrawRightRowName();
36832
+
36833
+ this.DrawBorder(rtBG);
36772
36834
  }
36773
36835
 
36774
36836
  this.DrawRowName=function(top, bottom, left, right)
@@ -36776,32 +36838,35 @@ function ChartKLineTable()
36776
36838
  if (!IFrameSplitOperator.IsNonEmptyArray(this.RowName)) return;
36777
36839
 
36778
36840
  var x=left,y=top, width=right-left;
36841
+ var yOffset=3;
36842
+ if (this.ItemMergin.YOffset) yOffset=this.ItemMergin.YOffset;
36779
36843
  for(var i=0;i<this.RowName.length;++i)
36780
36844
  {
36781
36845
  var item=this.RowName[i];
36782
36846
 
36783
36847
  var rtBG={Left:x, Top:y, Right:right, Height:this.RowHeight, Width:width };
36784
36848
  rtBG.Bottom=rtBG.Top+this.RowHeight;
36849
+ var yText=rtBG.Bottom-yOffset;
36785
36850
 
36786
36851
  if (item.Name && rtBG.Width>10)
36787
36852
  {
36788
36853
  this.Canvas.fillStyle=item.Color?item.Color:this.TextColor;
36789
- this.Canvas.textBaseline='middle';
36854
+ this.Canvas.textBaseline='bottom';
36790
36855
 
36791
36856
  if (item.TextAlign=='right')
36792
36857
  {
36793
36858
  this.Canvas.textAlign='right';
36794
- this.Canvas.fillText(item.Name,rtBG.Right-2,rtBG.Top+this.RowHeight/2, width-4);
36859
+ this.Canvas.fillText(item.Name,rtBG.Right-2,yText, width-4);
36795
36860
  }
36796
36861
  else if (item.TextAlign=='center')
36797
36862
  {
36798
36863
  this.Canvas.textAlign='center';
36799
- this.Canvas.fillText(item.Name,rtBG.Left+rtBG.Width/2,rtBG.Top+this.RowHeight/2, width-4);
36864
+ this.Canvas.fillText(item.Name,rtBG.Left+rtBG.Width/2,yText, width-4);
36800
36865
  }
36801
36866
  else
36802
36867
  {
36803
36868
  this.Canvas.textAlign='left';
36804
- this.Canvas.fillText(item.Name,rtBG.Left+2,rtBG.Top+this.RowHeight/2, width-4);
36869
+ this.Canvas.fillText(item.Name,rtBG.Left+2,yText, width-4);
36805
36870
  }
36806
36871
  }
36807
36872
 
@@ -36809,40 +36874,129 @@ function ChartKLineTable()
36809
36874
  }
36810
36875
  }
36811
36876
 
36877
+ //绘制右侧行名
36878
+ this.DrawRightRowName=function()
36879
+ {
36880
+ var border=this.ChartFrame.GetBorder();
36881
+
36882
+ if (this.BGColor)
36883
+ {
36884
+ var rtRightBG={Left:border.RightEx, Top:border.TopTitle, Right:border.ChartWidth, Bottom:border.Bottom };
36885
+ rtRightBG.Width=rtRightBG.Right-rtRightBG.Left;
36886
+ rtRightBG.Height=rtRightBG.Bottom-rtRightBG.Top;
36887
+ this.Canvas.fillStyle=this.BGColor;
36888
+ this.Canvas.fillRect(rtRightBG.Left+1, rtRightBG.Top, rtRightBG.Width-1, rtRightBG.Height);
36889
+ }
36890
+
36891
+ var x=border.RightEx, y=border.TopTitle;
36892
+ var yOffset=3;
36893
+ if (this.ItemMergin.YOffset) yOffset=this.ItemMergin.YOffset;
36894
+ for(var i=0;i<this.RowName.length;++i)
36895
+ {
36896
+ var item=this.RowName[i];
36897
+
36898
+ var rtBG={Left:x, Top:y, Right:border.ChartWidth, Height:this.RowHeight };
36899
+ rtBG.Bottom=rtBG.Top+this.RowHeight;
36900
+ rtBG.Width=rtBG.Right-rtBG.Left;
36901
+ var yText=rtBG.Bottom-yOffset;
36902
+
36903
+ if (item.Name && rtBG.Width>10)
36904
+ {
36905
+ this.Canvas.fillStyle=item.Color?item.Color:this.TextColor;
36906
+ this.Canvas.textBaseline='bottom';
36907
+ this.Canvas.textAlign='left';
36908
+ this.Canvas.fillText(item.Name,rtBG.Left+2,yText);
36909
+ }
36910
+
36911
+ y+=this.RowHeight;
36912
+ }
36913
+ }
36914
+
36915
+
36812
36916
  this.DrawRow=function(data, top, bottom, left, right)
36813
36917
  {
36918
+ if (!IFrameSplitOperator.IsNonEmptyArray(data.Data)) return;
36919
+
36814
36920
  var x=left,y=top, width=right-left;
36815
- for(var i=0;i<data.length;++i)
36921
+ var yOffset=3;
36922
+ if (this.ItemMergin.YOffset) yOffset=this.ItemMergin.YOffset;
36923
+ for(var i=0;i<data.Data.length;++i)
36816
36924
  {
36817
- var item=data[i];
36925
+ var item=data.Data[i];
36818
36926
  var rtBG={Left:x, Top:y, Right:right, Height:this.RowHeight, Width:width };
36819
36927
  rtBG.Bottom=rtBG.Top+this.RowHeight;
36820
36928
 
36821
- if (item.BGColor)
36929
+ if (IFrameSplitOperator.IsNonEmptyArray(item.AryText)) //左右显示
36822
36930
  {
36823
- this.Canvas.fillStyle=item.BGColor;
36824
- this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
36825
- }
36931
+ var subCellWidth=rtBG.Width/item.AryText.length;
36932
+ var xCell=rtBG.Left;
36933
+ for(var j=0;j<item.AryText.length;++j)
36934
+ {
36935
+ var subItem=item.AryText[j];
36936
+ var rtSubBG={ Left:xCell, Top:rtBG.Top, Bottom:rtBG.Bottom, Width:subCellWidth, Height:rtBG.Height };
36937
+ rtSubBG.Right=rtSubBG.Left+rtSubBG.Width;
36826
36938
 
36827
- if (item.Color && rtBG.Width>10)
36828
- {
36829
- this.Canvas.fillStyle=item.Color;
36830
- this.Canvas.textBaseline='middle';
36939
+ if (subItem && subItem.BGColor)
36940
+ {
36941
+ this.Canvas.fillStyle=subItem.BGColor;
36942
+ this.Canvas.fillRect(rtSubBG.Left, rtSubBG.Top, rtSubBG.Width, rtSubBG.Height);
36943
+ }
36831
36944
 
36832
- if (item.TextAlign=='right')
36833
- {
36834
- this.Canvas.textAlign='right';
36835
- this.Canvas.fillText(item.Text,rtBG.Right-2,rtBG.Top+this.RowHeight/2, width-4);
36945
+ if (subItem && subItem.Color && subCellWidth>10)
36946
+ {
36947
+ this.Canvas.fillStyle=subItem.Color;
36948
+ this.Canvas.textBaseline='bottom';
36949
+ var yText=rtSubBG.Bottom-yOffset;
36950
+
36951
+ if (subItem.TextAlign=='right')
36952
+ {
36953
+ this.Canvas.textAlign='right';
36954
+ this.Canvas.fillText(subItem.Text,rtSubBG.Right-2,yText, width-4);
36955
+ }
36956
+ else if (subItem.TextAlign=='center')
36957
+ {
36958
+ this.Canvas.textAlign='center';
36959
+ this.Canvas.fillText(subItem.Text,rtSubBG.Left+rtSubBG.Width/2,yText, width-4);
36960
+ }
36961
+ else
36962
+ {
36963
+ this.Canvas.textAlign='left';
36964
+ this.Canvas.fillText(subItem.Text,rtSubBG.Left+2,yText, width-4);
36965
+ }
36966
+ }
36967
+
36968
+ xCell+=subCellWidth;
36836
36969
  }
36837
- else if (item.TextAlign=='center')
36970
+ }
36971
+ else
36972
+ {
36973
+ if (item && item.BGColor)
36838
36974
  {
36839
- this.Canvas.textAlign='center';
36840
- this.Canvas.fillText(item.Text,rtBG.Left+rtBG.Width/2,rtBG.Top+this.RowHeight/2, width-4);
36975
+ this.Canvas.fillStyle=item.BGColor;
36976
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
36841
36977
  }
36842
- else
36978
+
36979
+ if (item && item.Color && rtBG.Width>10)
36843
36980
  {
36844
- this.Canvas.textAlign='left';
36845
- this.Canvas.fillText(item.Text,rtBG.Left+2,rtBG.Top+this.RowHeight/2, width-4);
36981
+ this.Canvas.fillStyle=item.Color;
36982
+ this.Canvas.textBaseline='bottom';
36983
+ var yText=rtBG.Bottom-yOffset;
36984
+
36985
+ if (item.TextAlign=='right')
36986
+ {
36987
+ this.Canvas.textAlign='right';
36988
+ this.Canvas.fillText(item.Text,rtBG.Right-2,yText, width-4);
36989
+ }
36990
+ else if (item.TextAlign=='center')
36991
+ {
36992
+ this.Canvas.textAlign='center';
36993
+ this.Canvas.fillText(item.Text,rtBG.Left+rtBG.Width/2,yText, width-4);
36994
+ }
36995
+ else
36996
+ {
36997
+ this.Canvas.textAlign='left';
36998
+ this.Canvas.fillText(item.Text,rtBG.Left+2,yText, width-4);
36999
+ }
36846
37000
  }
36847
37001
  }
36848
37002
 
@@ -100551,11 +100705,13 @@ var MARKET_SUFFIX_NAME=
100551
100705
 
100552
100706
  if (this.IsSH(upperSymbol))
100553
100707
  {
100554
- if (upperSymbol.charAt(0)=="1" && upperSymbol.length==8) return true;
100708
+ var shortSymbol=JSChart.GetShortSymbol(upperSymbol);
100709
+ if (shortSymbol.charAt(0)=="1" && shortSymbol.length==8) return true;
100555
100710
  }
100556
100711
  else if (this.IsSZ(upperSymbol))
100557
100712
  {
100558
- if (upperSymbol.charAt(0)=="9" && upperSymbol.length==8) return true;
100713
+ var shortSymbol=JSChart.GetShortSymbol(upperSymbol);
100714
+ if (shortSymbol.charAt(0)=="9" && shortSymbol.length==8) return true;
100559
100715
  }
100560
100716
 
100561
100717
  return false;
@@ -126521,16 +126677,41 @@ function ScriptIndex(name,script,args,option)
126521
126677
  chart.HQChart=hqChart;
126522
126678
  chart.Identify=this.Guid;
126523
126679
 
126524
- chart.Data.Data=varItem.Draw.DrawData;
126680
+ chart.Data=hqChart.GetKData(); //绑定K线
126681
+ chart.AryTableData=varItem.Draw.DrawData;
126525
126682
  if (IFrameSplitOperator.IsNumber(varItem.Draw.RowCount)) chart.RowCount=varItem.Draw.RowCount;
126526
- if (IFrameSplitOperator.IsBool(varItem.Draw.IsShowRowName)) chart.IsShowRowName=varItem.Draw.IsShowRowName;
126527
126683
  if (IFrameSplitOperator.IsNonEmptyArray(varItem.Draw.RowName)) chart.RowName=varItem.Draw.RowName;
126528
- if (varItem.Draw.BGColor) chart.BGColor=varItem.Draw.BGColor;
126529
126684
 
126685
+ var config=varItem.Draw.Config;
126686
+ if (config)
126687
+ {
126688
+ if (config.BGColor) chart.BGColor=config.BGColor;
126689
+ if (config.TextColor) chart.TextColor=config.TextColor;
126690
+ if (config.BorderColor) chart.BorderColor=config.BorderColor;
126691
+ if (IFrameSplitOperator.IsNumber(config.RowNamePosition)) chart.RowNamePosition=config.RowNamePosition;
126692
+
126693
+ if (config.ItemMergin)
126694
+ {
126695
+ var subItem=config.ItemMergin;
126696
+ if (IFrameSplitOperator.IsNumber(subItem.Left)) chart.ItemMergin.Left=subItem.Left;
126697
+ if (IFrameSplitOperator.IsNumber(subItem.Top)) chart.ItemMergin.Top=subItem.Top;
126698
+ if (IFrameSplitOperator.IsNumber(subItem.Bottom)) chart.ItemMergin.Bottom=subItem.Bottom;
126699
+ if (IFrameSplitOperator.IsNumber(subItem.Right)) chart.ItemMergin.Right=subItem.Right;
126700
+ if (IFrameSplitOperator.IsNumber(subItem.YOffset)) chart.ItemMergin.YOffset=subItem.YOffset;
126701
+ }
126702
+
126703
+ if (config.TextFont)
126704
+ {
126705
+ var subItem=config.TextFont;
126706
+ if (IFrameSplitOperator.IsNumber(subItem.FontMaxSize)) chart.TextFontConfig.FontMaxSize=subItem.FontMaxSize;
126707
+ if (subItem.Family) chart.TextFontConfig.Family=subItem.Family;
126708
+ }
126709
+ }
126710
+
126711
+ chart.BuildCacheData();
126530
126712
  hqChart.ChartPaint.push(chart);
126531
126713
 
126532
126714
  var titleIndex=windowIndex+1;
126533
-
126534
126715
  var titleData=new DynamicTitleData(chart.Data,chart.BarName,chart.BarColor);
126535
126716
  titleData.DataType="ChartKLineTable";
126536
126717
  hqChart.TitlePaint[titleIndex].Data[i]=titleData;
@@ -129522,13 +129703,11 @@ function APIScriptIndex(name,script,args,option, isOverlay)
129522
129703
  drawItem.Name=draw.Name;
129523
129704
  drawItem.Type=draw.Type;
129524
129705
  drawItem.DrawType=draw.DrawType;
129525
- drawItem.DrawData=this.FittingArray(draw.DrawData,date,time,hqChart,1);
129706
+ drawItem.DrawData=draw.DrawData;
129526
129707
  drawItem.RowCount=draw.RowCount;
129527
129708
  drawItem.RowName=draw.RowName;
129528
- drawItem.IsShowRowName=draw.IsShowRowName;
129529
- drawItem.BGColor=draw.BGColor;
129709
+ drawItem.Config=draw.Config;
129530
129710
  outVarItem.Draw=drawItem;
129531
-
129532
129711
  result.push(outVarItem);
129533
129712
  }
129534
129713
  else if (draw.DrawType=='MULTI_TEXT')
@@ -146448,7 +146627,7 @@ function ScrollBarBGChart()
146448
146627
 
146449
146628
 
146450
146629
 
146451
- var HQCHART_VERSION="1.1.14625";
146630
+ var HQCHART_VERSION="1.1.14629";
146452
146631
 
146453
146632
  function PrintHQChartVersion()
146454
146633
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.14625";
8
+ var HQCHART_VERSION="1.1.14629";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {