hqchart 1.1.14408 → 1.1.14416
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.
- package/lib/umychart.vue.js +27 -22
- package/package.json +1 -1
- package/src/jscommon/umychart.complier.js +1 -1
- package/src/jscommon/umychart.js +140 -86
- package/src/jscommon/umychart.style.js +3 -3
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +145 -91
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +145 -91
|
@@ -15637,7 +15637,7 @@ function AverageWidthFrame()
|
|
|
15637
15637
|
this.IsShowYLine=true;
|
|
15638
15638
|
this.YInsideOffset=0;
|
|
15639
15639
|
this.YTextBaseline=0; //0=居中 1=上部 (目前就支持内部刻度)
|
|
15640
|
-
this.MultiTextFormat=0; //多行刻度信息显示模式 0=显示第1行 1
|
|
15640
|
+
this.MultiTextFormat=0; //多行刻度信息显示模式 0=显示第1行 1=单行多个文本 2=显示2行 3=多行输出(json格式)
|
|
15641
15641
|
this.RightTextMaxWidth=0;
|
|
15642
15642
|
|
|
15643
15643
|
this.ShortYLineLength=5;
|
|
@@ -15972,6 +15972,7 @@ function AverageWidthFrame()
|
|
|
15972
15972
|
var pixelRatio=GetDevicePixelRatio();
|
|
15973
15973
|
var itemHeight=(border.BottomEx-border.TopEx)/this.HorizontalInfo.length;
|
|
15974
15974
|
var aryMultiText=[];
|
|
15975
|
+
var aryLeftMulitText=[];
|
|
15975
15976
|
var rtPreRight, rtRight, rtLeft, rtPreLeft;
|
|
15976
15977
|
var textBaseline=0; //0=上 1=中 2=下
|
|
15977
15978
|
for(var i=this.HorizontalInfo.length-1; i>=0; --i) //从上往下画分割线
|
|
@@ -16078,7 +16079,12 @@ function AverageWidthFrame()
|
|
|
16078
16079
|
|
|
16079
16080
|
if (Array.isArray(item.Message[0]))
|
|
16080
16081
|
{
|
|
16081
|
-
if (this.MultiTextFormat==
|
|
16082
|
+
if (this.MultiTextFormat==1) //显示1行 格式如:价格/百分比
|
|
16083
|
+
{
|
|
16084
|
+
var textData=this.CreateMulitCoordinateItem(item.Message[0], left-2, yText, this.Canvas.textBaseline, item);
|
|
16085
|
+
aryLeftMulitText.push(textData);
|
|
16086
|
+
}
|
|
16087
|
+
else if (this.MultiTextFormat==3)
|
|
16082
16088
|
{
|
|
16083
16089
|
var obj={ Data:item.Message[0], X:left, Y:yText, TextBaseLine:textBaseline, IsLeft:true, Item:item, TextPadding:this.YTextPadding[0] };
|
|
16084
16090
|
this.DrawMultiLineText(obj);
|
|
@@ -16164,25 +16170,9 @@ function AverageWidthFrame()
|
|
|
16164
16170
|
this.Canvas.textAlign="left";
|
|
16165
16171
|
if (Array.isArray(item.Message[1]))
|
|
16166
16172
|
{
|
|
16167
|
-
if (this.MultiTextFormat==1) //显示1行
|
|
16173
|
+
if (this.MultiTextFormat==1) //显示1行 格式如:价格/百分比
|
|
16168
16174
|
{
|
|
16169
|
-
|
|
16170
|
-
{
|
|
16171
|
-
if (item.ExtendData.Font) this.Canvas.font=item.ExtendData.Font;
|
|
16172
|
-
}
|
|
16173
|
-
|
|
16174
|
-
var textData=
|
|
16175
|
-
{
|
|
16176
|
-
Text:
|
|
16177
|
-
[
|
|
16178
|
-
{Text:item.Message[1][0], Width:this.Canvas.measureText(item.Message[1][0]).width },
|
|
16179
|
-
{Text:item.Message[1][1], Width:this.Canvas.measureText(item.Message[1][1]).width }
|
|
16180
|
-
],
|
|
16181
|
-
X:xText+2,
|
|
16182
|
-
Y:yText,
|
|
16183
|
-
TextBaseline:this.Canvas.textBaseline,
|
|
16184
|
-
Item:item
|
|
16185
|
-
}
|
|
16175
|
+
var textData=this.CreateMulitCoordinateItem(item.Message[1], xText+2, yText, this.Canvas.textBaseline, item);
|
|
16186
16176
|
aryMultiText.push(textData);
|
|
16187
16177
|
}
|
|
16188
16178
|
else if (this.MultiTextFormat==2) //显示2行
|
|
@@ -16239,7 +16229,9 @@ function AverageWidthFrame()
|
|
|
16239
16229
|
yPrev=y;
|
|
16240
16230
|
}
|
|
16241
16231
|
|
|
16242
|
-
if (IFrameSplitOperator.IsNonEmptyArray(
|
|
16232
|
+
if (IFrameSplitOperator.IsNonEmptyArray(aryLeftMulitText) && this.MultiTextFormat==1) this.DrawMultiCoordinateLeftText(aryLeftMulitText);
|
|
16233
|
+
if (IFrameSplitOperator.IsNonEmptyArray(aryMultiText) && this.MultiTextFormat==1) this.DrawMultiCoordinateRightText(aryMultiText);
|
|
16234
|
+
|
|
16243
16235
|
|
|
16244
16236
|
if (isDrawRight && this.IsDrawRightBorder && this.YRightTextInfo)
|
|
16245
16237
|
{
|
|
@@ -16268,6 +16260,41 @@ function AverageWidthFrame()
|
|
|
16268
16260
|
}
|
|
16269
16261
|
}
|
|
16270
16262
|
|
|
16263
|
+
this.CreateMulitCoordinateItem=function(aryData, x, y, textBaseline, data)
|
|
16264
|
+
{
|
|
16265
|
+
var coordinateItem=
|
|
16266
|
+
{
|
|
16267
|
+
AryText:[], X:x,Y:y, TextBaseline:textBaseline, Item:data
|
|
16268
|
+
};
|
|
16269
|
+
|
|
16270
|
+
for(var i=0;i<aryData.length;++i)
|
|
16271
|
+
{
|
|
16272
|
+
var item=aryData[i];
|
|
16273
|
+
if (item.Font) this.Canvas.font=item.Font;
|
|
16274
|
+
var textWidth=0;
|
|
16275
|
+
if (item.Text) textWidth=this.Canvas.measureText(item.Text).width;
|
|
16276
|
+
|
|
16277
|
+
coordinateItem.AryText.push({ Width:textWidth, Item:item });
|
|
16278
|
+
}
|
|
16279
|
+
|
|
16280
|
+
return coordinateItem;
|
|
16281
|
+
}
|
|
16282
|
+
|
|
16283
|
+
this.GetMulitCoordinateItemTextWidth=function(aryData)
|
|
16284
|
+
{
|
|
16285
|
+
var total=0;
|
|
16286
|
+
for(var i=0;i<aryData.length;++i)
|
|
16287
|
+
{
|
|
16288
|
+
var item=aryData[i];
|
|
16289
|
+
if (item.Font) this.Canvas.font=item.Font;
|
|
16290
|
+
var width=this.Canvas.measureText(item.Text).width;
|
|
16291
|
+
|
|
16292
|
+
total+=width;
|
|
16293
|
+
}
|
|
16294
|
+
|
|
16295
|
+
return total;
|
|
16296
|
+
}
|
|
16297
|
+
|
|
16271
16298
|
//多行文字刻度输出 obj={ Data:, X:, Y:, TextBaseLine:, IsLeft:, Item:刻度数据 }
|
|
16272
16299
|
this.DrawMultiLineText=function(obj)
|
|
16273
16300
|
{
|
|
@@ -16358,53 +16385,86 @@ function AverageWidthFrame()
|
|
|
16358
16385
|
return rtRight;
|
|
16359
16386
|
}
|
|
16360
16387
|
|
|
16361
|
-
|
|
16388
|
+
//绘制多重坐标刻度文字 左侧
|
|
16389
|
+
this.DrawMultiCoordinateLeftText=function(aryText)
|
|
16362
16390
|
{
|
|
16363
|
-
var
|
|
16364
|
-
for(var i=0;i<aryText.length;++i)
|
|
16391
|
+
var aryMaxWidth=[];
|
|
16392
|
+
for(var i=0, j=0;i<aryText.length;++i)
|
|
16365
16393
|
{
|
|
16366
16394
|
var item=aryText[i];
|
|
16367
|
-
var
|
|
16368
|
-
|
|
16369
|
-
|
|
16370
|
-
|
|
16371
|
-
|
|
16372
|
-
|
|
16373
|
-
else if (maxWidth[1]<width) maxWidth[1]=width;
|
|
16395
|
+
for(var j=0;j<item.AryText.length;++j)
|
|
16396
|
+
{
|
|
16397
|
+
var textItem=item.AryText[j];
|
|
16398
|
+
if (!IFrameSplitOperator.IsNumber(aryMaxWidth[j]) || aryMaxWidth[j]<textItem.Width) aryMaxWidth[j]=textItem.Width;
|
|
16399
|
+
}
|
|
16400
|
+
|
|
16374
16401
|
}
|
|
16375
16402
|
|
|
16403
|
+
this.Canvas.textAlign="right";
|
|
16376
16404
|
for(var i=0;i<aryText.length;++i)
|
|
16377
16405
|
{
|
|
16378
16406
|
var item=aryText[i];
|
|
16379
16407
|
var message=item.Item;
|
|
16380
|
-
|
|
16408
|
+
var x=item.X;
|
|
16381
16409
|
this.Canvas.textBaseline=item.TextBaseline;
|
|
16382
|
-
|
|
16383
|
-
|
|
16384
|
-
|
|
16385
|
-
|
|
16386
|
-
|
|
16410
|
+
for(var j=0;j<item.AryText.length;++j)
|
|
16411
|
+
{
|
|
16412
|
+
var textItem=item.AryText[j];
|
|
16413
|
+
var subText=textItem.Item;
|
|
16414
|
+
if (subText && subText.Text)
|
|
16415
|
+
{
|
|
16416
|
+
if (subText.Font) this.Canvas.font=subText.Font; //字体
|
|
16417
|
+
else if (message.Font) this.Canvas.font=message.Font;
|
|
16418
|
+
|
|
16419
|
+
if (subText.Color) this.Canvas.fillStyle=subText.Color; //颜色
|
|
16420
|
+
else this.Canvas.fillStyle=message.TextColor;
|
|
16387
16421
|
|
|
16388
|
-
|
|
16389
|
-
|
|
16390
|
-
this.Canvas.fillText(item.Text[1].Text,x,item.Y);
|
|
16422
|
+
this.Canvas.fillText(subText.Text,x,item.Y);
|
|
16423
|
+
}
|
|
16391
16424
|
|
|
16392
|
-
|
|
16393
|
-
|
|
16425
|
+
x-=aryMaxWidth[j];
|
|
16426
|
+
}
|
|
16427
|
+
}
|
|
16428
|
+
}
|
|
16394
16429
|
|
|
16395
|
-
|
|
16396
|
-
|
|
16397
|
-
|
|
16430
|
+
//绘制多重坐标刻度文字 右侧
|
|
16431
|
+
this.DrawMultiCoordinateRightText=function(aryText)
|
|
16432
|
+
{
|
|
16433
|
+
var aryMaxWidth=[];
|
|
16434
|
+
for(var i=0, j=0;i<aryText.length;++i)
|
|
16435
|
+
{
|
|
16436
|
+
var item=aryText[i];
|
|
16437
|
+
for(var j=0;j<item.AryText.length;++j)
|
|
16438
|
+
{
|
|
16439
|
+
var textItem=item.AryText[j];
|
|
16440
|
+
if (!IFrameSplitOperator.IsNumber(aryMaxWidth[j]) || aryMaxWidth[j]<textItem.Width) aryMaxWidth[j]=textItem.Width;
|
|
16441
|
+
}
|
|
16398
16442
|
|
|
16399
|
-
|
|
16400
|
-
else this.Canvas.fillStyle=message.TextColor;
|
|
16443
|
+
}
|
|
16401
16444
|
|
|
16402
|
-
|
|
16403
|
-
|
|
16404
|
-
|
|
16445
|
+
this.Canvas.textAlign="right";
|
|
16446
|
+
for(var i=0;i<aryText.length;++i)
|
|
16447
|
+
{
|
|
16448
|
+
var item=aryText[i];
|
|
16449
|
+
var message=item.Item;
|
|
16450
|
+
var x=item.X;
|
|
16451
|
+
this.Canvas.textBaseline=item.TextBaseline;
|
|
16452
|
+
for(var j=0;j<item.AryText.length;++j)
|
|
16453
|
+
{
|
|
16454
|
+
var textItem=item.AryText[j];
|
|
16455
|
+
var subText=textItem.Item;
|
|
16456
|
+
if (subText && subText.Text)
|
|
16457
|
+
{
|
|
16458
|
+
if (subText.Font) this.Canvas.font=subText.Font; //字体
|
|
16459
|
+
else if (message.Font) this.Canvas.font=message.Font;
|
|
16460
|
+
|
|
16461
|
+
if (subText.Color) this.Canvas.fillStyle=subText.Color; //颜色
|
|
16462
|
+
else this.Canvas.fillStyle=message.TextColor;
|
|
16405
16463
|
|
|
16406
|
-
|
|
16407
|
-
|
|
16464
|
+
x+=aryMaxWidth[j];
|
|
16465
|
+
this.Canvas.fillText(subText.Text,x,item.Y);
|
|
16466
|
+
}
|
|
16467
|
+
}
|
|
16408
16468
|
}
|
|
16409
16469
|
}
|
|
16410
16470
|
|
|
@@ -17982,7 +18042,8 @@ function AverageWidthFrame()
|
|
|
17982
18042
|
{
|
|
17983
18043
|
if (Array.isArray(item.Message[0]))
|
|
17984
18044
|
{
|
|
17985
|
-
textWidth=this.
|
|
18045
|
+
if (this.MultiTextFormat==1) textWidth=this.GetMulitCoordinateItemTextWidth(item.Message[0]);
|
|
18046
|
+
else textWidth=this.GetMulitTextMaxWidth(item.Message[0]);
|
|
17986
18047
|
}
|
|
17987
18048
|
else
|
|
17988
18049
|
{
|
|
@@ -18001,17 +18062,9 @@ function AverageWidthFrame()
|
|
|
18001
18062
|
|
|
18002
18063
|
if (Array.isArray(item.Message[1]))
|
|
18003
18064
|
{
|
|
18004
|
-
if (this.MultiTextFormat==1
|
|
18065
|
+
if (this.MultiTextFormat==1) //显示1行 格式:价格/百分比
|
|
18005
18066
|
{
|
|
18006
|
-
|
|
18007
|
-
|
|
18008
|
-
var width1=this.Canvas.measureText(item.Message[1][0]).width;
|
|
18009
|
-
var width2=this.Canvas.measureText(item.Message[1][1]).width;
|
|
18010
|
-
var width3=this.Canvas.measureText('/').width;
|
|
18011
|
-
textWidth=width1+width3;
|
|
18012
|
-
if (rightExtendWidth<width2) rightExtendWidth=width2;
|
|
18013
|
-
|
|
18014
|
-
//JSConsole.Chart.Log(`[ChartData::GetScaleTextWidth] ${item.Message[1][1]}/${item.Message[1][0]} ${textWidth}, ${rightExtendWidth}`);
|
|
18067
|
+
textWidth=this.GetMulitCoordinateItemTextWidth(item.Message[1]);
|
|
18015
18068
|
}
|
|
18016
18069
|
else if (this.MultiTextFormat==2) //显示2行
|
|
18017
18070
|
{
|
|
@@ -54716,7 +54769,7 @@ function FrameSplitKLinePriceY()
|
|
|
54716
54769
|
this.EnableZoomUpDown=false; //上下左右拖拽
|
|
54717
54770
|
this.LastMaxMin; //当前显示的最高最低范围
|
|
54718
54771
|
|
|
54719
|
-
this.PercentageTextFormat=0; //0=显示第1行 1=显示2行 2
|
|
54772
|
+
this.PercentageTextFormat=0; //0=显示第1行 1=单行格式: 价格/百分比, 2=显示2行 3=2行显示(json格式)
|
|
54720
54773
|
|
|
54721
54774
|
this.IsEnableDragY=function()
|
|
54722
54775
|
{
|
|
@@ -54948,17 +55001,7 @@ function FrameSplitKLinePriceY()
|
|
|
54948
55001
|
var price=(value+1)*firstOpenPrice;
|
|
54949
55002
|
var item=new CoordinateInfo();
|
|
54950
55003
|
item.Value=price;
|
|
54951
|
-
|
|
54952
|
-
|
|
54953
|
-
if (this.IsShowRightText)
|
|
54954
|
-
{
|
|
54955
|
-
var strPrice=price.toFixed(floatPrecision);
|
|
54956
|
-
var text=(value*100).toFixed(2); //右边百分比
|
|
54957
|
-
text=IFrameSplitOperator.RemoveZero(text);
|
|
54958
|
-
text+='%';
|
|
54959
|
-
item.Message[1]=[text,strPrice];
|
|
54960
|
-
item.ExtendData=textColor;
|
|
54961
|
-
}
|
|
55004
|
+
this.FormatPercentageItem(item, value, floatPrecision,textColor);
|
|
54962
55005
|
aryHorizontal.push(item);
|
|
54963
55006
|
}
|
|
54964
55007
|
|
|
@@ -54969,16 +55012,7 @@ function FrameSplitKLinePriceY()
|
|
|
54969
55012
|
|
|
54970
55013
|
var item=new CoordinateInfo();
|
|
54971
55014
|
item.Value=price;
|
|
54972
|
-
|
|
54973
|
-
if (this.IsShowRightText)
|
|
54974
|
-
{
|
|
54975
|
-
var strPrice=price.toFixed(floatPrecision);
|
|
54976
|
-
var text=(value*100).toFixed(2); //右边百分比
|
|
54977
|
-
text=IFrameSplitOperator.RemoveZero(text);
|
|
54978
|
-
text+='%';
|
|
54979
|
-
item.Message[1]=[text,strPrice];
|
|
54980
|
-
item.ExtendData=textColor;
|
|
54981
|
-
}
|
|
55015
|
+
this.FormatPercentageItem(item, value, floatPrecision,textColor);
|
|
54982
55016
|
aryHorizontal.push(item);
|
|
54983
55017
|
}
|
|
54984
55018
|
|
|
@@ -54994,6 +55028,26 @@ function FrameSplitKLinePriceY()
|
|
|
54994
55028
|
return true;
|
|
54995
55029
|
}
|
|
54996
55030
|
|
|
55031
|
+
this.FormatPercentageItem=function(item, percentage, floatPrecision, textColor)
|
|
55032
|
+
{
|
|
55033
|
+
var price=item.Value;
|
|
55034
|
+
var strPrice=price.toFixed(floatPrecision);
|
|
55035
|
+
if (this.IsShowLeftText) item.Message[0]=strPrice; //左边价格坐标
|
|
55036
|
+
|
|
55037
|
+
if (this.IsShowRightText) //右侧 价格/百分比
|
|
55038
|
+
{
|
|
55039
|
+
var strPrcentage=`${IFrameSplitOperator.RemoveZero(percentage.toFixed(2))}%`; //右边百分比
|
|
55040
|
+
if (this.PercentageTextFormat==1)
|
|
55041
|
+
item.Message[1]=[{ Text:strPrice, Color:textColor.PriceColor }, {Text:"/", Color:textColor.PercentageColor}, {Text:strPrcentage, Color:textColor.SplitColor}];
|
|
55042
|
+
else if (this.PercentageTextFormat==3)
|
|
55043
|
+
item.Message[1]=[{ Text:strPrice, Color:textColor.PriceColor }, {Text:strPrcentage, Color:textColor.PercentageColor}];
|
|
55044
|
+
else if (this.PercentageTextFormat==2)
|
|
55045
|
+
item.Message[1]=[strPrcentage, strPrice];
|
|
55046
|
+
else
|
|
55047
|
+
item.Message[1]=strPrcentage;
|
|
55048
|
+
}
|
|
55049
|
+
}
|
|
55050
|
+
|
|
54997
55051
|
//等比坐标 当前屏最后第2根K线的收盘加为基准, 上下涨幅10%分割
|
|
54998
55052
|
this.SplitIncrease=function(splitData,floatPrecision)
|
|
54999
55053
|
{
|
|
@@ -56832,7 +56886,7 @@ function FrameSplitMinutePriceY()
|
|
|
56832
56886
|
}
|
|
56833
56887
|
else if (this.RightTextFormat==2) //价格/百分比
|
|
56834
56888
|
{
|
|
56835
|
-
coordinate.Message[1]=[strPer
|
|
56889
|
+
coordinate.Message[1]=[ {Text:strPrice}, {Text:"/"}, { Text:strPer} ];
|
|
56836
56890
|
}
|
|
56837
56891
|
else
|
|
56838
56892
|
{
|
|
@@ -127387,7 +127441,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
|
|
|
127387
127441
|
{
|
|
127388
127442
|
outVarItem.Data=this.FittingMinuteArray(item.data,date,time,hqChart);
|
|
127389
127443
|
if (item.color) outVarItem.Color=item.color;
|
|
127390
|
-
if (item.linewidth
|
|
127444
|
+
if (item.linewidth) outVarItem.LineWidth=item.linewidth;
|
|
127391
127445
|
if (item.isshow==false) outVarItem.IsShow = false;
|
|
127392
127446
|
if (item.isexdata==true) outVarItem.IsExData = true;
|
|
127393
127447
|
if (item.BreakPoint) outVarItem.BreakPoint=item.BreakPoint;
|
|
@@ -128402,9 +128456,9 @@ function GetBlackStyle()
|
|
|
128402
128456
|
|
|
128403
128457
|
PercentageText: //百分比坐标文字颜色
|
|
128404
128458
|
{
|
|
128405
|
-
PriceColor:'rgb(
|
|
128406
|
-
PercentageColor:"rgb(
|
|
128407
|
-
SplitColor:"rgb(
|
|
128459
|
+
PriceColor:'rgb(220,220,220)',
|
|
128460
|
+
PercentageColor:"rgb(220,220,220)",
|
|
128461
|
+
SplitColor:"rgb(220,220,220)",
|
|
128408
128462
|
Font:14*GetDevicePixelRatio() +"px 微软雅黑"
|
|
128409
128463
|
}
|
|
128410
128464
|
},
|
|
@@ -143351,7 +143405,7 @@ function ScrollBarBGChart()
|
|
|
143351
143405
|
|
|
143352
143406
|
|
|
143353
143407
|
|
|
143354
|
-
var HQCHART_VERSION="1.1.
|
|
143408
|
+
var HQCHART_VERSION="1.1.14415";
|
|
143355
143409
|
|
|
143356
143410
|
function PrintHQChartVersion()
|
|
143357
143411
|
{
|