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.
@@ -7394,6 +7394,51 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7394
7394
  this.DialogSearchIndex=null;
7395
7395
  }
7396
7396
 
7397
+ this.DestroyDialogDrawTool=function()
7398
+ {
7399
+ if (!this.DialogDrawTool) return;
7400
+
7401
+ this.DialogDrawTool.Destroy();
7402
+ this.DialogDrawTool=null;
7403
+ }
7404
+
7405
+ this.DestroyDialogModifyIndexParam=function()
7406
+ {
7407
+ if (this.DialogModifyIndexParam) return;
7408
+
7409
+ this.DialogModifyIndexParam.Destroy();
7410
+ this.DialogModifyIndexParam=null;
7411
+ }
7412
+
7413
+ this.DestroyDialogSelectRect=function()
7414
+ {
7415
+ if (!this.DialogSelectRect) return;
7416
+
7417
+ this.DialogSelectRect.Destroy();
7418
+ this.DialogSelectRect=null;
7419
+ }
7420
+
7421
+ this.DestroyDialogModifyDraw=function()
7422
+ {
7423
+ if (!this.DialogModifyDraw) return;
7424
+
7425
+ this.DialogModifyDraw.Destroy();
7426
+ this.DialogModifyDraw=null;
7427
+ }
7428
+
7429
+ //隐藏内置的弹框div
7430
+ this.HideAllPopDiv=function()
7431
+ {
7432
+ this.HideFloatTooltip();
7433
+ this.CloseTooltipDialog();
7434
+
7435
+ if (this.DialogDrawTool) this.DialogDrawTool.Close();
7436
+ this.CloseModifyDrawDialog();
7437
+
7438
+ if (this.DialogSelectRect) this.DialogSelectRect.Close();
7439
+ if (this.DialogSearchIndex) this.DialogSearchIndex.Close();
7440
+ if (this.DialogModifyIndexParam) this.DialogModifyIndexParam.Close();
7441
+ }
7397
7442
 
7398
7443
 
7399
7444
  //obj={ Element:, Canvas: }
@@ -7445,9 +7490,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7445
7490
  {
7446
7491
  this.IsDestroy=true;
7447
7492
  this.StopAutoUpdate();
7493
+
7448
7494
  this.DestroyTooltipDialog();
7449
7495
  this.DestroyFloatTooltip();
7496
+
7450
7497
  this.DestroySearchIndexDialog();
7498
+ this.DestroyDialogModifyIndexParam();
7499
+
7500
+ this.DestroyDialogDrawTool();
7501
+ this.DestroyDialogModifyDraw();
7502
+
7503
+ this.DestroyDialogSelectRect();
7451
7504
  }
7452
7505
 
7453
7506
  this.ChartDestory=this.ChartDestroy; //老版本写错了,需要兼容下
@@ -39997,23 +40050,22 @@ function ChartStickLine()
39997
40050
  delete this.newMethod;
39998
40051
 
39999
40052
  this.ClassName='ChartStickLine'; //类名
40000
- this.Color="rgb(255,193,37)"; //线段颜色
40001
- this.BarType=0; //柱子类型 0=实心 1=空心 -1=画虚线空心柱
40002
- this.LineDotted=[3,3]; //虚线设置
40003
- this.Width=0; //柱子宽度 0=1 3,50=k线宽度 101=K线宽度+间距宽度
40053
+ this.Color="rgb(255,193,37)"; //线段颜色
40054
+ this.BarType=0; //柱子类型 0=实心 1=空心 -1=画虚线空心柱
40055
+ this.LineDotted=[3,3]; //虚线设置
40056
+ this.Width=0; //柱子宽度 0=1 3,50=k线宽度 101=K线宽度+间距宽度
40057
+ this.IsHScreen=false;
40058
+
40059
+ this.EmptyBGColor=null; //空心柱子背景色(缓存)
40060
+ this.BarCache={ }; //Type:1=线段 2=柱子
40004
40061
 
40005
40062
  this.SetEmptyBar=function() //设置空心柱子
40006
40063
  {
40007
40064
  if (this.BarType!=1 && this.BarType!=-1) return false;
40008
40065
 
40009
- this.Canvas.lineWidth=GetDevicePixelRatio();
40010
- this.Canvas.strokeStyle=this.Color;
40011
40066
  var emptyBGColor=g_JSChartResource.EmptyBarBGColor;
40012
- if (emptyBGColor) this.Canvas.fillStyle=emptyBGColor;
40013
- if (this.BarType==-1) //虚线
40014
- {
40015
- this.Canvas.setLineDash(this.LineDotted); //虚线
40016
- }
40067
+ if (emptyBGColor) this.BarCache.EmptyBGColor=emptyBGColor;
40068
+ if (this.BarType==-1) this.BarCache.LineDotted=this.LineDotted;
40017
40069
 
40018
40070
  return true;
40019
40071
  }
@@ -40023,13 +40075,6 @@ function ChartStickLine()
40023
40075
  return (this.BarType==1 || this.BarType==-1);
40024
40076
  }
40025
40077
 
40026
- this.CalculateBarHeight=function(y,y2)
40027
- {
40028
- var barHeight=Math.abs(y-y2);
40029
- if (barHeight<=0) barHeight=1;
40030
- return barHeight;
40031
- }
40032
-
40033
40078
  this.Draw=function()
40034
40079
  {
40035
40080
  if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
@@ -40044,81 +40089,93 @@ function ChartStickLine()
40044
40089
 
40045
40090
  if (!this.Data || !this.Data.Data) return;
40046
40091
 
40047
- var isHScreen=(this.ChartFrame.IsHScreen===true);
40092
+ var pixelRatio=GetDevicePixelRatio();
40093
+ this.BarCache={ Color:this.Color, EmptyBGColor:null, Width:1*pixelRatio, Type:0, LineDotted:null };
40094
+
40095
+ this.IsHScreen=(this.ChartFrame.IsHScreen===true);;
40048
40096
  var dataWidth=this.ChartFrame.DataWidth;
40049
40097
  var distanceWidth=this.ChartFrame.DistanceWidth;
40050
40098
  var chartright=this.ChartBorder.GetRight();
40051
- var zoomIndex=this.ChartFrame.ZoomIndex;
40052
- if (isHScreen) chartright=this.ChartBorder.GetBottom();
40053
40099
  var xPointCount=this.ChartFrame.XPointCount;
40054
40100
  var xOffset=this.ChartBorder.GetLeft()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
40055
- if (isHScreen) xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
40101
+ if (this.IsHScreen)
40102
+ {
40103
+ chartright=this.ChartBorder.GetBottom();
40104
+ xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
40105
+ }
40056
40106
 
40057
40107
  var isMinute=this.IsMinuteFrame();
40058
40108
 
40059
- this.Canvas.save();
40060
- var bFillBar=false;
40061
- var bFillKLine=false;
40062
- var emptyBGColor=g_JSChartResource.EmptyBarBGColor;
40063
-
40064
40109
  if (isMinute)
40065
40110
  {
40066
- if (this.Width>1) this.Canvas.lineWidth=2*GetDevicePixelRatio();
40067
- else this.Canvas.lineWidth=GetDevicePixelRatio();
40068
- this.Canvas.strokeStyle=this.Color;
40111
+ if (this.Width>1) this.BarCache.Width=2*pixelRatio;
40112
+ this.BarCache.Type=1;
40069
40113
  }
40070
- else if(this.Width==0) //宽度时0,使用宽度1
40114
+ else if(this.Width<=0) //宽度时0,使用宽度1
40071
40115
  {
40116
+ this.BarCache.Type=1;
40072
40117
  this.SetEmptyBar();
40073
- this.Canvas.lineWidth=GetDevicePixelRatio();
40074
- this.Canvas.strokeStyle=this.Color;
40075
40118
  }
40076
40119
  else if (this.Width==3 || this.Width==50) //3和50 K线宽度
40077
40120
  {
40121
+ this.BarCache.Type=1;
40078
40122
  if (dataWidth>=4)
40079
40123
  {
40080
- bFillKLine=true;
40124
+ this.BarCache.Type=2;
40125
+ this.BarCache.Width=dataWidth;
40081
40126
  this.SetEmptyBar();
40082
- if (!this.IsEmptyBar()) this.Canvas.fillStyle=this.Color;
40083
- this.Canvas.strokeStyle=this.Color;
40084
40127
  }
40085
- else //太细了 画竖线
40086
- {
40087
- this.Canvas.lineWidth=GetDevicePixelRatio();
40088
- this.Canvas.strokeStyle=this.Color;
40089
- }
40090
40128
  }
40091
- else if (this.Width==101)
40129
+ else if (this.Width==101) //柱子+间距
40092
40130
  {
40093
- var lineWidth=dataWidth+distanceWidth+1*GetDevicePixelRatio();
40094
- this.Canvas.lineWidth=lineWidth;
40095
- this.Canvas.strokeStyle=this.Color;
40131
+ this.BarCache.Type=1;
40132
+ var lineWidth=dataWidth+distanceWidth+1*pixelRatio;
40133
+ if (lineWidth>=4)
40134
+ {
40135
+ this.BarCache.Type=2;
40136
+ this.BarCache.Width=lineWidth
40137
+ this.SetEmptyBar();
40138
+ }
40096
40139
  }
40097
40140
  else if (this.Width<=3)
40098
40141
  {
40099
- var minWidth=2*GetDevicePixelRatio();
40142
+ var minWidth=2*pixelRatio;
40100
40143
  var barWidth=dataWidth*(this.Width/3);
40101
40144
  if (barWidth<minWidth) barWidth=minWidth;
40102
- this.SetEmptyBar();
40103
- if (!this.IsEmptyBar()) this.Canvas.fillStyle=this.Color;
40104
- bFillBar=true;
40145
+ this.BarCache.Type=1;
40146
+ if (barWidth>=4)
40147
+ {
40148
+ this.BarCache.Type=2;
40149
+ this.BarCache.Width=barWidth;
40150
+ this.SetEmptyBar();
40151
+ }
40105
40152
  }
40106
40153
  else
40107
40154
  {
40108
- var barWidth=this.Width*GetDevicePixelRatio()+dataWidth;
40155
+ var barWidth=this.Width*pixelRatio+dataWidth;
40156
+ this.BarCache.Type=2;
40157
+ this.BarCache.Width=barWidth;
40109
40158
  this.SetEmptyBar();
40110
- if (!this.IsEmptyBar()) this.Canvas.fillStyle=this.Color;
40111
- bFillBar=true;
40112
40159
  }
40113
40160
 
40161
+ this.Canvas.save();
40162
+ this.ClipClient(this.IsHScreen);
40163
+
40164
+ this.Canvas.strokeStyle=this.BarCache.Color;
40165
+ if (this.BarCache.EmptyBGColor) this.Canvas.fillStyle=this.BarCache.EmptyBGColor; //空心柱子
40166
+ else this.Canvas.fillStyle=this.BarCache.Color;
40167
+ if (IFrameSplitOperator.IsNonEmptyArray(this.BarCache.LineDotted)) this.Canvas.setLineDash(this.BarCache.LineDotted); //虚线
40168
+ if (this.BarCache.Type==1) this.Canvas.lineWidth=this.BarCache.Width;
40169
+
40114
40170
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
40115
40171
  {
40116
40172
  var value=this.Data.Data[i];
40117
- if (value==null) continue;
40173
+ if (!value) continue;
40174
+ if (!IFrameSplitOperator.IsNumber(value.Value)) continue;
40118
40175
 
40119
40176
  var price=value.Value;
40120
- var price2=value.Value2;
40121
- if (price2==null) price2=0;
40177
+ var price2=0;
40178
+ if (IFrameSplitOperator.IsNumber(value.Value2)) price2=value.Value2;
40122
40179
 
40123
40180
  if (isMinute)
40124
40181
  {
@@ -40131,103 +40188,79 @@ function ChartStickLine()
40131
40188
  var x=left+(right-left)/2;
40132
40189
  }
40133
40190
 
40134
- var y=this.ChartFrame.GetYFromData(price);
40135
- var y2=this.ChartFrame.GetYFromData(price2);
40191
+ var y=this.ChartFrame.GetYFromData(price,false);
40192
+ var y2=this.ChartFrame.GetYFromData(price2,false);
40136
40193
 
40137
40194
  if (x>chartright) break;
40138
40195
 
40139
- if (bFillBar)
40140
- {
40141
- if (isHScreen)
40142
- {
40143
- var left=x-barWidth/2;
40144
- var width=barWidth;
40145
- if (this.IsEmptyBar()) //空心
40146
- {
40147
- this.Canvas.beginPath();
40148
- this.Canvas.rect(ToFixedPoint(Math.min(y,y2)),ToFixedPoint(left),ToFixedRect(Math.abs(y-y2)),ToFixedRect(width));
40149
- this.Canvas.stroke();
40150
- }
40151
- else
40152
- {
40153
- this.Canvas.fillRect(ToFixedRect(Math.min(y,y2)),ToFixedRect(left),ToFixedRect(Math.abs(y-y2)),ToFixedRect(width));
40154
- }
40155
- }
40156
- else
40157
- {
40158
- var left=x-barWidth/2;
40159
- var width=barWidth;
40160
- if (left+width>chartright) width=chartright-left; //不要超过右边框子
40161
- if (this.IsEmptyBar()) //空心
40162
- {
40163
- if (emptyBGColor)
40164
- this.Canvas.fillRect(ToFixedRect(left),ToFixedRect(Math.min(y,y2)),ToFixedRect(width),ToFixedRect(Math.abs(y-y2)));
40196
+ var xCenter=x;
40197
+ var yTop=Math.min(y,y2);
40198
+ var barHeight=Math.abs(y-y2); //柱子高度
40165
40199
 
40166
- this.Canvas.beginPath();
40167
- this.Canvas.rect(ToFixedPoint(left),ToFixedPoint(Math.min(y,y2)),ToFixedRect(width),ToFixedRect(Math.abs(y-y2)));
40168
- this.Canvas.stroke();
40169
- }
40170
- else
40171
- {
40172
- this.Canvas.fillRect(ToFixedRect(left),ToFixedRect(Math.min(y,y2)),ToFixedRect(width),ToFixedRect(this.CalculateBarHeight(y,y2)));
40173
- }
40174
- }
40200
+ this.DrawBar(xCenter, yTop, barHeight);
40201
+ }
40202
+
40203
+ this.Canvas.restore();
40204
+ }
40205
+
40206
+ this.DrawBar=function(xCenter, ytop, barHeight)
40207
+ {
40208
+ if (barHeight<1) barHeight=1;
40209
+
40210
+ if (this.BarCache.Type==1) //线段
40211
+ {
40212
+ if (this.IsHScreen)
40213
+ {
40214
+ this.Canvas.beginPath();
40215
+ this.Canvas.moveTo(ytop,ToFixedPoint(xCenter));
40216
+ this.Canvas.lineTo(ytop+barHeight,ToFixedPoint(xCenter));
40217
+ this.Canvas.stroke();
40175
40218
  }
40176
- else if (bFillKLine)
40219
+ else
40177
40220
  {
40178
- if (this.IsEmptyBar()) //空心
40221
+ this.Canvas.beginPath();
40222
+ this.Canvas.moveTo(ToFixedPoint(xCenter),ytop);
40223
+ this.Canvas.lineTo(ToFixedPoint(xCenter),ytop+barHeight);
40224
+ this.Canvas.stroke();
40225
+ }
40226
+ }
40227
+ else if (this.BarCache.Type==2) //柱子
40228
+ {
40229
+ if (this.IsHScreen)
40230
+ {
40231
+ var xLeft=xCenter-this.BarCache.Width/2;
40232
+ if (this.IsEmptyBar()) //空心
40179
40233
  {
40180
- if (isHScreen)
40181
- {
40182
- this.Canvas.beginPath();
40183
- this.Canvas.rect(ToFixedPoint(Math.min(y,y2)),ToFixedPoint(xOffset),ToFixedRect(Math.abs(y-y2)),ToFixedRect(dataWidth));
40184
- this.Canvas.stroke();
40185
- }
40186
- else
40187
- {
40188
- if (emptyBGColor)
40189
- this.Canvas.fillRect(ToFixedRect(xOffset),ToFixedRect(Math.min(y,y2)),ToFixedRect(dataWidth),ToFixedRect(Math.abs(y-y2)));
40234
+ if (this.BarCache.EmptyBGColor) //背景色填充
40235
+ this.Canvas.fillRect(ToFixedRect(ytop),ToFixedRect(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
40190
40236
 
40191
- this.Canvas.beginPath();
40192
- this.Canvas.rect(ToFixedPoint(xOffset),ToFixedPoint(Math.min(y,y2)),ToFixedRect(dataWidth),ToFixedRect(Math.abs(y-y2)));
40193
- this.Canvas.stroke();
40194
- }
40237
+ this.Canvas.beginPath();
40238
+ this.Canvas.rect(ToFixedPoint(ytop),ToFixedPoint(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
40239
+ this.Canvas.stroke();
40195
40240
  }
40196
40241
  else
40197
40242
  {
40198
- if (isHScreen)
40199
- {
40200
- this.Canvas.fillRect(ToFixedRect(Math.min(y,y2)),ToFixedRect(xOffset),ToFixedRect(Math.abs(y-y2)),ToFixedRect(dataWidth));
40201
- }
40202
- else
40203
- {
40204
- this.Canvas.fillRect(ToFixedRect(xOffset),ToFixedRect(Math.min(y,y2)),ToFixedRect(dataWidth),ToFixedRect(this.CalculateBarHeight(y,y2)));
40205
- }
40206
-
40243
+ this.Canvas.fillRect(ToFixedRect(ytop),ToFixedRect(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
40207
40244
  }
40208
40245
  }
40209
40246
  else
40210
40247
  {
40211
- if (isHScreen)
40248
+ var xLeft=xCenter-this.BarCache.Width/2;
40249
+ if (this.IsEmptyBar()) //空心
40212
40250
  {
40251
+ if (this.BarCache.EmptyBGColor) //背景色填充
40252
+ this.Canvas.fillRect(ToFixedRect(xLeft),ToFixedRect(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
40253
+
40213
40254
  this.Canvas.beginPath();
40214
- this.Canvas.moveTo(y,ToFixedPoint(x));
40215
- this.Canvas.lineTo(y2,ToFixedPoint(x));
40255
+ this.Canvas.rect(ToFixedPoint(xLeft),ToFixedPoint(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
40216
40256
  this.Canvas.stroke();
40217
40257
  }
40218
40258
  else
40219
40259
  {
40220
- var xFix=parseInt(x.toString())+0.5;
40221
- this.Canvas.beginPath();
40222
- this.Canvas.moveTo(xFix,y);
40223
- if (Math.abs(y-y2)>0) this.Canvas.lineTo(xFix,y2);
40224
- else this.Canvas.lineTo(xFix,y+1); //太窄了,就画一个像素的宽度
40225
- this.Canvas.stroke();
40260
+ this.Canvas.fillRect(ToFixedRect(xLeft),ToFixedRect(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
40226
40261
  }
40227
40262
  }
40228
40263
  }
40229
-
40230
- this.Canvas.restore();
40231
40264
  }
40232
40265
 
40233
40266
  this.GetMaxMin=function()
@@ -155163,7 +155196,7 @@ function HQChartScriptWorker()
155163
155196
 
155164
155197
 
155165
155198
 
155166
- var HQCHART_VERSION="1.1.14541";
155199
+ var HQCHART_VERSION="1.1.14551";
155167
155200
 
155168
155201
  function PrintHQChartVersion()
155169
155202
  {