hqchart 1.1.13740 → 1.1.13746

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.
@@ -7577,7 +7577,9 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7577
7577
 
7578
7578
  if (bDraw) this.Draw();
7579
7579
 
7580
- drawPictrueData.ChartDrawPicture.Status=20;
7580
+ if (drawPictrueData.ChartDrawPicture.EnableMove==true)
7581
+ drawPictrueData.ChartDrawPicture.Status=20;
7582
+
7581
7583
  drawPictrueData.ChartDrawPicture.ValueToPoint();
7582
7584
  drawPictrueData.ChartDrawPicture.MovePointIndex=drawPictrueData.PointIndex;
7583
7585
  //this.CurrentChartDrawPicture=drawPictrueData.ChartDrawPicture;
@@ -8580,7 +8582,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8580
8582
  var pixelTatio = GetDevicePixelRatio(); //鼠标移动坐标是原始坐标 需要乘以放大倍速
8581
8583
  if (this.GetChartDrawPictureByPoint(drawPictrueData))
8582
8584
  {
8583
- drawPictrueData.ChartDrawPicture.Status=20;
8585
+ if (drawPictrueData.ChartDrawPicture.EnableMove==true)
8586
+ drawPictrueData.ChartDrawPicture.Status=20;
8584
8587
  drawPictrueData.ChartDrawPicture.ValueToPoint();
8585
8588
  drawPictrueData.ChartDrawPicture.MovePointIndex=drawPictrueData.PointIndex;
8586
8589
  drawPictrueData.ChartDrawPicture.IsSelected=true;
@@ -39968,16 +39971,38 @@ function ChartClipColorStick()
39968
39971
  this.UpColor=g_JSChartResource.UpBarColor;
39969
39972
  this.DownColor=g_JSChartResource.DownBarColor;
39970
39973
  this.LineWidth=1;
39974
+ this.Style=0; //1=同方向 0=上下两个方向
39975
+
39971
39976
  //差值线
39972
39977
  this.DownDiffColor=g_JSChartResource.DownBarColor;
39973
39978
  this.UpDiffColor=g_JSChartResource.UpBarColor;
39974
39979
 
39980
+ //文字
39981
+ this.TextLabelConfig=
39982
+ {
39983
+ Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
39984
+ TextMargin:{ Left:2, Right:2, Bottom:2, Top:2 },
39985
+ TextColor:"rgb(230,230,230)",
39986
+ UpColor:"rgb(137,16,19)",
39987
+ DownColor:"rgb(44,104,57)",
39988
+ UnchangeColor:"rgb(111,112,115)",
39989
+ BorderColor:"rgb(0,0,0)",
39990
+
39991
+ //缓存
39992
+ LabelWidth:0,
39993
+ TextHeight:0,
39994
+ MaxTextWidth:0,
39995
+ }
39996
+
39975
39997
  this.BaseLineColor; //基准线
39976
39998
 
39977
39999
  this.BaseValue=0;
39978
40000
  this.Super_GetMaxMin=this.GetMaxMin; //父类的方法
39979
40001
  this.ValueRange; //{ Max:, Min: } //固定最大最小值
39980
40002
 
40003
+ this.IsShowText=false;
40004
+
40005
+
39981
40006
  this.SetOption=function(option)
39982
40007
  {
39983
40008
  if (!option) return;
@@ -39988,11 +40013,18 @@ function ChartClipColorStick()
39988
40013
  if (option.UpDiffColor) this.UpDiffColor=option.UpDiffColor;
39989
40014
  if (option.BaseLineColor) this.BaseLineColor=option.BaseLineColor;
39990
40015
  if (IFrameSplitOperator.IsNumber(option.BaseValue)) this.BaseValue=option.BaseValue;
40016
+ if (IFrameSplitOperator.IsNumber(option.Style)) this.Style=option.Style;
39991
40017
  if (option.ValueRange) this.ValueRange=option.ValueRange;
40018
+
39992
40019
  }
39993
40020
 
39994
40021
  this.Draw=function()
39995
40022
  {
40023
+ this.IsShowText=false;
40024
+ this.TextLabelConfig.LabelWidth=0;
40025
+ this.TextLabelConfig.TextHeight=0;
40026
+ this.TextLabelConfig.MaxTextWidth=0;
40027
+
39996
40028
  if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
39997
40029
  if (this.IsShowIndexTitleOnly()) return;
39998
40030
  if (this.IsHideScriptIndex()) return;
@@ -40003,23 +40035,44 @@ function ChartClipColorStick()
40003
40035
  return;
40004
40036
  }
40005
40037
 
40006
- this.Canvas.save();
40007
40038
  var dataWidth=this.ChartFrame.DataWidth;
40039
+ var distanceWidth=this.ChartFrame.DistanceWidth;
40040
+ var xPointCount=this.ChartFrame.XPointCount;
40041
+ var bHScreen=this.ChartFrame.IsHScreen===true;
40042
+
40008
40043
  var lineWidth=this.LineWidth*GetDevicePixelRatio();
40009
40044
  if (this.LineWidth==50) lineWidth=dataWidth;
40010
40045
  else if (lineWidth>dataWidth) lineWidth=dataWidth;
40011
-
40046
+
40047
+ if (!bHScreen)
40048
+ {
40049
+ var itemWidth=dataWidth+distanceWidth;
40050
+ var bMinute=this.IsMinuteFrame();
40051
+ if (bMinute)
40052
+ {
40053
+ var border=this.ChartBorder.GetBorder();
40054
+ itemWidth=(border.Right-border.Left)/(xPointCount-1);
40055
+ }
40056
+
40057
+ this.Canvas.font=this.TextLabelConfig.Font;
40058
+ this.TextLabelConfig.MaxTextWidth=this.Canvas.measureText("-888").width;
40059
+ this.TextLabelConfig.LabelWidth=this.TextLabelConfig.MaxTextWidth+this.TextLabelConfig.TextMargin.Left+this.TextLabelConfig.TextMargin.Right;
40060
+ this.IsShowText=itemWidth>this.TextLabelConfig.LabelWidth;
40061
+ this.TextLabelConfig.TextHeight=this.Canvas.measureText("擎").width;
40062
+ }
40063
+
40064
+ this.Canvas.save();
40012
40065
  if (IFrameSplitOperator.IsNumber(this.BaseValue) && this.BaseValue!=0)
40013
40066
  {
40014
40067
  this.DrawBaseLine();
40015
40068
 
40016
- if (this.BaseValue>0) this.DrawBars(lineWidth, true);
40017
- else this.DrawBars(lineWidth, false);
40069
+ if (this.BaseValue>0) this.DrawBars(lineWidth, true, true);
40070
+ else this.DrawBars(lineWidth, false, true);
40018
40071
  }
40019
40072
  else
40020
40073
  {
40021
40074
  //上下分开画
40022
- this.DrawBars(lineWidth, true);
40075
+ this.DrawBars(lineWidth, true, true);
40023
40076
  this.DrawBars(lineWidth, false);
40024
40077
  }
40025
40078
 
@@ -40027,15 +40080,15 @@ function ChartClipColorStick()
40027
40080
  this.Canvas.restore();
40028
40081
  }
40029
40082
 
40030
- this.DrawBars=function(lineWidth, bUpBar)
40083
+ this.DrawBars=function(lineWidth, bUpBar, bDrawLabel)
40031
40084
  {
40032
40085
  var isMinute=this.IsMinuteFrame();
40033
40086
  var dataWidth=this.ChartFrame.DataWidth;
40034
40087
  var distanceWidth=this.ChartFrame.DistanceWidth;
40035
40088
  var xPointCount=this.ChartFrame.XPointCount;
40036
- var isHSCreen=this.ChartFrame.IsHScreen===true;
40089
+ var bHScreen=this.ChartFrame.IsHScreen===true;
40037
40090
 
40038
- if (isHSCreen)
40091
+ if (bHScreen)
40039
40092
  {
40040
40093
  var border=this.ChartBorder.GetHScreenBorder();
40041
40094
  var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
@@ -40054,19 +40107,12 @@ function ChartClipColorStick()
40054
40107
  }
40055
40108
 
40056
40109
  var yBottom=this.ChartFrame.GetYFromData(this.BaseValue);
40057
- var aryBar=[], aryDiffBar=[];
40110
+ var aryBar=[], aryDiffBar=[], aryText=[];
40111
+ var preValue=null;
40058
40112
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
40059
40113
  {
40060
40114
  var value=this.Data.Data[i];
40061
40115
  if (value==null) continue;
40062
- if (bUpBar)
40063
- {
40064
- if (value<0) continue;
40065
- }
40066
- else
40067
- {
40068
- if (value>=0) continue;
40069
- }
40070
40116
 
40071
40117
  if (isMinute)
40072
40118
  {
@@ -40082,6 +40128,21 @@ function ChartClipColorStick()
40082
40128
 
40083
40129
  if (x>chartright) break;
40084
40130
 
40131
+ var textItem={ X:x, Value:value };
40132
+ if (IFrameSplitOperator.IsNumber(preValue)) textItem.DiffValue=value-preValue;
40133
+ aryText.push(textItem);
40134
+
40135
+ preValue=value;
40136
+
40137
+ if (bUpBar)
40138
+ {
40139
+ if (value<0) continue;
40140
+ }
40141
+ else
40142
+ {
40143
+ if (value>=0) continue;
40144
+ }
40145
+
40085
40146
  var bDiffBar=false;
40086
40147
  var diffValue=null;
40087
40148
  if (this.BaseValue>0)
@@ -40089,7 +40150,10 @@ function ChartClipColorStick()
40089
40150
  if (value<this.BaseValue)
40090
40151
  {
40091
40152
  bDiffBar=true;
40092
- diffValue=this.BaseValue-(this.BaseValue-value);
40153
+ if (this.Style==1)
40154
+ diffValue=this.BaseValue+(this.BaseValue-value);
40155
+ else
40156
+ diffValue=this.BaseValue-(this.BaseValue-value);
40093
40157
  }
40094
40158
  }
40095
40159
  else if (this.BaseValue<0)
@@ -40097,19 +40161,22 @@ function ChartClipColorStick()
40097
40161
  if (value>this.BaseValue)
40098
40162
  {
40099
40163
  bDiffBar=true;
40100
- diffValue=this.BaseValue+(value-this.BaseValue)
40164
+ if (this.Style==1)
40165
+ diffValue=this.BaseValue-(value-this.BaseValue);
40166
+ else
40167
+ diffValue=this.BaseValue+(value-this.BaseValue)
40101
40168
  }
40102
40169
  }
40103
40170
 
40104
40171
  if (!bDiffBar)
40105
40172
  {
40106
40173
  var y=this.ChartFrame.GetYFromData(value);
40107
- aryBar.push({X:x, Y:y});
40174
+ aryBar.push({X:x, Y:y });
40108
40175
  }
40109
40176
  else
40110
40177
  {
40111
40178
  var y=this.ChartFrame.GetYFromData(diffValue);
40112
- aryDiffBar.push({X:x, Y:y});
40179
+ aryDiffBar.push({X:x, Y:y });
40113
40180
  }
40114
40181
  }
40115
40182
 
@@ -40118,6 +40185,7 @@ function ChartClipColorStick()
40118
40185
  else this.Canvas.strokeStyle=this.DownColor;
40119
40186
 
40120
40187
  this.DrawStick(aryBar,lineWidth,yBottom);
40188
+
40121
40189
 
40122
40190
  if (this.BaseValue>0)
40123
40191
  {
@@ -40130,13 +40198,14 @@ function ChartClipColorStick()
40130
40198
  this.DrawStick(aryDiffBar,lineWidth,yBottom);
40131
40199
  }
40132
40200
 
40201
+ if (this.IsShowText && bDrawLabel) this.DrawStickText(aryText);
40133
40202
  }
40134
40203
 
40135
40204
  this.DrawStick=function(aryData, lineWidth, yBottom)
40136
40205
  {
40137
40206
  if (!IFrameSplitOperator.IsNonEmptyArray(aryData)) return;
40138
40207
 
40139
- var isHSCreen=this.ChartFrame.IsHScreen===true;
40208
+ var bHScreen=this.ChartFrame.IsHScreen===true;
40140
40209
  var drawCount=0;
40141
40210
  this.Canvas.beginPath();
40142
40211
  for(var i=0; i<aryData.length; ++i)
@@ -40145,7 +40214,7 @@ function ChartClipColorStick()
40145
40214
  var y=item.Y;
40146
40215
  var xFix=ToFixedPoint2(lineWidth, item.X); //毛边修正
40147
40216
 
40148
- if (isHSCreen)
40217
+ if (bHScreen)
40149
40218
  {
40150
40219
  this.Canvas.moveTo(yBottom,ToFixedPoint(x));
40151
40220
  this.Canvas.lineTo(y,ToFixedPoint(x));
@@ -40167,14 +40236,14 @@ function ChartClipColorStick()
40167
40236
  if (!IFrameSplitOperator.IsNumber(this.BaseValue) || this.BaseValue==0) return;
40168
40237
  if (!this.BaseLineColor) return;
40169
40238
 
40170
- var isHSCreen=this.ChartFrame.IsHScreen===true;
40239
+ var bHScreen=this.ChartFrame.IsHScreen===true;
40171
40240
  var border=this.ChartFrame.GetBorder();
40172
40241
  var y=this.ChartFrame.GetYFromData(this.BaseValue);
40173
40242
 
40174
40243
  this.Canvas.strokeStyle=this.BaseLineColor;
40175
40244
  this.Canvas.lineWidth=1*GetDevicePixelRatio();
40176
40245
 
40177
- if (isHSCreen)
40246
+ if (bHScreen)
40178
40247
  {
40179
40248
 
40180
40249
  }
@@ -40188,6 +40257,107 @@ function ChartClipColorStick()
40188
40257
  }
40189
40258
  }
40190
40259
 
40260
+ this.DrawStickText=function(aryData)
40261
+ {
40262
+ var config=this.TextLabelConfig;
40263
+ this.Canvas.font=config.Font;
40264
+ var border=this.ChartBorder.GetBorder();
40265
+ var itemHeight=config.TextHeight*2+config.TextMargin.Bottom+config.TextMargin.Top;
40266
+ for(var i=0; i<aryData.length; ++i)
40267
+ {
40268
+ var item=aryData[i];
40269
+ var value=item.Value;
40270
+ var xCenter=item.X;
40271
+ var xLeft=xCenter-config.LabelWidth/2;
40272
+
40273
+ var rtDraw={ Left:xLeft, Width:config.LabelWidth, Top:border.BottomEx+1, Height:itemHeight };
40274
+ rtDraw.Right=rtDraw.Left+rtDraw.Width;
40275
+ rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
40276
+ if (IFrameSplitOperator.IsNumber(value))
40277
+ {
40278
+ var bgColor=config.UnchangeColor;
40279
+ if (value>0) bgColor=config.UpColor;
40280
+ else if (value<0) bgColor=config.DownColor;
40281
+ this.DrawTextLabel(value, bgColor, config.BorderColor, config.TextColor, rtDraw, config.TextHeight, config.MaxTextWidth, config.TextMargin);
40282
+ }
40283
+
40284
+ var value=item.DiffValue;
40285
+ var rtDraw={ Left:xLeft, Width:config.LabelWidth, Bottom:border.TopEx-1, Height:itemHeight };
40286
+ rtDraw.Right=rtDraw.Left+rtDraw.Width;
40287
+ rtDraw.Top=rtDraw.Bottom-rtDraw.Height;
40288
+ if (IFrameSplitOperator.IsNumber(value))
40289
+ {
40290
+ var bgColor=config.UnchangeColor;
40291
+ if (value>0) bgColor=config.UpColor;
40292
+ else if (value<0) bgColor=config.DownColor;
40293
+ this.DrawTextLabel(value, bgColor, config.BorderColor, config.TextColor, rtDraw, config.TextHeight, config.MaxTextWidth, config.TextMargin);
40294
+ }
40295
+ }
40296
+ }
40297
+
40298
+ //数值标签
40299
+ this.DrawTextLabel=function(value, clrGB, clrBorder, clrText, rtDraw, textHeight, textWidth, textMargin)
40300
+ {
40301
+ if (clrGB)
40302
+ {
40303
+ this.Canvas.fillStyle=clrGB;
40304
+ this.Canvas.fillRect(rtDraw.Left ,rtDraw.Top, (rtDraw.Width), (rtDraw.Height));
40305
+ }
40306
+
40307
+ if (clrBorder)
40308
+ {
40309
+ this.Canvas.lineWidth=2;
40310
+ this.Canvas.strokeStyle=clrBorder;
40311
+ this.Canvas.strokeRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
40312
+ }
40313
+ else
40314
+ {
40315
+ this.Canvas.lineWidth=1;
40316
+ this.Canvas.strokeStyle="rgb(0,0,0)";
40317
+ this.Canvas.strokeRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
40318
+ }
40319
+
40320
+ var aryText=[null, null]; //大于3位数的 2行输出
40321
+ var sign=""; //负数
40322
+ if (value<0)
40323
+ {
40324
+ value=Math.abs(value);
40325
+ sign='-';
40326
+ }
40327
+
40328
+ if (value>999)
40329
+ {
40330
+ var thousand=parseInt(value/1000);
40331
+ var hundred=parseInt(value%1000);
40332
+
40333
+ aryText[0]=`${sign}${thousand}`;
40334
+ aryText[1]=`${hundred}`;
40335
+ if (hundred<10) aryText[1]=`00${hundred}`;
40336
+ else if (hundred<100) aryText[1]=`0${hundred}`;
40337
+ }
40338
+ else
40339
+ {
40340
+ aryText[1]=`${sign}${value.toFixed(0)}`;
40341
+ }
40342
+
40343
+ this.Canvas.textAlign="right";
40344
+ this.Canvas.textBaseline="top";
40345
+ var xRight=rtDraw.Right-(rtDraw.Right-rtDraw.Left-textWidth)/2;
40346
+
40347
+ this.Canvas.fillStyle=clrText;
40348
+ var yText=textMargin.Top+rtDraw.Top;
40349
+ for(var i=0;i<aryText.length;++i)
40350
+ {
40351
+ var text=aryText[i];
40352
+ if (text)
40353
+ {
40354
+ this.Canvas.fillText(text,xRight,yText);
40355
+ }
40356
+
40357
+ yText+=textHeight;
40358
+ }
40359
+ }
40360
+
40191
40361
  this.GetMaxMin=function()
40192
40362
  {
40193
40363
  if (!IFrameSplitOperator.IsNumber(this.BaseValue) || this.BaseValue==0)
@@ -40250,13 +40420,36 @@ function ChartClipColorStick()
40250
40420
 
40251
40421
  if (this.BaseValue>0)
40252
40422
  {
40253
- if (IFrameSplitOperator.IsNumber(maxDiffValue) && IFrameSplitOperator.IsNumber(range.Min))
40254
- range.Min-=maxDiffValue;
40423
+ if (this.Style==1)
40424
+ {
40425
+ if (IFrameSplitOperator.IsNumber(maxDiffValue))
40426
+ {
40427
+ var value=this.BaseValue+maxDiffValue;
40428
+ if (IFrameSplitOperator.IsNumber(range.Max) || range.Max<value) range.Max=value;
40429
+ }
40430
+ }
40431
+ else
40432
+ {
40433
+ if (IFrameSplitOperator.IsNumber(maxDiffValue) && IFrameSplitOperator.IsNumber(range.Min))
40434
+ range.Min-=maxDiffValue;
40435
+ }
40436
+
40255
40437
  }
40256
40438
  else
40257
40439
  {
40258
- if (IFrameSplitOperator.IsNumber(maxDiffValue) && IFrameSplitOperator.IsNumber(range.Max))
40259
- range.Max+=maxDiffValue;
40440
+ if (this.Style==1)
40441
+ {
40442
+ if (IFrameSplitOperator.IsNumber(maxDiffValue))
40443
+ {
40444
+ var value=this.BaseValue-maxDiffValue;
40445
+ if (IFrameSplitOperator.IsNumber(range.Min) || range.Min>value) range.Min=value;
40446
+ }
40447
+ }
40448
+ else
40449
+ {
40450
+ if (IFrameSplitOperator.IsNumber(maxDiffValue) && IFrameSplitOperator.IsNumber(range.Max))
40451
+ range.Max+=maxDiffValue;
40452
+ }
40260
40453
  }
40261
40454
 
40262
40455
  return range;
@@ -83515,8 +83708,8 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
83515
83708
  drawPictrueData.Y=(touches[0].clientY-uielement.getBoundingClientRect().top);
83516
83709
  if (this.GetChartDrawPictureByPoint(drawPictrueData))
83517
83710
  {
83518
-
83519
- drawPictrueData.ChartDrawPicture.Status=20;
83711
+ if (drawPictrueData.ChartDrawPicture.EnableMove==true)
83712
+ drawPictrueData.ChartDrawPicture.Status=20;
83520
83713
  drawPictrueData.ChartDrawPicture.ValueToPoint();
83521
83714
  drawPictrueData.ChartDrawPicture.MovePointIndex=drawPictrueData.PointIndex;
83522
83715
  drawPictrueData.ChartDrawPicture.IsSelected=true;
@@ -138392,7 +138585,7 @@ function ScrollBarBGChart()
138392
138585
 
138393
138586
 
138394
138587
 
138395
- var HQCHART_VERSION="1.1.13739";
138588
+ var HQCHART_VERSION="1.1.13745";
138396
138589
 
138397
138590
  function PrintHQChartVersion()
138398
138591
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13739";
8
+ var HQCHART_VERSION="1.1.13745";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {