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
|
@@ -15681,7 +15681,7 @@ function AverageWidthFrame()
|
|
|
15681
15681
|
this.IsShowYLine=true;
|
|
15682
15682
|
this.YInsideOffset=0;
|
|
15683
15683
|
this.YTextBaseline=0; //0=居中 1=上部 (目前就支持内部刻度)
|
|
15684
|
-
this.MultiTextFormat=0; //多行刻度信息显示模式 0=显示第1行 1
|
|
15684
|
+
this.MultiTextFormat=0; //多行刻度信息显示模式 0=显示第1行 1=单行多个文本 2=显示2行 3=多行输出(json格式)
|
|
15685
15685
|
this.RightTextMaxWidth=0;
|
|
15686
15686
|
|
|
15687
15687
|
this.ShortYLineLength=5;
|
|
@@ -16016,6 +16016,7 @@ function AverageWidthFrame()
|
|
|
16016
16016
|
var pixelRatio=GetDevicePixelRatio();
|
|
16017
16017
|
var itemHeight=(border.BottomEx-border.TopEx)/this.HorizontalInfo.length;
|
|
16018
16018
|
var aryMultiText=[];
|
|
16019
|
+
var aryLeftMulitText=[];
|
|
16019
16020
|
var rtPreRight, rtRight, rtLeft, rtPreLeft;
|
|
16020
16021
|
var textBaseline=0; //0=上 1=中 2=下
|
|
16021
16022
|
for(var i=this.HorizontalInfo.length-1; i>=0; --i) //从上往下画分割线
|
|
@@ -16122,7 +16123,12 @@ function AverageWidthFrame()
|
|
|
16122
16123
|
|
|
16123
16124
|
if (Array.isArray(item.Message[0]))
|
|
16124
16125
|
{
|
|
16125
|
-
if (this.MultiTextFormat==
|
|
16126
|
+
if (this.MultiTextFormat==1) //显示1行 格式如:价格/百分比
|
|
16127
|
+
{
|
|
16128
|
+
var textData=this.CreateMulitCoordinateItem(item.Message[0], left-2, yText, this.Canvas.textBaseline, item);
|
|
16129
|
+
aryLeftMulitText.push(textData);
|
|
16130
|
+
}
|
|
16131
|
+
else if (this.MultiTextFormat==3)
|
|
16126
16132
|
{
|
|
16127
16133
|
var obj={ Data:item.Message[0], X:left, Y:yText, TextBaseLine:textBaseline, IsLeft:true, Item:item, TextPadding:this.YTextPadding[0] };
|
|
16128
16134
|
this.DrawMultiLineText(obj);
|
|
@@ -16208,25 +16214,9 @@ function AverageWidthFrame()
|
|
|
16208
16214
|
this.Canvas.textAlign="left";
|
|
16209
16215
|
if (Array.isArray(item.Message[1]))
|
|
16210
16216
|
{
|
|
16211
|
-
if (this.MultiTextFormat==1) //显示1行
|
|
16217
|
+
if (this.MultiTextFormat==1) //显示1行 格式如:价格/百分比
|
|
16212
16218
|
{
|
|
16213
|
-
|
|
16214
|
-
{
|
|
16215
|
-
if (item.ExtendData.Font) this.Canvas.font=item.ExtendData.Font;
|
|
16216
|
-
}
|
|
16217
|
-
|
|
16218
|
-
var textData=
|
|
16219
|
-
{
|
|
16220
|
-
Text:
|
|
16221
|
-
[
|
|
16222
|
-
{Text:item.Message[1][0], Width:this.Canvas.measureText(item.Message[1][0]).width },
|
|
16223
|
-
{Text:item.Message[1][1], Width:this.Canvas.measureText(item.Message[1][1]).width }
|
|
16224
|
-
],
|
|
16225
|
-
X:xText+2,
|
|
16226
|
-
Y:yText,
|
|
16227
|
-
TextBaseline:this.Canvas.textBaseline,
|
|
16228
|
-
Item:item
|
|
16229
|
-
}
|
|
16219
|
+
var textData=this.CreateMulitCoordinateItem(item.Message[1], xText+2, yText, this.Canvas.textBaseline, item);
|
|
16230
16220
|
aryMultiText.push(textData);
|
|
16231
16221
|
}
|
|
16232
16222
|
else if (this.MultiTextFormat==2) //显示2行
|
|
@@ -16283,7 +16273,9 @@ function AverageWidthFrame()
|
|
|
16283
16273
|
yPrev=y;
|
|
16284
16274
|
}
|
|
16285
16275
|
|
|
16286
|
-
if (IFrameSplitOperator.IsNonEmptyArray(
|
|
16276
|
+
if (IFrameSplitOperator.IsNonEmptyArray(aryLeftMulitText) && this.MultiTextFormat==1) this.DrawMultiCoordinateLeftText(aryLeftMulitText);
|
|
16277
|
+
if (IFrameSplitOperator.IsNonEmptyArray(aryMultiText) && this.MultiTextFormat==1) this.DrawMultiCoordinateRightText(aryMultiText);
|
|
16278
|
+
|
|
16287
16279
|
|
|
16288
16280
|
if (isDrawRight && this.IsDrawRightBorder && this.YRightTextInfo)
|
|
16289
16281
|
{
|
|
@@ -16312,6 +16304,41 @@ function AverageWidthFrame()
|
|
|
16312
16304
|
}
|
|
16313
16305
|
}
|
|
16314
16306
|
|
|
16307
|
+
this.CreateMulitCoordinateItem=function(aryData, x, y, textBaseline, data)
|
|
16308
|
+
{
|
|
16309
|
+
var coordinateItem=
|
|
16310
|
+
{
|
|
16311
|
+
AryText:[], X:x,Y:y, TextBaseline:textBaseline, Item:data
|
|
16312
|
+
};
|
|
16313
|
+
|
|
16314
|
+
for(var i=0;i<aryData.length;++i)
|
|
16315
|
+
{
|
|
16316
|
+
var item=aryData[i];
|
|
16317
|
+
if (item.Font) this.Canvas.font=item.Font;
|
|
16318
|
+
var textWidth=0;
|
|
16319
|
+
if (item.Text) textWidth=this.Canvas.measureText(item.Text).width;
|
|
16320
|
+
|
|
16321
|
+
coordinateItem.AryText.push({ Width:textWidth, Item:item });
|
|
16322
|
+
}
|
|
16323
|
+
|
|
16324
|
+
return coordinateItem;
|
|
16325
|
+
}
|
|
16326
|
+
|
|
16327
|
+
this.GetMulitCoordinateItemTextWidth=function(aryData)
|
|
16328
|
+
{
|
|
16329
|
+
var total=0;
|
|
16330
|
+
for(var i=0;i<aryData.length;++i)
|
|
16331
|
+
{
|
|
16332
|
+
var item=aryData[i];
|
|
16333
|
+
if (item.Font) this.Canvas.font=item.Font;
|
|
16334
|
+
var width=this.Canvas.measureText(item.Text).width;
|
|
16335
|
+
|
|
16336
|
+
total+=width;
|
|
16337
|
+
}
|
|
16338
|
+
|
|
16339
|
+
return total;
|
|
16340
|
+
}
|
|
16341
|
+
|
|
16315
16342
|
//多行文字刻度输出 obj={ Data:, X:, Y:, TextBaseLine:, IsLeft:, Item:刻度数据 }
|
|
16316
16343
|
this.DrawMultiLineText=function(obj)
|
|
16317
16344
|
{
|
|
@@ -16402,53 +16429,86 @@ function AverageWidthFrame()
|
|
|
16402
16429
|
return rtRight;
|
|
16403
16430
|
}
|
|
16404
16431
|
|
|
16405
|
-
|
|
16432
|
+
//绘制多重坐标刻度文字 左侧
|
|
16433
|
+
this.DrawMultiCoordinateLeftText=function(aryText)
|
|
16406
16434
|
{
|
|
16407
|
-
var
|
|
16408
|
-
for(var i=0;i<aryText.length;++i)
|
|
16435
|
+
var aryMaxWidth=[];
|
|
16436
|
+
for(var i=0, j=0;i<aryText.length;++i)
|
|
16409
16437
|
{
|
|
16410
16438
|
var item=aryText[i];
|
|
16411
|
-
var
|
|
16412
|
-
|
|
16413
|
-
|
|
16414
|
-
|
|
16415
|
-
|
|
16416
|
-
|
|
16417
|
-
else if (maxWidth[1]<width) maxWidth[1]=width;
|
|
16439
|
+
for(var j=0;j<item.AryText.length;++j)
|
|
16440
|
+
{
|
|
16441
|
+
var textItem=item.AryText[j];
|
|
16442
|
+
if (!IFrameSplitOperator.IsNumber(aryMaxWidth[j]) || aryMaxWidth[j]<textItem.Width) aryMaxWidth[j]=textItem.Width;
|
|
16443
|
+
}
|
|
16444
|
+
|
|
16418
16445
|
}
|
|
16419
16446
|
|
|
16447
|
+
this.Canvas.textAlign="right";
|
|
16420
16448
|
for(var i=0;i<aryText.length;++i)
|
|
16421
16449
|
{
|
|
16422
16450
|
var item=aryText[i];
|
|
16423
16451
|
var message=item.Item;
|
|
16424
|
-
|
|
16452
|
+
var x=item.X;
|
|
16425
16453
|
this.Canvas.textBaseline=item.TextBaseline;
|
|
16426
|
-
|
|
16427
|
-
|
|
16428
|
-
|
|
16429
|
-
|
|
16430
|
-
|
|
16454
|
+
for(var j=0;j<item.AryText.length;++j)
|
|
16455
|
+
{
|
|
16456
|
+
var textItem=item.AryText[j];
|
|
16457
|
+
var subText=textItem.Item;
|
|
16458
|
+
if (subText && subText.Text)
|
|
16459
|
+
{
|
|
16460
|
+
if (subText.Font) this.Canvas.font=subText.Font; //字体
|
|
16461
|
+
else if (message.Font) this.Canvas.font=message.Font;
|
|
16462
|
+
|
|
16463
|
+
if (subText.Color) this.Canvas.fillStyle=subText.Color; //颜色
|
|
16464
|
+
else this.Canvas.fillStyle=message.TextColor;
|
|
16431
16465
|
|
|
16432
|
-
|
|
16433
|
-
|
|
16434
|
-
this.Canvas.fillText(item.Text[1].Text,x,item.Y);
|
|
16466
|
+
this.Canvas.fillText(subText.Text,x,item.Y);
|
|
16467
|
+
}
|
|
16435
16468
|
|
|
16436
|
-
|
|
16437
|
-
|
|
16469
|
+
x-=aryMaxWidth[j];
|
|
16470
|
+
}
|
|
16471
|
+
}
|
|
16472
|
+
}
|
|
16438
16473
|
|
|
16439
|
-
|
|
16440
|
-
|
|
16441
|
-
|
|
16474
|
+
//绘制多重坐标刻度文字 右侧
|
|
16475
|
+
this.DrawMultiCoordinateRightText=function(aryText)
|
|
16476
|
+
{
|
|
16477
|
+
var aryMaxWidth=[];
|
|
16478
|
+
for(var i=0, j=0;i<aryText.length;++i)
|
|
16479
|
+
{
|
|
16480
|
+
var item=aryText[i];
|
|
16481
|
+
for(var j=0;j<item.AryText.length;++j)
|
|
16482
|
+
{
|
|
16483
|
+
var textItem=item.AryText[j];
|
|
16484
|
+
if (!IFrameSplitOperator.IsNumber(aryMaxWidth[j]) || aryMaxWidth[j]<textItem.Width) aryMaxWidth[j]=textItem.Width;
|
|
16485
|
+
}
|
|
16442
16486
|
|
|
16443
|
-
|
|
16444
|
-
else this.Canvas.fillStyle=message.TextColor;
|
|
16487
|
+
}
|
|
16445
16488
|
|
|
16446
|
-
|
|
16447
|
-
|
|
16448
|
-
|
|
16489
|
+
this.Canvas.textAlign="right";
|
|
16490
|
+
for(var i=0;i<aryText.length;++i)
|
|
16491
|
+
{
|
|
16492
|
+
var item=aryText[i];
|
|
16493
|
+
var message=item.Item;
|
|
16494
|
+
var x=item.X;
|
|
16495
|
+
this.Canvas.textBaseline=item.TextBaseline;
|
|
16496
|
+
for(var j=0;j<item.AryText.length;++j)
|
|
16497
|
+
{
|
|
16498
|
+
var textItem=item.AryText[j];
|
|
16499
|
+
var subText=textItem.Item;
|
|
16500
|
+
if (subText && subText.Text)
|
|
16501
|
+
{
|
|
16502
|
+
if (subText.Font) this.Canvas.font=subText.Font; //字体
|
|
16503
|
+
else if (message.Font) this.Canvas.font=message.Font;
|
|
16504
|
+
|
|
16505
|
+
if (subText.Color) this.Canvas.fillStyle=subText.Color; //颜色
|
|
16506
|
+
else this.Canvas.fillStyle=message.TextColor;
|
|
16449
16507
|
|
|
16450
|
-
|
|
16451
|
-
|
|
16508
|
+
x+=aryMaxWidth[j];
|
|
16509
|
+
this.Canvas.fillText(subText.Text,x,item.Y);
|
|
16510
|
+
}
|
|
16511
|
+
}
|
|
16452
16512
|
}
|
|
16453
16513
|
}
|
|
16454
16514
|
|
|
@@ -18026,7 +18086,8 @@ function AverageWidthFrame()
|
|
|
18026
18086
|
{
|
|
18027
18087
|
if (Array.isArray(item.Message[0]))
|
|
18028
18088
|
{
|
|
18029
|
-
textWidth=this.
|
|
18089
|
+
if (this.MultiTextFormat==1) textWidth=this.GetMulitCoordinateItemTextWidth(item.Message[0]);
|
|
18090
|
+
else textWidth=this.GetMulitTextMaxWidth(item.Message[0]);
|
|
18030
18091
|
}
|
|
18031
18092
|
else
|
|
18032
18093
|
{
|
|
@@ -18045,17 +18106,9 @@ function AverageWidthFrame()
|
|
|
18045
18106
|
|
|
18046
18107
|
if (Array.isArray(item.Message[1]))
|
|
18047
18108
|
{
|
|
18048
|
-
if (this.MultiTextFormat==1
|
|
18109
|
+
if (this.MultiTextFormat==1) //显示1行 格式:价格/百分比
|
|
18049
18110
|
{
|
|
18050
|
-
|
|
18051
|
-
|
|
18052
|
-
var width1=this.Canvas.measureText(item.Message[1][0]).width;
|
|
18053
|
-
var width2=this.Canvas.measureText(item.Message[1][1]).width;
|
|
18054
|
-
var width3=this.Canvas.measureText('/').width;
|
|
18055
|
-
textWidth=width1+width3;
|
|
18056
|
-
if (rightExtendWidth<width2) rightExtendWidth=width2;
|
|
18057
|
-
|
|
18058
|
-
//JSConsole.Chart.Log(`[ChartData::GetScaleTextWidth] ${item.Message[1][1]}/${item.Message[1][0]} ${textWidth}, ${rightExtendWidth}`);
|
|
18111
|
+
textWidth=this.GetMulitCoordinateItemTextWidth(item.Message[1]);
|
|
18059
18112
|
}
|
|
18060
18113
|
else if (this.MultiTextFormat==2) //显示2行
|
|
18061
18114
|
{
|
|
@@ -54760,7 +54813,7 @@ function FrameSplitKLinePriceY()
|
|
|
54760
54813
|
this.EnableZoomUpDown=false; //上下左右拖拽
|
|
54761
54814
|
this.LastMaxMin; //当前显示的最高最低范围
|
|
54762
54815
|
|
|
54763
|
-
this.PercentageTextFormat=0; //0=显示第1行 1=显示2行 2
|
|
54816
|
+
this.PercentageTextFormat=0; //0=显示第1行 1=单行格式: 价格/百分比, 2=显示2行 3=2行显示(json格式)
|
|
54764
54817
|
|
|
54765
54818
|
this.IsEnableDragY=function()
|
|
54766
54819
|
{
|
|
@@ -54992,17 +55045,7 @@ function FrameSplitKLinePriceY()
|
|
|
54992
55045
|
var price=(value+1)*firstOpenPrice;
|
|
54993
55046
|
var item=new CoordinateInfo();
|
|
54994
55047
|
item.Value=price;
|
|
54995
|
-
|
|
54996
|
-
|
|
54997
|
-
if (this.IsShowRightText)
|
|
54998
|
-
{
|
|
54999
|
-
var strPrice=price.toFixed(floatPrecision);
|
|
55000
|
-
var text=(value*100).toFixed(2); //右边百分比
|
|
55001
|
-
text=IFrameSplitOperator.RemoveZero(text);
|
|
55002
|
-
text+='%';
|
|
55003
|
-
item.Message[1]=[text,strPrice];
|
|
55004
|
-
item.ExtendData=textColor;
|
|
55005
|
-
}
|
|
55048
|
+
this.FormatPercentageItem(item, value, floatPrecision,textColor);
|
|
55006
55049
|
aryHorizontal.push(item);
|
|
55007
55050
|
}
|
|
55008
55051
|
|
|
@@ -55013,16 +55056,7 @@ function FrameSplitKLinePriceY()
|
|
|
55013
55056
|
|
|
55014
55057
|
var item=new CoordinateInfo();
|
|
55015
55058
|
item.Value=price;
|
|
55016
|
-
|
|
55017
|
-
if (this.IsShowRightText)
|
|
55018
|
-
{
|
|
55019
|
-
var strPrice=price.toFixed(floatPrecision);
|
|
55020
|
-
var text=(value*100).toFixed(2); //右边百分比
|
|
55021
|
-
text=IFrameSplitOperator.RemoveZero(text);
|
|
55022
|
-
text+='%';
|
|
55023
|
-
item.Message[1]=[text,strPrice];
|
|
55024
|
-
item.ExtendData=textColor;
|
|
55025
|
-
}
|
|
55059
|
+
this.FormatPercentageItem(item, value, floatPrecision,textColor);
|
|
55026
55060
|
aryHorizontal.push(item);
|
|
55027
55061
|
}
|
|
55028
55062
|
|
|
@@ -55038,6 +55072,26 @@ function FrameSplitKLinePriceY()
|
|
|
55038
55072
|
return true;
|
|
55039
55073
|
}
|
|
55040
55074
|
|
|
55075
|
+
this.FormatPercentageItem=function(item, percentage, floatPrecision, textColor)
|
|
55076
|
+
{
|
|
55077
|
+
var price=item.Value;
|
|
55078
|
+
var strPrice=price.toFixed(floatPrecision);
|
|
55079
|
+
if (this.IsShowLeftText) item.Message[0]=strPrice; //左边价格坐标
|
|
55080
|
+
|
|
55081
|
+
if (this.IsShowRightText) //右侧 价格/百分比
|
|
55082
|
+
{
|
|
55083
|
+
var strPrcentage=`${IFrameSplitOperator.RemoveZero(percentage.toFixed(2))}%`; //右边百分比
|
|
55084
|
+
if (this.PercentageTextFormat==1)
|
|
55085
|
+
item.Message[1]=[{ Text:strPrice, Color:textColor.PriceColor }, {Text:"/", Color:textColor.PercentageColor}, {Text:strPrcentage, Color:textColor.SplitColor}];
|
|
55086
|
+
else if (this.PercentageTextFormat==3)
|
|
55087
|
+
item.Message[1]=[{ Text:strPrice, Color:textColor.PriceColor }, {Text:strPrcentage, Color:textColor.PercentageColor}];
|
|
55088
|
+
else if (this.PercentageTextFormat==2)
|
|
55089
|
+
item.Message[1]=[strPrcentage, strPrice];
|
|
55090
|
+
else
|
|
55091
|
+
item.Message[1]=strPrcentage;
|
|
55092
|
+
}
|
|
55093
|
+
}
|
|
55094
|
+
|
|
55041
55095
|
//等比坐标 当前屏最后第2根K线的收盘加为基准, 上下涨幅10%分割
|
|
55042
55096
|
this.SplitIncrease=function(splitData,floatPrecision)
|
|
55043
55097
|
{
|
|
@@ -56876,7 +56930,7 @@ function FrameSplitMinutePriceY()
|
|
|
56876
56930
|
}
|
|
56877
56931
|
else if (this.RightTextFormat==2) //价格/百分比
|
|
56878
56932
|
{
|
|
56879
|
-
coordinate.Message[1]=[strPer
|
|
56933
|
+
coordinate.Message[1]=[ {Text:strPrice}, {Text:"/"}, { Text:strPer} ];
|
|
56880
56934
|
}
|
|
56881
56935
|
else
|
|
56882
56936
|
{
|
|
@@ -127431,7 +127485,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
|
|
|
127431
127485
|
{
|
|
127432
127486
|
outVarItem.Data=this.FittingMinuteArray(item.data,date,time,hqChart);
|
|
127433
127487
|
if (item.color) outVarItem.Color=item.color;
|
|
127434
|
-
if (item.linewidth
|
|
127488
|
+
if (item.linewidth) outVarItem.LineWidth=item.linewidth;
|
|
127435
127489
|
if (item.isshow==false) outVarItem.IsShow = false;
|
|
127436
127490
|
if (item.isexdata==true) outVarItem.IsExData = true;
|
|
127437
127491
|
if (item.BreakPoint) outVarItem.BreakPoint=item.BreakPoint;
|
|
@@ -128446,9 +128500,9 @@ function GetBlackStyle()
|
|
|
128446
128500
|
|
|
128447
128501
|
PercentageText: //百分比坐标文字颜色
|
|
128448
128502
|
{
|
|
128449
|
-
PriceColor:'rgb(
|
|
128450
|
-
PercentageColor:"rgb(
|
|
128451
|
-
SplitColor:"rgb(
|
|
128503
|
+
PriceColor:'rgb(220,220,220)',
|
|
128504
|
+
PercentageColor:"rgb(220,220,220)",
|
|
128505
|
+
SplitColor:"rgb(220,220,220)",
|
|
128452
128506
|
Font:14*GetDevicePixelRatio() +"px 微软雅黑"
|
|
128453
128507
|
}
|
|
128454
128508
|
},
|
|
@@ -153146,7 +153200,7 @@ function HQChartScriptWorker()
|
|
|
153146
153200
|
|
|
153147
153201
|
|
|
153148
153202
|
|
|
153149
|
-
var HQCHART_VERSION="1.1.
|
|
153203
|
+
var HQCHART_VERSION="1.1.14415";
|
|
153150
153204
|
|
|
153151
153205
|
function PrintHQChartVersion()
|
|
153152
153206
|
{
|