hqchart 1.1.14542 → 1.1.14552

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.
@@ -7350,6 +7350,51 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7350
7350
  this.DialogSearchIndex=null;
7351
7351
  }
7352
7352
 
7353
+ this.DestroyDialogDrawTool=function()
7354
+ {
7355
+ if (!this.DialogDrawTool) return;
7356
+
7357
+ this.DialogDrawTool.Destroy();
7358
+ this.DialogDrawTool=null;
7359
+ }
7360
+
7361
+ this.DestroyDialogModifyIndexParam=function()
7362
+ {
7363
+ if (this.DialogModifyIndexParam) return;
7364
+
7365
+ this.DialogModifyIndexParam.Destroy();
7366
+ this.DialogModifyIndexParam=null;
7367
+ }
7368
+
7369
+ this.DestroyDialogSelectRect=function()
7370
+ {
7371
+ if (!this.DialogSelectRect) return;
7372
+
7373
+ this.DialogSelectRect.Destroy();
7374
+ this.DialogSelectRect=null;
7375
+ }
7376
+
7377
+ this.DestroyDialogModifyDraw=function()
7378
+ {
7379
+ if (!this.DialogModifyDraw) return;
7380
+
7381
+ this.DialogModifyDraw.Destroy();
7382
+ this.DialogModifyDraw=null;
7383
+ }
7384
+
7385
+ //隐藏内置的弹框div
7386
+ this.HideAllPopDiv=function()
7387
+ {
7388
+ this.HideFloatTooltip();
7389
+ this.CloseTooltipDialog();
7390
+
7391
+ if (this.DialogDrawTool) this.DialogDrawTool.Close();
7392
+ this.CloseModifyDrawDialog();
7393
+
7394
+ if (this.DialogSelectRect) this.DialogSelectRect.Close();
7395
+ if (this.DialogSearchIndex) this.DialogSearchIndex.Close();
7396
+ if (this.DialogModifyIndexParam) this.DialogModifyIndexParam.Close();
7397
+ }
7353
7398
 
7354
7399
 
7355
7400
  //obj={ Element:, Canvas: }
@@ -7401,9 +7446,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7401
7446
  {
7402
7447
  this.IsDestroy=true;
7403
7448
  this.StopAutoUpdate();
7449
+
7404
7450
  this.DestroyTooltipDialog();
7405
7451
  this.DestroyFloatTooltip();
7452
+
7406
7453
  this.DestroySearchIndexDialog();
7454
+ this.DestroyDialogModifyIndexParam();
7455
+
7456
+ this.DestroyDialogDrawTool();
7457
+ this.DestroyDialogModifyDraw();
7458
+
7459
+ this.DestroyDialogSelectRect();
7407
7460
  }
7408
7461
 
7409
7462
  this.ChartDestory=this.ChartDestroy; //老版本写错了,需要兼容下
@@ -39953,23 +40006,22 @@ function ChartStickLine()
39953
40006
  delete this.newMethod;
39954
40007
 
39955
40008
  this.ClassName='ChartStickLine'; //类名
39956
- this.Color="rgb(255,193,37)"; //线段颜色
39957
- this.BarType=0; //柱子类型 0=实心 1=空心 -1=画虚线空心柱
39958
- this.LineDotted=[3,3]; //虚线设置
39959
- this.Width=0; //柱子宽度 0=1 3,50=k线宽度 101=K线宽度+间距宽度
40009
+ this.Color="rgb(255,193,37)"; //线段颜色
40010
+ this.BarType=0; //柱子类型 0=实心 1=空心 -1=画虚线空心柱
40011
+ this.LineDotted=[3,3]; //虚线设置
40012
+ this.Width=0; //柱子宽度 0=1 3,50=k线宽度 101=K线宽度+间距宽度
40013
+ this.IsHScreen=false;
40014
+
40015
+ this.EmptyBGColor=null; //空心柱子背景色(缓存)
40016
+ this.BarCache={ }; //Type:1=线段 2=柱子
39960
40017
 
39961
40018
  this.SetEmptyBar=function() //设置空心柱子
39962
40019
  {
39963
40020
  if (this.BarType!=1 && this.BarType!=-1) return false;
39964
40021
 
39965
- this.Canvas.lineWidth=GetDevicePixelRatio();
39966
- this.Canvas.strokeStyle=this.Color;
39967
40022
  var emptyBGColor=g_JSChartResource.EmptyBarBGColor;
39968
- if (emptyBGColor) this.Canvas.fillStyle=emptyBGColor;
39969
- if (this.BarType==-1) //虚线
39970
- {
39971
- this.Canvas.setLineDash(this.LineDotted); //虚线
39972
- }
40023
+ if (emptyBGColor) this.BarCache.EmptyBGColor=emptyBGColor;
40024
+ if (this.BarType==-1) this.BarCache.LineDotted=this.LineDotted;
39973
40025
 
39974
40026
  return true;
39975
40027
  }
@@ -39979,13 +40031,6 @@ function ChartStickLine()
39979
40031
  return (this.BarType==1 || this.BarType==-1);
39980
40032
  }
39981
40033
 
39982
- this.CalculateBarHeight=function(y,y2)
39983
- {
39984
- var barHeight=Math.abs(y-y2);
39985
- if (barHeight<=0) barHeight=1;
39986
- return barHeight;
39987
- }
39988
-
39989
40034
  this.Draw=function()
39990
40035
  {
39991
40036
  if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
@@ -40000,81 +40045,93 @@ function ChartStickLine()
40000
40045
 
40001
40046
  if (!this.Data || !this.Data.Data) return;
40002
40047
 
40003
- var isHScreen=(this.ChartFrame.IsHScreen===true);
40048
+ var pixelRatio=GetDevicePixelRatio();
40049
+ this.BarCache={ Color:this.Color, EmptyBGColor:null, Width:1*pixelRatio, Type:0, LineDotted:null };
40050
+
40051
+ this.IsHScreen=(this.ChartFrame.IsHScreen===true);;
40004
40052
  var dataWidth=this.ChartFrame.DataWidth;
40005
40053
  var distanceWidth=this.ChartFrame.DistanceWidth;
40006
40054
  var chartright=this.ChartBorder.GetRight();
40007
- var zoomIndex=this.ChartFrame.ZoomIndex;
40008
- if (isHScreen) chartright=this.ChartBorder.GetBottom();
40009
40055
  var xPointCount=this.ChartFrame.XPointCount;
40010
40056
  var xOffset=this.ChartBorder.GetLeft()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
40011
- if (isHScreen) xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
40057
+ if (this.IsHScreen)
40058
+ {
40059
+ chartright=this.ChartBorder.GetBottom();
40060
+ xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
40061
+ }
40012
40062
 
40013
40063
  var isMinute=this.IsMinuteFrame();
40014
40064
 
40015
- this.Canvas.save();
40016
- var bFillBar=false;
40017
- var bFillKLine=false;
40018
- var emptyBGColor=g_JSChartResource.EmptyBarBGColor;
40019
-
40020
40065
  if (isMinute)
40021
40066
  {
40022
- if (this.Width>1) this.Canvas.lineWidth=2*GetDevicePixelRatio();
40023
- else this.Canvas.lineWidth=GetDevicePixelRatio();
40024
- this.Canvas.strokeStyle=this.Color;
40067
+ if (this.Width>1) this.BarCache.Width=2*pixelRatio;
40068
+ this.BarCache.Type=1;
40025
40069
  }
40026
- else if(this.Width==0) //宽度时0,使用宽度1
40070
+ else if(this.Width<=0) //宽度时0,使用宽度1
40027
40071
  {
40072
+ this.BarCache.Type=1;
40028
40073
  this.SetEmptyBar();
40029
- this.Canvas.lineWidth=GetDevicePixelRatio();
40030
- this.Canvas.strokeStyle=this.Color;
40031
40074
  }
40032
40075
  else if (this.Width==3 || this.Width==50) //3和50 K线宽度
40033
40076
  {
40077
+ this.BarCache.Type=1;
40034
40078
  if (dataWidth>=4)
40035
40079
  {
40036
- bFillKLine=true;
40080
+ this.BarCache.Type=2;
40081
+ this.BarCache.Width=dataWidth;
40037
40082
  this.SetEmptyBar();
40038
- if (!this.IsEmptyBar()) this.Canvas.fillStyle=this.Color;
40039
- this.Canvas.strokeStyle=this.Color;
40040
40083
  }
40041
- else //太细了 画竖线
40042
- {
40043
- this.Canvas.lineWidth=GetDevicePixelRatio();
40044
- this.Canvas.strokeStyle=this.Color;
40045
- }
40046
40084
  }
40047
- else if (this.Width==101)
40085
+ else if (this.Width==101) //柱子+间距
40048
40086
  {
40049
- var lineWidth=dataWidth+distanceWidth+1*GetDevicePixelRatio();
40050
- this.Canvas.lineWidth=lineWidth;
40051
- this.Canvas.strokeStyle=this.Color;
40087
+ this.BarCache.Type=1;
40088
+ var lineWidth=dataWidth+distanceWidth+1*pixelRatio;
40089
+ if (lineWidth>=4)
40090
+ {
40091
+ this.BarCache.Type=2;
40092
+ this.BarCache.Width=lineWidth
40093
+ this.SetEmptyBar();
40094
+ }
40052
40095
  }
40053
40096
  else if (this.Width<=3)
40054
40097
  {
40055
- var minWidth=2*GetDevicePixelRatio();
40098
+ var minWidth=2*pixelRatio;
40056
40099
  var barWidth=dataWidth*(this.Width/3);
40057
40100
  if (barWidth<minWidth) barWidth=minWidth;
40058
- this.SetEmptyBar();
40059
- if (!this.IsEmptyBar()) this.Canvas.fillStyle=this.Color;
40060
- bFillBar=true;
40101
+ this.BarCache.Type=1;
40102
+ if (barWidth>=4)
40103
+ {
40104
+ this.BarCache.Type=2;
40105
+ this.BarCache.Width=barWidth;
40106
+ this.SetEmptyBar();
40107
+ }
40061
40108
  }
40062
40109
  else
40063
40110
  {
40064
- var barWidth=this.Width*GetDevicePixelRatio()+dataWidth;
40111
+ var barWidth=this.Width*pixelRatio+dataWidth;
40112
+ this.BarCache.Type=2;
40113
+ this.BarCache.Width=barWidth;
40065
40114
  this.SetEmptyBar();
40066
- if (!this.IsEmptyBar()) this.Canvas.fillStyle=this.Color;
40067
- bFillBar=true;
40068
40115
  }
40069
40116
 
40117
+ this.Canvas.save();
40118
+ this.ClipClient(this.IsHScreen);
40119
+
40120
+ this.Canvas.strokeStyle=this.BarCache.Color;
40121
+ if (this.BarCache.EmptyBGColor) this.Canvas.fillStyle=this.BarCache.EmptyBGColor; //空心柱子
40122
+ else this.Canvas.fillStyle=this.BarCache.Color;
40123
+ if (IFrameSplitOperator.IsNonEmptyArray(this.BarCache.LineDotted)) this.Canvas.setLineDash(this.BarCache.LineDotted); //虚线
40124
+ if (this.BarCache.Type==1) this.Canvas.lineWidth=this.BarCache.Width;
40125
+
40070
40126
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
40071
40127
  {
40072
40128
  var value=this.Data.Data[i];
40073
- if (value==null) continue;
40129
+ if (!value) continue;
40130
+ if (!IFrameSplitOperator.IsNumber(value.Value)) continue;
40074
40131
 
40075
40132
  var price=value.Value;
40076
- var price2=value.Value2;
40077
- if (price2==null) price2=0;
40133
+ var price2=0;
40134
+ if (IFrameSplitOperator.IsNumber(value.Value2)) price2=value.Value2;
40078
40135
 
40079
40136
  if (isMinute)
40080
40137
  {
@@ -40087,103 +40144,79 @@ function ChartStickLine()
40087
40144
  var x=left+(right-left)/2;
40088
40145
  }
40089
40146
 
40090
- var y=this.ChartFrame.GetYFromData(price);
40091
- var y2=this.ChartFrame.GetYFromData(price2);
40147
+ var y=this.ChartFrame.GetYFromData(price,false);
40148
+ var y2=this.ChartFrame.GetYFromData(price2,false);
40092
40149
 
40093
40150
  if (x>chartright) break;
40094
40151
 
40095
- if (bFillBar)
40096
- {
40097
- if (isHScreen)
40098
- {
40099
- var left=x-barWidth/2;
40100
- var width=barWidth;
40101
- if (this.IsEmptyBar()) //空心
40102
- {
40103
- this.Canvas.beginPath();
40104
- this.Canvas.rect(ToFixedPoint(Math.min(y,y2)),ToFixedPoint(left),ToFixedRect(Math.abs(y-y2)),ToFixedRect(width));
40105
- this.Canvas.stroke();
40106
- }
40107
- else
40108
- {
40109
- this.Canvas.fillRect(ToFixedRect(Math.min(y,y2)),ToFixedRect(left),ToFixedRect(Math.abs(y-y2)),ToFixedRect(width));
40110
- }
40111
- }
40112
- else
40113
- {
40114
- var left=x-barWidth/2;
40115
- var width=barWidth;
40116
- if (left+width>chartright) width=chartright-left; //不要超过右边框子
40117
- if (this.IsEmptyBar()) //空心
40118
- {
40119
- if (emptyBGColor)
40120
- this.Canvas.fillRect(ToFixedRect(left),ToFixedRect(Math.min(y,y2)),ToFixedRect(width),ToFixedRect(Math.abs(y-y2)));
40152
+ var xCenter=x;
40153
+ var yTop=Math.min(y,y2);
40154
+ var barHeight=Math.abs(y-y2); //柱子高度
40121
40155
 
40122
- this.Canvas.beginPath();
40123
- this.Canvas.rect(ToFixedPoint(left),ToFixedPoint(Math.min(y,y2)),ToFixedRect(width),ToFixedRect(Math.abs(y-y2)));
40124
- this.Canvas.stroke();
40125
- }
40126
- else
40127
- {
40128
- this.Canvas.fillRect(ToFixedRect(left),ToFixedRect(Math.min(y,y2)),ToFixedRect(width),ToFixedRect(this.CalculateBarHeight(y,y2)));
40129
- }
40130
- }
40156
+ this.DrawBar(xCenter, yTop, barHeight);
40157
+ }
40158
+
40159
+ this.Canvas.restore();
40160
+ }
40161
+
40162
+ this.DrawBar=function(xCenter, ytop, barHeight)
40163
+ {
40164
+ if (barHeight<1) barHeight=1;
40165
+
40166
+ if (this.BarCache.Type==1) //线段
40167
+ {
40168
+ if (this.IsHScreen)
40169
+ {
40170
+ this.Canvas.beginPath();
40171
+ this.Canvas.moveTo(ytop,ToFixedPoint(xCenter));
40172
+ this.Canvas.lineTo(ytop+barHeight,ToFixedPoint(xCenter));
40173
+ this.Canvas.stroke();
40131
40174
  }
40132
- else if (bFillKLine)
40175
+ else
40133
40176
  {
40134
- if (this.IsEmptyBar()) //空心
40177
+ this.Canvas.beginPath();
40178
+ this.Canvas.moveTo(ToFixedPoint(xCenter),ytop);
40179
+ this.Canvas.lineTo(ToFixedPoint(xCenter),ytop+barHeight);
40180
+ this.Canvas.stroke();
40181
+ }
40182
+ }
40183
+ else if (this.BarCache.Type==2) //柱子
40184
+ {
40185
+ if (this.IsHScreen)
40186
+ {
40187
+ var xLeft=xCenter-this.BarCache.Width/2;
40188
+ if (this.IsEmptyBar()) //空心
40135
40189
  {
40136
- if (isHScreen)
40137
- {
40138
- this.Canvas.beginPath();
40139
- this.Canvas.rect(ToFixedPoint(Math.min(y,y2)),ToFixedPoint(xOffset),ToFixedRect(Math.abs(y-y2)),ToFixedRect(dataWidth));
40140
- this.Canvas.stroke();
40141
- }
40142
- else
40143
- {
40144
- if (emptyBGColor)
40145
- this.Canvas.fillRect(ToFixedRect(xOffset),ToFixedRect(Math.min(y,y2)),ToFixedRect(dataWidth),ToFixedRect(Math.abs(y-y2)));
40190
+ if (this.BarCache.EmptyBGColor) //背景色填充
40191
+ this.Canvas.fillRect(ToFixedRect(ytop),ToFixedRect(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
40146
40192
 
40147
- this.Canvas.beginPath();
40148
- this.Canvas.rect(ToFixedPoint(xOffset),ToFixedPoint(Math.min(y,y2)),ToFixedRect(dataWidth),ToFixedRect(Math.abs(y-y2)));
40149
- this.Canvas.stroke();
40150
- }
40193
+ this.Canvas.beginPath();
40194
+ this.Canvas.rect(ToFixedPoint(ytop),ToFixedPoint(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
40195
+ this.Canvas.stroke();
40151
40196
  }
40152
40197
  else
40153
40198
  {
40154
- if (isHScreen)
40155
- {
40156
- this.Canvas.fillRect(ToFixedRect(Math.min(y,y2)),ToFixedRect(xOffset),ToFixedRect(Math.abs(y-y2)),ToFixedRect(dataWidth));
40157
- }
40158
- else
40159
- {
40160
- this.Canvas.fillRect(ToFixedRect(xOffset),ToFixedRect(Math.min(y,y2)),ToFixedRect(dataWidth),ToFixedRect(this.CalculateBarHeight(y,y2)));
40161
- }
40162
-
40199
+ this.Canvas.fillRect(ToFixedRect(ytop),ToFixedRect(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
40163
40200
  }
40164
40201
  }
40165
40202
  else
40166
40203
  {
40167
- if (isHScreen)
40204
+ var xLeft=xCenter-this.BarCache.Width/2;
40205
+ if (this.IsEmptyBar()) //空心
40168
40206
  {
40207
+ if (this.BarCache.EmptyBGColor) //背景色填充
40208
+ this.Canvas.fillRect(ToFixedRect(xLeft),ToFixedRect(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
40209
+
40169
40210
  this.Canvas.beginPath();
40170
- this.Canvas.moveTo(y,ToFixedPoint(x));
40171
- this.Canvas.lineTo(y2,ToFixedPoint(x));
40211
+ this.Canvas.rect(ToFixedPoint(xLeft),ToFixedPoint(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
40172
40212
  this.Canvas.stroke();
40173
40213
  }
40174
40214
  else
40175
40215
  {
40176
- var xFix=parseInt(x.toString())+0.5;
40177
- this.Canvas.beginPath();
40178
- this.Canvas.moveTo(xFix,y);
40179
- if (Math.abs(y-y2)>0) this.Canvas.lineTo(xFix,y2);
40180
- else this.Canvas.lineTo(xFix,y+1); //太窄了,就画一个像素的宽度
40181
- this.Canvas.stroke();
40216
+ this.Canvas.fillRect(ToFixedRect(xLeft),ToFixedRect(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
40182
40217
  }
40183
40218
  }
40184
40219
  }
40185
-
40186
- this.Canvas.restore();
40187
40220
  }
40188
40221
 
40189
40222
  this.GetMaxMin=function()
@@ -144893,7 +144926,7 @@ function ScrollBarBGChart()
144893
144926
 
144894
144927
 
144895
144928
 
144896
- var HQCHART_VERSION="1.1.14541";
144929
+ var HQCHART_VERSION="1.1.14551";
144897
144930
 
144898
144931
  function PrintHQChartVersion()
144899
144932
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.14541";
8
+ var HQCHART_VERSION="1.1.14551";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {