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
|
@@ -9168,7 +9168,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
9168
9168
|
var item=this.ExtendChartPaint[i];
|
|
9169
9169
|
if (item.IsCallbackDraw)
|
|
9170
9170
|
{
|
|
9171
|
-
if (["KLineYAxisBGPaint","DepthMapPaint","BackgroundPaint","MinuteBackgroundPaint"].includes(item.ClassName))
|
|
9171
|
+
if (["KLineYAxisBGPaint","DepthMapPaint","BackgroundPaint","MinuteBackgroundPaint", "SessionBreaksPaint"].includes(item.ClassName))
|
|
9172
9172
|
{
|
|
9173
9173
|
if (item.FrameID==frame.Identify) item.Draw();
|
|
9174
9174
|
}
|
|
@@ -42877,7 +42877,8 @@ function ExtendChartPaintFactory()
|
|
|
42877
42877
|
[
|
|
42878
42878
|
["FrameSplitPaint", { Create:function() { return new FrameSplitPaint(); } }],
|
|
42879
42879
|
["RectSelectPaint", { Create:function() { return new RectSelectPaint(); } }],
|
|
42880
|
-
["DragMovePaint", { Create:function() { return new DragMovePaint(); } }]
|
|
42880
|
+
["DragMovePaint", { Create:function() { return new DragMovePaint(); } }],
|
|
42881
|
+
["SessionBreaksPaint", { Create:function() { return new SessionBreaksPaint(); }}]
|
|
42881
42882
|
]
|
|
42882
42883
|
);
|
|
42883
42884
|
|
|
@@ -47135,6 +47136,266 @@ function DragMovePaint()
|
|
|
47135
47136
|
}
|
|
47136
47137
|
|
|
47137
47138
|
|
|
47139
|
+
function SessionBreaksPaint()
|
|
47140
|
+
{
|
|
47141
|
+
this.newMethod=IExtendChartPainting; //派生
|
|
47142
|
+
this.newMethod();
|
|
47143
|
+
delete this.newMethod;
|
|
47144
|
+
|
|
47145
|
+
this.ClassName='SessionBreaksPaint';
|
|
47146
|
+
this.IsDynamic=false;
|
|
47147
|
+
this.IsCallbackDraw=true; //在回调函数里绘制, 不在Draw()中绘制
|
|
47148
|
+
this.FrameID=0;
|
|
47149
|
+
this.KDataFeature; //数据特征 { Symbol, Period, DataCount }
|
|
47150
|
+
this.Data;
|
|
47151
|
+
this.ChartFrame;
|
|
47152
|
+
|
|
47153
|
+
this.BGColor=g_JSChartResource.SessionBreaksPaint.BGColor.slice();
|
|
47154
|
+
this.SplitLine=
|
|
47155
|
+
{
|
|
47156
|
+
Color:g_JSChartResource.SessionBreaksPaint.SplitLine.Color,
|
|
47157
|
+
Width:g_JSChartResource.SessionBreaksPaint.SplitLine.Width,
|
|
47158
|
+
Dash:g_JSChartResource.SessionBreaksPaint.SplitLine.Dash
|
|
47159
|
+
};
|
|
47160
|
+
|
|
47161
|
+
this.MapPeriod=new Map(
|
|
47162
|
+
[
|
|
47163
|
+
[0, { SplitType:1 }], //日
|
|
47164
|
+
[1, { SplitType:1 }], //周
|
|
47165
|
+
[2, { SplitType:2 }], //月
|
|
47166
|
+
[21, { SplitType:2 }], //双周
|
|
47167
|
+
|
|
47168
|
+
[4, { SplitType:3 }], //1分钟
|
|
47169
|
+
[5, { SplitType:3 }], //5分钟
|
|
47170
|
+
[6, { SplitType:3 }], //15分钟
|
|
47171
|
+
[7, { SplitType:3 }],
|
|
47172
|
+
[8, { SplitType:3 }],
|
|
47173
|
+
]); //周期和分割对应关系
|
|
47174
|
+
|
|
47175
|
+
this.SetOption=function(option) //设置
|
|
47176
|
+
{
|
|
47177
|
+
if (option.FrameID>0) this.FrameID=option.FrameID;
|
|
47178
|
+
}
|
|
47179
|
+
|
|
47180
|
+
this.Draw=function()
|
|
47181
|
+
{
|
|
47182
|
+
if (!this.HQChart) return;
|
|
47183
|
+
var hisData=this.HQChart.ChartOperator_Temp_GetHistroyData();;
|
|
47184
|
+
if (!hisData) return; //数据还没有到达
|
|
47185
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(hisData.Data)) return;
|
|
47186
|
+
|
|
47187
|
+
if (this.IsKDataChange(hisData))
|
|
47188
|
+
{
|
|
47189
|
+
this.BuildCacheData(hisData);
|
|
47190
|
+
}
|
|
47191
|
+
|
|
47192
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.Data)) return;
|
|
47193
|
+
|
|
47194
|
+
var mainFrame=this.HQChart.Frame.SubFrame[0].Frame;
|
|
47195
|
+
var bHScreen=(this.ChartFrame.IsHScreen===true);
|
|
47196
|
+
var dataWidth=mainFrame.DataWidth;
|
|
47197
|
+
var distanceWidth=mainFrame.DistanceWidth;
|
|
47198
|
+
var xPointCount=mainFrame.XPointCount;
|
|
47199
|
+
|
|
47200
|
+
if (bHScreen)
|
|
47201
|
+
{
|
|
47202
|
+
var border=this.ChartBorder.GetHScreenBorder();
|
|
47203
|
+
var chartright=border.BottomEx;
|
|
47204
|
+
var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
47205
|
+
}
|
|
47206
|
+
else
|
|
47207
|
+
{
|
|
47208
|
+
var border=this.ChartBorder.GetBorder();
|
|
47209
|
+
var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
47210
|
+
var chartright=border.RightEx;
|
|
47211
|
+
}
|
|
47212
|
+
|
|
47213
|
+
var preID=null;
|
|
47214
|
+
var aryBG=[];
|
|
47215
|
+
var bgItem=null;
|
|
47216
|
+
for(var i=hisData.DataOffset,j=0;i<hisData.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
|
|
47217
|
+
{
|
|
47218
|
+
var item=this.Data[i];
|
|
47219
|
+
if (!item) continue;
|
|
47220
|
+
|
|
47221
|
+
var left=xOffset;
|
|
47222
|
+
var right=xOffset+dataWidth;
|
|
47223
|
+
if (right>chartright) break;
|
|
47224
|
+
var x=left+(right-left)/2;
|
|
47225
|
+
|
|
47226
|
+
var xStart=left-distanceWidth/2;
|
|
47227
|
+
var xEnd=right+distanceWidth/2;
|
|
47228
|
+
|
|
47229
|
+
var id=item.ID;
|
|
47230
|
+
if (!IFrameSplitOperator.IsNumber(id)) continue;
|
|
47231
|
+
|
|
47232
|
+
if (preID==null)
|
|
47233
|
+
{
|
|
47234
|
+
bgItem={ Start:{ X:xStart }, End:{ X:xEnd }, ColorIndex:id, Count:1, IsStart:false, IsEnd:false };
|
|
47235
|
+
preID=id;
|
|
47236
|
+
if (i-1>=0)
|
|
47237
|
+
{
|
|
47238
|
+
var preItem=this.Data[i-1];
|
|
47239
|
+
if (preItem && preItem.ID!=id) bgItem.IsStart=true;
|
|
47240
|
+
}
|
|
47241
|
+
}
|
|
47242
|
+
else if (preID!=id)
|
|
47243
|
+
{
|
|
47244
|
+
bgItem.End.X=xStart;
|
|
47245
|
+
bgItem.IsEnd=true;
|
|
47246
|
+
aryBG.push(bgItem);
|
|
47247
|
+
|
|
47248
|
+
bgItem={ Start:{ X:xStart }, End:{ X:xEnd }, ColorIndex:id, Count:1, IsStart:true, IsEnd:false };
|
|
47249
|
+
preID=id;
|
|
47250
|
+
}
|
|
47251
|
+
else
|
|
47252
|
+
{
|
|
47253
|
+
bgItem.End.X=xEnd;
|
|
47254
|
+
++bgItem.Count;
|
|
47255
|
+
}
|
|
47256
|
+
}
|
|
47257
|
+
|
|
47258
|
+
if (bgItem && bgItem.Count>=2) aryBG.push(bgItem);
|
|
47259
|
+
|
|
47260
|
+
this.Canvas.save();
|
|
47261
|
+
this.DrawBG(aryBG);
|
|
47262
|
+
this.Canvas.restore();
|
|
47263
|
+
}
|
|
47264
|
+
|
|
47265
|
+
this.DrawBG=function(aryBG)
|
|
47266
|
+
{
|
|
47267
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryBG)) return;
|
|
47268
|
+
|
|
47269
|
+
var bHScreen=(this.ChartFrame.IsHScreen===true);
|
|
47270
|
+
if (bHScreen)
|
|
47271
|
+
{
|
|
47272
|
+
var border=this.ChartBorder.GetHScreenBorder();
|
|
47273
|
+
var top=border.RightEx;
|
|
47274
|
+
var bottom=border.Left;
|
|
47275
|
+
var height=bottom-top;
|
|
47276
|
+
}
|
|
47277
|
+
else
|
|
47278
|
+
{
|
|
47279
|
+
var border=this.ChartBorder.GetBorder();
|
|
47280
|
+
var top=border.TopEx;
|
|
47281
|
+
var bottom=border.BottomEx;
|
|
47282
|
+
var height=bottom-top;
|
|
47283
|
+
}
|
|
47284
|
+
|
|
47285
|
+
|
|
47286
|
+
var bDrawSplitLine=false;
|
|
47287
|
+
if (this.SplitLine.Color) bDrawSplitLine=true;
|
|
47288
|
+
var lineCount=0;
|
|
47289
|
+
for(var i=0;i<aryBG.length;++i)
|
|
47290
|
+
{
|
|
47291
|
+
var item=aryBG[i];
|
|
47292
|
+
var xLeft=item.Start.X;
|
|
47293
|
+
var xRight=item.End.X;
|
|
47294
|
+
|
|
47295
|
+
var index=item.ColorIndex%this.BGColor.length;
|
|
47296
|
+
var bgColor=this.BGColor[index];
|
|
47297
|
+
if (bgColor)
|
|
47298
|
+
{
|
|
47299
|
+
this.Canvas.fillStyle=bgColor;
|
|
47300
|
+
if (bHScreen)
|
|
47301
|
+
this.Canvas.fillRect(ToFixedPoint(top),ToFixedPoint(xLeft),ToFixedRect(height),ToFixedRect(xRight-xLeft));
|
|
47302
|
+
else
|
|
47303
|
+
this.Canvas.fillRect(ToFixedPoint(xLeft),ToFixedPoint(top),ToFixedRect(xRight-xLeft),ToFixedRect(height));
|
|
47304
|
+
}
|
|
47305
|
+
|
|
47306
|
+
if (bDrawSplitLine && item.IsStart)
|
|
47307
|
+
{
|
|
47308
|
+
if (lineCount==0) this.Canvas.beginPath();
|
|
47309
|
+
if (bHScreen)
|
|
47310
|
+
{
|
|
47311
|
+
this.Canvas.moveTo(top, ToFixedPoint(xLeft));
|
|
47312
|
+
this.Canvas.lineTo(bottom, ToFixedPoint(xLeft));
|
|
47313
|
+
}
|
|
47314
|
+
else
|
|
47315
|
+
{
|
|
47316
|
+
this.Canvas.moveTo(ToFixedPoint(xLeft), top);
|
|
47317
|
+
this.Canvas.lineTo(ToFixedPoint(xLeft), bottom);
|
|
47318
|
+
}
|
|
47319
|
+
|
|
47320
|
+
++lineCount;
|
|
47321
|
+
}
|
|
47322
|
+
}
|
|
47323
|
+
|
|
47324
|
+
if (bDrawSplitLine && lineCount>=1)
|
|
47325
|
+
{
|
|
47326
|
+
if (this.SplitLine.Width>=1) this.Canvas.linewidth=this.SplitLine.Width;
|
|
47327
|
+
if (this.SplitLine.Dash) this.Canvas.setLineDash(this.SplitLine.Dash);
|
|
47328
|
+
if (this.SplitLine.Color) this.Canvas.strokeStyle=this.SplitLine.Color;
|
|
47329
|
+
|
|
47330
|
+
this.Canvas.stroke();
|
|
47331
|
+
}
|
|
47332
|
+
}
|
|
47333
|
+
|
|
47334
|
+
this.IsKDataChange=function(hisData)
|
|
47335
|
+
{
|
|
47336
|
+
if (!this.KDataFeature) return true;
|
|
47337
|
+
|
|
47338
|
+
if (this.KDataFeature.Symbol!=this.HQChart.Symbol) return true;
|
|
47339
|
+
if (this.KDataFeature.Period!=this.HQChart.Period) return true;
|
|
47340
|
+
if (this.KDataFeature.DataCount!=hisData.Data.length) return true;
|
|
47341
|
+
|
|
47342
|
+
return false;
|
|
47343
|
+
}
|
|
47344
|
+
|
|
47345
|
+
this.BuildCacheData=function(hisData)
|
|
47346
|
+
{
|
|
47347
|
+
var period=this.HQChart.Period;
|
|
47348
|
+
if (!this.MapPeriod.has(period))
|
|
47349
|
+
{
|
|
47350
|
+
this.Data=[];
|
|
47351
|
+
this.KDataFeature={ Symbol:this.HQChart.Symbol, Period:period, DataCount:hisData.Data.length };
|
|
47352
|
+
return;
|
|
47353
|
+
}
|
|
47354
|
+
|
|
47355
|
+
var splitType=this.MapPeriod.get(period).SplitType; //1=month 2=year 3=day 4=1hour
|
|
47356
|
+
|
|
47357
|
+
var startDate=0;
|
|
47358
|
+
var index=-1;
|
|
47359
|
+
this.Data=[];
|
|
47360
|
+
for(var i=0;i<hisData.Data.length;++i)
|
|
47361
|
+
{
|
|
47362
|
+
var item=hisData.Data[i];
|
|
47363
|
+
switch(splitType)
|
|
47364
|
+
{
|
|
47365
|
+
case 1: //月
|
|
47366
|
+
if (parseInt(item.Date/100)!=parseInt(startDate/100))
|
|
47367
|
+
{
|
|
47368
|
+
startDate=item.Date;
|
|
47369
|
+
++index;
|
|
47370
|
+
}
|
|
47371
|
+
this.Data.push({ ID:index, Date:item.Date });
|
|
47372
|
+
break;
|
|
47373
|
+
case 2: //年
|
|
47374
|
+
if (parseInt(item.Date/10000)!=parseInt(startDate/10000))
|
|
47375
|
+
{
|
|
47376
|
+
startDate=item.Date;
|
|
47377
|
+
++index;
|
|
47378
|
+
}
|
|
47379
|
+
this.Data.push({ ID:index, Date:item.Date });
|
|
47380
|
+
break;
|
|
47381
|
+
case 3: //日
|
|
47382
|
+
if (item.Date!=startDate)
|
|
47383
|
+
{
|
|
47384
|
+
startDate=item.Date;
|
|
47385
|
+
++index;
|
|
47386
|
+
}
|
|
47387
|
+
this.Data.push({ ID:index, Date:item.Date });
|
|
47388
|
+
break;
|
|
47389
|
+
}
|
|
47390
|
+
|
|
47391
|
+
}
|
|
47392
|
+
|
|
47393
|
+
|
|
47394
|
+
this.KDataFeature={ Symbol:this.HQChart.Symbol, Period:period, DataCount:hisData.Data.length };
|
|
47395
|
+
}
|
|
47396
|
+
}
|
|
47397
|
+
|
|
47398
|
+
|
|
47138
47399
|
|
|
47139
47400
|
//弹幕数据 { X:X偏移, Y:Y偏移, Text:内容, Color:颜色 }
|
|
47140
47401
|
function BarrageList()
|
|
@@ -67380,6 +67641,12 @@ function JSChartResource()
|
|
|
67380
67641
|
Font:14*GetDevicePixelRatio() +"px 微软雅黑"
|
|
67381
67642
|
}
|
|
67382
67643
|
|
|
67644
|
+
this.SessionBreaksPaint=
|
|
67645
|
+
{
|
|
67646
|
+
BGColor:[null, "rgb(245,246,246)"],
|
|
67647
|
+
SplitLine:{ Color:'rgb(73,133,231)', Width:1*GetDevicePixelRatio(), Dash:[5*GetDevicePixelRatio(),5*GetDevicePixelRatio()] }
|
|
67648
|
+
}
|
|
67649
|
+
|
|
67383
67650
|
|
|
67384
67651
|
//成交明细
|
|
67385
67652
|
this.DealList=
|
|
@@ -68324,6 +68591,19 @@ function JSChartResource()
|
|
|
68324
68591
|
if (item.Font) this.DragMovePaint.Font=item.Font;
|
|
68325
68592
|
}
|
|
68326
68593
|
|
|
68594
|
+
if (style.SessionBreaksPaint)
|
|
68595
|
+
{
|
|
68596
|
+
var item=style.SessionBreaksPaint;
|
|
68597
|
+
if (IFrameSplitOperator.IsNonEmptyArray(item.BGColor)) this.SessionBreaksPaint.BGColor=item.BGColor.slice();
|
|
68598
|
+
if (item.SplitLine)
|
|
68599
|
+
{
|
|
68600
|
+
var subItem=item.SplitLine;
|
|
68601
|
+
if (subItem.Color) this.SessionBreaksPaint.SplitLine.Color=subItem.Color;
|
|
68602
|
+
if (IFrameSplitOperator.IsNumber(subItem.Width)) this.SessionBreaksPaint.SplitLine.Width=subItem.Width;
|
|
68603
|
+
this.SessionBreaksPaint.SplitLine.Dash=subItem.Dash;
|
|
68604
|
+
}
|
|
68605
|
+
}
|
|
68606
|
+
|
|
68327
68607
|
if (IFrameSplitOperator.IsNumber(style.ToolbarButtonStyle)) this.ToolbarButtonStyle=style.ToolbarButtonStyle;
|
|
68328
68608
|
|
|
68329
68609
|
if (style.Buttons)
|
|
@@ -88710,6 +88990,39 @@ function KLineRightMenu(divElement)
|
|
|
88710
88990
|
return data;
|
|
88711
88991
|
}
|
|
88712
88992
|
|
|
88993
|
+
this.GetBGSplit=function(chart)
|
|
88994
|
+
{
|
|
88995
|
+
var data=
|
|
88996
|
+
[
|
|
88997
|
+
{
|
|
88998
|
+
text: "启用",
|
|
88999
|
+
click: function ()
|
|
89000
|
+
{
|
|
89001
|
+
chart.CreateExtendChart("SessionBreaksPaint", { });
|
|
89002
|
+
chart.Draw();
|
|
89003
|
+
}
|
|
89004
|
+
},
|
|
89005
|
+
{
|
|
89006
|
+
text: "关闭",
|
|
89007
|
+
click: function ()
|
|
89008
|
+
{
|
|
89009
|
+
var finder=chart.GetExtendChartByClassName("SessionBreaksPaint");
|
|
89010
|
+
if (finder)
|
|
89011
|
+
{
|
|
89012
|
+
chart.DeleteExtendChartByID(finder.Chart.ID);
|
|
89013
|
+
chart.Draw();
|
|
89014
|
+
}
|
|
89015
|
+
}
|
|
89016
|
+
},
|
|
89017
|
+
];
|
|
89018
|
+
|
|
89019
|
+
var finder=chart.GetExtendChartByClassName("SessionBreaksPaint");
|
|
89020
|
+
if (finder) data[0].selected=true;
|
|
89021
|
+
else data[1].selected=true;
|
|
89022
|
+
|
|
89023
|
+
return data;
|
|
89024
|
+
}
|
|
89025
|
+
|
|
88713
89026
|
|
|
88714
89027
|
this.GetKLineInfo=function(chart)
|
|
88715
89028
|
{
|
|
@@ -88816,6 +89129,10 @@ function KLineRightMenu(divElement)
|
|
|
88816
89129
|
{
|
|
88817
89130
|
text:"工具",
|
|
88818
89131
|
children:this.GetTools(chart)
|
|
89132
|
+
},
|
|
89133
|
+
{
|
|
89134
|
+
text:"背景分割",
|
|
89135
|
+
children:this.GetBGSplit(chart)
|
|
88819
89136
|
}
|
|
88820
89137
|
];
|
|
88821
89138
|
|
|
@@ -119892,6 +120209,12 @@ function GetBlackStyle()
|
|
|
119892
120209
|
TextColor:"rgb(255,255,255)",
|
|
119893
120210
|
//Font:14*GetDevicePixelRatio() +"px 微软雅黑"
|
|
119894
120211
|
},
|
|
120212
|
+
|
|
120213
|
+
SessionBreaksPaint:
|
|
120214
|
+
{
|
|
120215
|
+
BGColor:[null, "rgb(42,46,57)"],
|
|
120216
|
+
SplitLine:{ Color:'rgb(73,133,231)', Width:1*GetDevicePixelRatio(), Dash:[5*GetDevicePixelRatio(),5*GetDevicePixelRatio()] }
|
|
120217
|
+
},
|
|
119895
120218
|
|
|
119896
120219
|
//成交明细
|
|
119897
120220
|
DealList:
|
|
@@ -130350,7 +130673,7 @@ function ScrollBarBGChart()
|
|
|
130350
130673
|
|
|
130351
130674
|
|
|
130352
130675
|
|
|
130353
|
-
var HQCHART_VERSION="1.1.
|
|
130676
|
+
var HQCHART_VERSION="1.1.13064";
|
|
130354
130677
|
|
|
130355
130678
|
function PrintHQChartVersion()
|
|
130356
130679
|
{
|