hqchart 1.1.13062 → 1.1.13065
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 +25 -8
- package/package.json +1 -1
- package/src/jscommon/umychart.js +319 -2
- package/src/jscommon/umychart.style.js +6 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +326 -3
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +326 -3
|
@@ -9212,7 +9212,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
9212
9212
|
var item=this.ExtendChartPaint[i];
|
|
9213
9213
|
if (item.IsCallbackDraw)
|
|
9214
9214
|
{
|
|
9215
|
-
if (["KLineYAxisBGPaint","DepthMapPaint","BackgroundPaint","MinuteBackgroundPaint"].includes(item.ClassName))
|
|
9215
|
+
if (["KLineYAxisBGPaint","DepthMapPaint","BackgroundPaint","MinuteBackgroundPaint", "SessionBreaksPaint"].includes(item.ClassName))
|
|
9216
9216
|
{
|
|
9217
9217
|
if (item.FrameID==frame.Identify) item.Draw();
|
|
9218
9218
|
}
|
|
@@ -42921,7 +42921,8 @@ function ExtendChartPaintFactory()
|
|
|
42921
42921
|
[
|
|
42922
42922
|
["FrameSplitPaint", { Create:function() { return new FrameSplitPaint(); } }],
|
|
42923
42923
|
["RectSelectPaint", { Create:function() { return new RectSelectPaint(); } }],
|
|
42924
|
-
["DragMovePaint", { Create:function() { return new DragMovePaint(); } }]
|
|
42924
|
+
["DragMovePaint", { Create:function() { return new DragMovePaint(); } }],
|
|
42925
|
+
["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}]
|
|
42925
42926
|
]
|
|
42926
42927
|
);
|
|
42927
42928
|
|
|
@@ -47179,6 +47180,266 @@ function DragMovePaint()
|
|
|
47179
47180
|
}
|
|
47180
47181
|
|
|
47181
47182
|
|
|
47183
|
+
function SessionBreaksPaint()
|
|
47184
|
+
{
|
|
47185
|
+
this.newMethod=IExtendChartPainting; //派生
|
|
47186
|
+
this.newMethod();
|
|
47187
|
+
delete this.newMethod;
|
|
47188
|
+
|
|
47189
|
+
this.ClassName='SessionBreaksPaint';
|
|
47190
|
+
this.IsDynamic=false;
|
|
47191
|
+
this.IsCallbackDraw=true; //在回调函数里绘制, 不在Draw()中绘制
|
|
47192
|
+
this.FrameID=0;
|
|
47193
|
+
this.KDataFeature; //数据特征 { Symbol, Period, DataCount }
|
|
47194
|
+
this.Data;
|
|
47195
|
+
this.ChartFrame;
|
|
47196
|
+
|
|
47197
|
+
this.BGColor=g_JSChartResource.SessionBreaksPaint.BGColor.slice();
|
|
47198
|
+
this.SplitLine=
|
|
47199
|
+
{
|
|
47200
|
+
Color:g_JSChartResource.SessionBreaksPaint.SplitLine.Color,
|
|
47201
|
+
Width:g_JSChartResource.SessionBreaksPaint.SplitLine.Width,
|
|
47202
|
+
Dash:g_JSChartResource.SessionBreaksPaint.SplitLine.Dash
|
|
47203
|
+
};
|
|
47204
|
+
|
|
47205
|
+
this.MapPeriod=new Map(
|
|
47206
|
+
[
|
|
47207
|
+
[0, { SplitType:1 }], //日
|
|
47208
|
+
[1, { SplitType:1 }], //周
|
|
47209
|
+
[2, { SplitType:2 }], //月
|
|
47210
|
+
[21, { SplitType:2 }], //双周
|
|
47211
|
+
|
|
47212
|
+
[4, { SplitType:3 }], //1分钟
|
|
47213
|
+
[5, { SplitType:3 }], //5分钟
|
|
47214
|
+
[6, { SplitType:3 }], //15分钟
|
|
47215
|
+
[7, { SplitType:3 }],
|
|
47216
|
+
[8, { SplitType:3 }],
|
|
47217
|
+
]); //周期和分割对应关系
|
|
47218
|
+
|
|
47219
|
+
this.SetOption=function(option) //设置
|
|
47220
|
+
{
|
|
47221
|
+
if (option.FrameID>0) this.FrameID=option.FrameID;
|
|
47222
|
+
}
|
|
47223
|
+
|
|
47224
|
+
this.Draw=function()
|
|
47225
|
+
{
|
|
47226
|
+
if (!this.HQChart) return;
|
|
47227
|
+
var hisData=this.HQChart.ChartOperator_Temp_GetHistroyData();;
|
|
47228
|
+
if (!hisData) return; //数据还没有到达
|
|
47229
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(hisData.Data)) return;
|
|
47230
|
+
|
|
47231
|
+
if (this.IsKDataChange(hisData))
|
|
47232
|
+
{
|
|
47233
|
+
this.BuildCacheData(hisData);
|
|
47234
|
+
}
|
|
47235
|
+
|
|
47236
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.Data)) return;
|
|
47237
|
+
|
|
47238
|
+
var mainFrame=this.HQChart.Frame.SubFrame[0].Frame;
|
|
47239
|
+
var bHScreen=(this.ChartFrame.IsHScreen===true);
|
|
47240
|
+
var dataWidth=mainFrame.DataWidth;
|
|
47241
|
+
var distanceWidth=mainFrame.DistanceWidth;
|
|
47242
|
+
var xPointCount=mainFrame.XPointCount;
|
|
47243
|
+
|
|
47244
|
+
if (bHScreen)
|
|
47245
|
+
{
|
|
47246
|
+
var border=this.ChartBorder.GetHScreenBorder();
|
|
47247
|
+
var chartright=border.BottomEx;
|
|
47248
|
+
var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
47249
|
+
}
|
|
47250
|
+
else
|
|
47251
|
+
{
|
|
47252
|
+
var border=this.ChartBorder.GetBorder();
|
|
47253
|
+
var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
47254
|
+
var chartright=border.RightEx;
|
|
47255
|
+
}
|
|
47256
|
+
|
|
47257
|
+
var preID=null;
|
|
47258
|
+
var aryBG=[];
|
|
47259
|
+
var bgItem=null;
|
|
47260
|
+
for(var i=hisData.DataOffset,j=0;i<hisData.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
|
|
47261
|
+
{
|
|
47262
|
+
var item=this.Data[i];
|
|
47263
|
+
if (!item) continue;
|
|
47264
|
+
|
|
47265
|
+
var left=xOffset;
|
|
47266
|
+
var right=xOffset+dataWidth;
|
|
47267
|
+
if (right>chartright) break;
|
|
47268
|
+
var x=left+(right-left)/2;
|
|
47269
|
+
|
|
47270
|
+
var xStart=left-distanceWidth/2;
|
|
47271
|
+
var xEnd=right+distanceWidth/2;
|
|
47272
|
+
|
|
47273
|
+
var id=item.ID;
|
|
47274
|
+
if (!IFrameSplitOperator.IsNumber(id)) continue;
|
|
47275
|
+
|
|
47276
|
+
if (preID==null)
|
|
47277
|
+
{
|
|
47278
|
+
bgItem={ Start:{ X:xStart }, End:{ X:xEnd }, ColorIndex:id, Count:1, IsStart:false, IsEnd:false };
|
|
47279
|
+
preID=id;
|
|
47280
|
+
if (i-1>=0)
|
|
47281
|
+
{
|
|
47282
|
+
var preItem=this.Data[i-1];
|
|
47283
|
+
if (preItem && preItem.ID!=id) bgItem.IsStart=true;
|
|
47284
|
+
}
|
|
47285
|
+
}
|
|
47286
|
+
else if (preID!=id)
|
|
47287
|
+
{
|
|
47288
|
+
bgItem.End.X=xStart;
|
|
47289
|
+
bgItem.IsEnd=true;
|
|
47290
|
+
aryBG.push(bgItem);
|
|
47291
|
+
|
|
47292
|
+
bgItem={ Start:{ X:xStart }, End:{ X:xEnd }, ColorIndex:id, Count:1, IsStart:true, IsEnd:false };
|
|
47293
|
+
preID=id;
|
|
47294
|
+
}
|
|
47295
|
+
else
|
|
47296
|
+
{
|
|
47297
|
+
bgItem.End.X=xEnd;
|
|
47298
|
+
++bgItem.Count;
|
|
47299
|
+
}
|
|
47300
|
+
}
|
|
47301
|
+
|
|
47302
|
+
if (bgItem && bgItem.Count>=2) aryBG.push(bgItem);
|
|
47303
|
+
|
|
47304
|
+
this.Canvas.save();
|
|
47305
|
+
this.DrawBG(aryBG);
|
|
47306
|
+
this.Canvas.restore();
|
|
47307
|
+
}
|
|
47308
|
+
|
|
47309
|
+
this.DrawBG=function(aryBG)
|
|
47310
|
+
{
|
|
47311
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryBG)) return;
|
|
47312
|
+
|
|
47313
|
+
var bHScreen=(this.ChartFrame.IsHScreen===true);
|
|
47314
|
+
if (bHScreen)
|
|
47315
|
+
{
|
|
47316
|
+
var border=this.ChartBorder.GetHScreenBorder();
|
|
47317
|
+
var top=border.RightEx;
|
|
47318
|
+
var bottom=border.Left;
|
|
47319
|
+
var height=bottom-top;
|
|
47320
|
+
}
|
|
47321
|
+
else
|
|
47322
|
+
{
|
|
47323
|
+
var border=this.ChartBorder.GetBorder();
|
|
47324
|
+
var top=border.TopEx;
|
|
47325
|
+
var bottom=border.BottomEx;
|
|
47326
|
+
var height=bottom-top;
|
|
47327
|
+
}
|
|
47328
|
+
|
|
47329
|
+
|
|
47330
|
+
var bDrawSplitLine=false;
|
|
47331
|
+
if (this.SplitLine.Color) bDrawSplitLine=true;
|
|
47332
|
+
var lineCount=0;
|
|
47333
|
+
for(var i=0;i<aryBG.length;++i)
|
|
47334
|
+
{
|
|
47335
|
+
var item=aryBG[i];
|
|
47336
|
+
var xLeft=item.Start.X;
|
|
47337
|
+
var xRight=item.End.X;
|
|
47338
|
+
|
|
47339
|
+
var index=item.ColorIndex%this.BGColor.length;
|
|
47340
|
+
var bgColor=this.BGColor[index];
|
|
47341
|
+
if (bgColor)
|
|
47342
|
+
{
|
|
47343
|
+
this.Canvas.fillStyle=bgColor;
|
|
47344
|
+
if (bHScreen)
|
|
47345
|
+
this.Canvas.fillRect(ToFixedPoint(top),ToFixedPoint(xLeft),ToFixedRect(height),ToFixedRect(xRight-xLeft));
|
|
47346
|
+
else
|
|
47347
|
+
this.Canvas.fillRect(ToFixedPoint(xLeft),ToFixedPoint(top),ToFixedRect(xRight-xLeft),ToFixedRect(height));
|
|
47348
|
+
}
|
|
47349
|
+
|
|
47350
|
+
if (bDrawSplitLine && item.IsStart)
|
|
47351
|
+
{
|
|
47352
|
+
if (lineCount==0) this.Canvas.beginPath();
|
|
47353
|
+
if (bHScreen)
|
|
47354
|
+
{
|
|
47355
|
+
this.Canvas.moveTo(top, ToFixedPoint(xLeft));
|
|
47356
|
+
this.Canvas.lineTo(bottom, ToFixedPoint(xLeft));
|
|
47357
|
+
}
|
|
47358
|
+
else
|
|
47359
|
+
{
|
|
47360
|
+
this.Canvas.moveTo(ToFixedPoint(xLeft), top);
|
|
47361
|
+
this.Canvas.lineTo(ToFixedPoint(xLeft), bottom);
|
|
47362
|
+
}
|
|
47363
|
+
|
|
47364
|
+
++lineCount;
|
|
47365
|
+
}
|
|
47366
|
+
}
|
|
47367
|
+
|
|
47368
|
+
if (bDrawSplitLine && lineCount>=1)
|
|
47369
|
+
{
|
|
47370
|
+
if (this.SplitLine.Width>=1) this.Canvas.linewidth=this.SplitLine.Width;
|
|
47371
|
+
if (this.SplitLine.Dash) this.Canvas.setLineDash(this.SplitLine.Dash);
|
|
47372
|
+
if (this.SplitLine.Color) this.Canvas.strokeStyle=this.SplitLine.Color;
|
|
47373
|
+
|
|
47374
|
+
this.Canvas.stroke();
|
|
47375
|
+
}
|
|
47376
|
+
}
|
|
47377
|
+
|
|
47378
|
+
this.IsKDataChange=function(hisData)
|
|
47379
|
+
{
|
|
47380
|
+
if (!this.KDataFeature) return true;
|
|
47381
|
+
|
|
47382
|
+
if (this.KDataFeature.Symbol!=this.HQChart.Symbol) return true;
|
|
47383
|
+
if (this.KDataFeature.Period!=this.HQChart.Period) return true;
|
|
47384
|
+
if (this.KDataFeature.DataCount!=hisData.Data.length) return true;
|
|
47385
|
+
|
|
47386
|
+
return false;
|
|
47387
|
+
}
|
|
47388
|
+
|
|
47389
|
+
this.BuildCacheData=function(hisData)
|
|
47390
|
+
{
|
|
47391
|
+
var period=this.HQChart.Period;
|
|
47392
|
+
if (!this.MapPeriod.has(period))
|
|
47393
|
+
{
|
|
47394
|
+
this.Data=[];
|
|
47395
|
+
this.KDataFeature={ Symbol:this.HQChart.Symbol, Period:period, DataCount:hisData.Data.length };
|
|
47396
|
+
return;
|
|
47397
|
+
}
|
|
47398
|
+
|
|
47399
|
+
var splitType=this.MapPeriod.get(period).SplitType; //1=month 2=year 3=day 4=1hour
|
|
47400
|
+
|
|
47401
|
+
var startDate=0;
|
|
47402
|
+
var index=-1;
|
|
47403
|
+
this.Data=[];
|
|
47404
|
+
for(var i=0;i<hisData.Data.length;++i)
|
|
47405
|
+
{
|
|
47406
|
+
var item=hisData.Data[i];
|
|
47407
|
+
switch(splitType)
|
|
47408
|
+
{
|
|
47409
|
+
case 1: //月
|
|
47410
|
+
if (parseInt(item.Date/100)!=parseInt(startDate/100))
|
|
47411
|
+
{
|
|
47412
|
+
startDate=item.Date;
|
|
47413
|
+
++index;
|
|
47414
|
+
}
|
|
47415
|
+
this.Data.push({ ID:index, Date:item.Date });
|
|
47416
|
+
break;
|
|
47417
|
+
case 2: //年
|
|
47418
|
+
if (parseInt(item.Date/10000)!=parseInt(startDate/10000))
|
|
47419
|
+
{
|
|
47420
|
+
startDate=item.Date;
|
|
47421
|
+
++index;
|
|
47422
|
+
}
|
|
47423
|
+
this.Data.push({ ID:index, Date:item.Date });
|
|
47424
|
+
break;
|
|
47425
|
+
case 3: //日
|
|
47426
|
+
if (item.Date!=startDate)
|
|
47427
|
+
{
|
|
47428
|
+
startDate=item.Date;
|
|
47429
|
+
++index;
|
|
47430
|
+
}
|
|
47431
|
+
this.Data.push({ ID:index, Date:item.Date });
|
|
47432
|
+
break;
|
|
47433
|
+
}
|
|
47434
|
+
|
|
47435
|
+
}
|
|
47436
|
+
|
|
47437
|
+
|
|
47438
|
+
this.KDataFeature={ Symbol:this.HQChart.Symbol, Period:period, DataCount:hisData.Data.length };
|
|
47439
|
+
}
|
|
47440
|
+
}
|
|
47441
|
+
|
|
47442
|
+
|
|
47182
47443
|
|
|
47183
47444
|
//弹幕数据 { X:X偏移, Y:Y偏移, Text:内容, Color:颜色 }
|
|
47184
47445
|
function BarrageList()
|
|
@@ -67424,6 +67685,12 @@ function JSChartResource()
|
|
|
67424
67685
|
Font:14*GetDevicePixelRatio() +"px 微软雅黑"
|
|
67425
67686
|
}
|
|
67426
67687
|
|
|
67688
|
+
this.SessionBreaksPaint=
|
|
67689
|
+
{
|
|
67690
|
+
BGColor:[null, "rgb(245,246,246)"],
|
|
67691
|
+
SplitLine:{ Color:'rgb(73,133,231)', Width:1*GetDevicePixelRatio(), Dash:[5*GetDevicePixelRatio(),5*GetDevicePixelRatio()] }
|
|
67692
|
+
}
|
|
67693
|
+
|
|
67427
67694
|
|
|
67428
67695
|
//成交明细
|
|
67429
67696
|
this.DealList=
|
|
@@ -68368,6 +68635,19 @@ function JSChartResource()
|
|
|
68368
68635
|
if (item.Font) this.DragMovePaint.Font=item.Font;
|
|
68369
68636
|
}
|
|
68370
68637
|
|
|
68638
|
+
if (style.SessionBreaksPaint)
|
|
68639
|
+
{
|
|
68640
|
+
var item=style.SessionBreaksPaint;
|
|
68641
|
+
if (IFrameSplitOperator.IsNonEmptyArray(item.BGColor)) this.SessionBreaksPaint.BGColor=item.BGColor.slice();
|
|
68642
|
+
if (item.SplitLine)
|
|
68643
|
+
{
|
|
68644
|
+
var subItem=item.SplitLine;
|
|
68645
|
+
if (subItem.Color) this.SessionBreaksPaint.SplitLine.Color=subItem.Color;
|
|
68646
|
+
if (IFrameSplitOperator.IsNumber(subItem.Width)) this.SessionBreaksPaint.SplitLine.Width=subItem.Width;
|
|
68647
|
+
this.SessionBreaksPaint.SplitLine.Dash=subItem.Dash;
|
|
68648
|
+
}
|
|
68649
|
+
}
|
|
68650
|
+
|
|
68371
68651
|
if (IFrameSplitOperator.IsNumber(style.ToolbarButtonStyle)) this.ToolbarButtonStyle=style.ToolbarButtonStyle;
|
|
68372
68652
|
|
|
68373
68653
|
if (style.Buttons)
|
|
@@ -88754,6 +89034,39 @@ function KLineRightMenu(divElement)
|
|
|
88754
89034
|
return data;
|
|
88755
89035
|
}
|
|
88756
89036
|
|
|
89037
|
+
this.GetBGSplit=function(chart)
|
|
89038
|
+
{
|
|
89039
|
+
var data=
|
|
89040
|
+
[
|
|
89041
|
+
{
|
|
89042
|
+
text: "启用",
|
|
89043
|
+
click: function ()
|
|
89044
|
+
{
|
|
89045
|
+
chart.CreateExtendChart("SessionBreaksPaint", { });
|
|
89046
|
+
chart.Draw();
|
|
89047
|
+
}
|
|
89048
|
+
},
|
|
89049
|
+
{
|
|
89050
|
+
text: "关闭",
|
|
89051
|
+
click: function ()
|
|
89052
|
+
{
|
|
89053
|
+
var finder=chart.GetExtendChartByClassName("SessionBreaksPaint");
|
|
89054
|
+
if (finder)
|
|
89055
|
+
{
|
|
89056
|
+
chart.DeleteExtendChartByID(finder.Chart.ID);
|
|
89057
|
+
chart.Draw();
|
|
89058
|
+
}
|
|
89059
|
+
}
|
|
89060
|
+
},
|
|
89061
|
+
];
|
|
89062
|
+
|
|
89063
|
+
var finder=chart.GetExtendChartByClassName("SessionBreaksPaint");
|
|
89064
|
+
if (finder) data[0].selected=true;
|
|
89065
|
+
else data[1].selected=true;
|
|
89066
|
+
|
|
89067
|
+
return data;
|
|
89068
|
+
}
|
|
89069
|
+
|
|
88757
89070
|
|
|
88758
89071
|
this.GetKLineInfo=function(chart)
|
|
88759
89072
|
{
|
|
@@ -88860,6 +89173,10 @@ function KLineRightMenu(divElement)
|
|
|
88860
89173
|
{
|
|
88861
89174
|
text:"工具",
|
|
88862
89175
|
children:this.GetTools(chart)
|
|
89176
|
+
},
|
|
89177
|
+
{
|
|
89178
|
+
text:"背景分割",
|
|
89179
|
+
children:this.GetBGSplit(chart)
|
|
88863
89180
|
}
|
|
88864
89181
|
];
|
|
88865
89182
|
|
|
@@ -119936,6 +120253,12 @@ function GetBlackStyle()
|
|
|
119936
120253
|
TextColor:"rgb(255,255,255)",
|
|
119937
120254
|
//Font:14*GetDevicePixelRatio() +"px 微软雅黑"
|
|
119938
120255
|
},
|
|
120256
|
+
|
|
120257
|
+
SessionBreaksPaint:
|
|
120258
|
+
{
|
|
120259
|
+
BGColor:[null, "rgb(42,46,57)"],
|
|
120260
|
+
SplitLine:{ Color:'rgb(73,133,231)', Width:1*GetDevicePixelRatio(), Dash:[5*GetDevicePixelRatio(),5*GetDevicePixelRatio()] }
|
|
120261
|
+
},
|
|
119939
120262
|
|
|
119940
120263
|
//成交明细
|
|
119941
120264
|
DealList:
|
|
@@ -130508,7 +130831,7 @@ function HQChartScriptWorker()
|
|
|
130508
130831
|
|
|
130509
130832
|
|
|
130510
130833
|
|
|
130511
|
-
var HQCHART_VERSION="1.1.
|
|
130834
|
+
var HQCHART_VERSION="1.1.13064";
|
|
130512
130835
|
|
|
130513
130836
|
function PrintHQChartVersion()
|
|
130514
130837
|
{
|