hqchart 1.1.14542 → 1.1.14555
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 +44 -29
- package/package.json +1 -1
- package/src/jscommon/umychart.PopMinuteChart.js +260 -5
- package/src/jscommon/umychart.js +179 -135
- package/src/jscommon/umychart.style.js +5 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +185 -136
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +445 -141
|
@@ -7394,6 +7394,51 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
7394
7394
|
this.DialogSearchIndex=null;
|
|
7395
7395
|
}
|
|
7396
7396
|
|
|
7397
|
+
this.DestroyDialogDrawTool=function()
|
|
7398
|
+
{
|
|
7399
|
+
if (!this.DialogDrawTool) return;
|
|
7400
|
+
|
|
7401
|
+
this.DialogDrawTool.Destroy();
|
|
7402
|
+
this.DialogDrawTool=null;
|
|
7403
|
+
}
|
|
7404
|
+
|
|
7405
|
+
this.DestroyDialogModifyIndexParam=function()
|
|
7406
|
+
{
|
|
7407
|
+
if (this.DialogModifyIndexParam) return;
|
|
7408
|
+
|
|
7409
|
+
this.DialogModifyIndexParam.Destroy();
|
|
7410
|
+
this.DialogModifyIndexParam=null;
|
|
7411
|
+
}
|
|
7412
|
+
|
|
7413
|
+
this.DestroyDialogSelectRect=function()
|
|
7414
|
+
{
|
|
7415
|
+
if (!this.DialogSelectRect) return;
|
|
7416
|
+
|
|
7417
|
+
this.DialogSelectRect.Destroy();
|
|
7418
|
+
this.DialogSelectRect=null;
|
|
7419
|
+
}
|
|
7420
|
+
|
|
7421
|
+
this.DestroyDialogModifyDraw=function()
|
|
7422
|
+
{
|
|
7423
|
+
if (!this.DialogModifyDraw) return;
|
|
7424
|
+
|
|
7425
|
+
this.DialogModifyDraw.Destroy();
|
|
7426
|
+
this.DialogModifyDraw=null;
|
|
7427
|
+
}
|
|
7428
|
+
|
|
7429
|
+
//隐藏内置的弹框div
|
|
7430
|
+
this.HideAllPopDiv=function()
|
|
7431
|
+
{
|
|
7432
|
+
this.HideFloatTooltip();
|
|
7433
|
+
this.CloseTooltipDialog();
|
|
7434
|
+
|
|
7435
|
+
if (this.DialogDrawTool) this.DialogDrawTool.Close();
|
|
7436
|
+
this.CloseModifyDrawDialog();
|
|
7437
|
+
|
|
7438
|
+
if (this.DialogSelectRect) this.DialogSelectRect.Close();
|
|
7439
|
+
if (this.DialogSearchIndex) this.DialogSearchIndex.Close();
|
|
7440
|
+
if (this.DialogModifyIndexParam) this.DialogModifyIndexParam.Close();
|
|
7441
|
+
}
|
|
7397
7442
|
|
|
7398
7443
|
|
|
7399
7444
|
//obj={ Element:, Canvas: }
|
|
@@ -7445,9 +7490,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
7445
7490
|
{
|
|
7446
7491
|
this.IsDestroy=true;
|
|
7447
7492
|
this.StopAutoUpdate();
|
|
7493
|
+
|
|
7448
7494
|
this.DestroyTooltipDialog();
|
|
7449
7495
|
this.DestroyFloatTooltip();
|
|
7496
|
+
|
|
7450
7497
|
this.DestroySearchIndexDialog();
|
|
7498
|
+
this.DestroyDialogModifyIndexParam();
|
|
7499
|
+
|
|
7500
|
+
this.DestroyDialogDrawTool();
|
|
7501
|
+
this.DestroyDialogModifyDraw();
|
|
7502
|
+
|
|
7503
|
+
this.DestroyDialogSelectRect();
|
|
7451
7504
|
}
|
|
7452
7505
|
|
|
7453
7506
|
this.ChartDestory=this.ChartDestroy; //老版本写错了,需要兼容下
|
|
@@ -10902,16 +10955,16 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
10902
10955
|
{
|
|
10903
10956
|
if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
|
|
10904
10957
|
|
|
10958
|
+
var keyID = e.keyCode ? e.keyCode :e.which;
|
|
10959
|
+
|
|
10905
10960
|
//回调事件
|
|
10906
10961
|
var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN);
|
|
10907
10962
|
if (event && event.Callback)
|
|
10908
10963
|
{
|
|
10909
|
-
var sendData={ e:e, PreventDefault:false };
|
|
10964
|
+
var sendData={ e:e, KeyID:keyID, PreventDefault:false };
|
|
10910
10965
|
event.Callback(event, sendData, this);
|
|
10911
10966
|
if (sendData.PreventDefault) return;
|
|
10912
10967
|
}
|
|
10913
|
-
|
|
10914
|
-
var keyID = e.keyCode ? e.keyCode :e.which;
|
|
10915
10968
|
|
|
10916
10969
|
var draw=false;
|
|
10917
10970
|
if (this.ChartCorssCursor && this.ChartCorssCursor.OnKeyDown) //十字光标 隐藏显示
|
|
@@ -39997,23 +40050,21 @@ function ChartStickLine()
|
|
|
39997
40050
|
delete this.newMethod;
|
|
39998
40051
|
|
|
39999
40052
|
this.ClassName='ChartStickLine'; //类名
|
|
40000
|
-
this.Color="rgb(255,193,37)";
|
|
40001
|
-
this.BarType=0;
|
|
40002
|
-
this.LineDotted=[3,3];
|
|
40003
|
-
this.Width=0;
|
|
40053
|
+
this.Color="rgb(255,193,37)"; //线段颜色
|
|
40054
|
+
this.BarType=0; //柱子类型 0=实心 1=空心 -1=画虚线空心柱
|
|
40055
|
+
this.LineDotted=[3,3]; //虚线设置
|
|
40056
|
+
this.Width=0; //柱子宽度 0=1 3,50=k线宽度 101=K线宽度+间距宽度
|
|
40057
|
+
this.IsHScreen=false;
|
|
40058
|
+
|
|
40059
|
+
this.BarCache={ Type:0 }; //Type:1=线段 2=柱子
|
|
40004
40060
|
|
|
40005
40061
|
this.SetEmptyBar=function() //设置空心柱子
|
|
40006
40062
|
{
|
|
40007
40063
|
if (this.BarType!=1 && this.BarType!=-1) return false;
|
|
40008
40064
|
|
|
40009
|
-
this.Canvas.lineWidth=GetDevicePixelRatio();
|
|
40010
|
-
this.Canvas.strokeStyle=this.Color;
|
|
40011
40065
|
var emptyBGColor=g_JSChartResource.EmptyBarBGColor;
|
|
40012
|
-
if (emptyBGColor) this.
|
|
40013
|
-
if (this.BarType==-1)
|
|
40014
|
-
{
|
|
40015
|
-
this.Canvas.setLineDash(this.LineDotted); //虚线
|
|
40016
|
-
}
|
|
40066
|
+
if (emptyBGColor) this.BarCache.EmptyBGColor=emptyBGColor;
|
|
40067
|
+
if (this.BarType==-1) this.BarCache.LineDotted=this.LineDotted;
|
|
40017
40068
|
|
|
40018
40069
|
return true;
|
|
40019
40070
|
}
|
|
@@ -40023,13 +40074,6 @@ function ChartStickLine()
|
|
|
40023
40074
|
return (this.BarType==1 || this.BarType==-1);
|
|
40024
40075
|
}
|
|
40025
40076
|
|
|
40026
|
-
this.CalculateBarHeight=function(y,y2)
|
|
40027
|
-
{
|
|
40028
|
-
var barHeight=Math.abs(y-y2);
|
|
40029
|
-
if (barHeight<=0) barHeight=1;
|
|
40030
|
-
return barHeight;
|
|
40031
|
-
}
|
|
40032
|
-
|
|
40033
40077
|
this.Draw=function()
|
|
40034
40078
|
{
|
|
40035
40079
|
if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
@@ -40044,81 +40088,93 @@ function ChartStickLine()
|
|
|
40044
40088
|
|
|
40045
40089
|
if (!this.Data || !this.Data.Data) return;
|
|
40046
40090
|
|
|
40047
|
-
var
|
|
40091
|
+
var pixelRatio=GetDevicePixelRatio();
|
|
40092
|
+
this.BarCache={ Color:this.Color, EmptyBGColor:null, Width:1*pixelRatio, Type:0, LineDotted:null };
|
|
40093
|
+
|
|
40094
|
+
this.IsHScreen=(this.ChartFrame.IsHScreen===true);;
|
|
40048
40095
|
var dataWidth=this.ChartFrame.DataWidth;
|
|
40049
40096
|
var distanceWidth=this.ChartFrame.DistanceWidth;
|
|
40050
40097
|
var chartright=this.ChartBorder.GetRight();
|
|
40051
|
-
var zoomIndex=this.ChartFrame.ZoomIndex;
|
|
40052
|
-
if (isHScreen) chartright=this.ChartBorder.GetBottom();
|
|
40053
40098
|
var xPointCount=this.ChartFrame.XPointCount;
|
|
40054
40099
|
var xOffset=this.ChartBorder.GetLeft()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
40055
|
-
if (
|
|
40100
|
+
if (this.IsHScreen)
|
|
40101
|
+
{
|
|
40102
|
+
chartright=this.ChartBorder.GetBottom();
|
|
40103
|
+
xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
40104
|
+
}
|
|
40056
40105
|
|
|
40057
40106
|
var isMinute=this.IsMinuteFrame();
|
|
40058
40107
|
|
|
40059
|
-
this.Canvas.save();
|
|
40060
|
-
var bFillBar=false;
|
|
40061
|
-
var bFillKLine=false;
|
|
40062
|
-
var emptyBGColor=g_JSChartResource.EmptyBarBGColor;
|
|
40063
|
-
|
|
40064
40108
|
if (isMinute)
|
|
40065
40109
|
{
|
|
40066
|
-
if (this.Width>1) this.
|
|
40067
|
-
|
|
40068
|
-
this.Canvas.strokeStyle=this.Color;
|
|
40110
|
+
if (this.Width>1) this.BarCache.Width=2*pixelRatio;
|
|
40111
|
+
this.BarCache.Type=1;
|
|
40069
40112
|
}
|
|
40070
|
-
else if(this.Width
|
|
40113
|
+
else if(this.Width<=0) //宽度时0,使用宽度1
|
|
40071
40114
|
{
|
|
40115
|
+
this.BarCache.Type=1;
|
|
40072
40116
|
this.SetEmptyBar();
|
|
40073
|
-
this.Canvas.lineWidth=GetDevicePixelRatio();
|
|
40074
|
-
this.Canvas.strokeStyle=this.Color;
|
|
40075
40117
|
}
|
|
40076
40118
|
else if (this.Width==3 || this.Width==50) //3和50 K线宽度
|
|
40077
40119
|
{
|
|
40120
|
+
this.BarCache.Type=1;
|
|
40078
40121
|
if (dataWidth>=4)
|
|
40079
40122
|
{
|
|
40080
|
-
|
|
40123
|
+
this.BarCache.Type=2;
|
|
40124
|
+
this.BarCache.Width=dataWidth;
|
|
40081
40125
|
this.SetEmptyBar();
|
|
40082
|
-
if (!this.IsEmptyBar()) this.Canvas.fillStyle=this.Color;
|
|
40083
|
-
this.Canvas.strokeStyle=this.Color;
|
|
40084
40126
|
}
|
|
40085
|
-
else //太细了 画竖线
|
|
40086
|
-
{
|
|
40087
|
-
this.Canvas.lineWidth=GetDevicePixelRatio();
|
|
40088
|
-
this.Canvas.strokeStyle=this.Color;
|
|
40089
|
-
}
|
|
40090
40127
|
}
|
|
40091
|
-
else if (this.Width==101)
|
|
40128
|
+
else if (this.Width==101) //柱子+间距
|
|
40092
40129
|
{
|
|
40093
|
-
|
|
40094
|
-
|
|
40095
|
-
|
|
40130
|
+
this.BarCache.Type=1;
|
|
40131
|
+
var lineWidth=dataWidth+distanceWidth+1*pixelRatio;
|
|
40132
|
+
if (lineWidth>=4)
|
|
40133
|
+
{
|
|
40134
|
+
this.BarCache.Type=2;
|
|
40135
|
+
this.BarCache.Width=lineWidth
|
|
40136
|
+
this.SetEmptyBar();
|
|
40137
|
+
}
|
|
40096
40138
|
}
|
|
40097
40139
|
else if (this.Width<=3)
|
|
40098
40140
|
{
|
|
40099
|
-
var minWidth=2*
|
|
40141
|
+
var minWidth=2*pixelRatio;
|
|
40100
40142
|
var barWidth=dataWidth*(this.Width/3);
|
|
40101
40143
|
if (barWidth<minWidth) barWidth=minWidth;
|
|
40102
|
-
this.
|
|
40103
|
-
if (
|
|
40104
|
-
|
|
40144
|
+
this.BarCache.Type=1;
|
|
40145
|
+
if (barWidth>=4)
|
|
40146
|
+
{
|
|
40147
|
+
this.BarCache.Type=2;
|
|
40148
|
+
this.BarCache.Width=barWidth;
|
|
40149
|
+
this.SetEmptyBar();
|
|
40150
|
+
}
|
|
40105
40151
|
}
|
|
40106
40152
|
else
|
|
40107
40153
|
{
|
|
40108
|
-
var barWidth=this.Width*
|
|
40154
|
+
var barWidth=this.Width*pixelRatio+dataWidth;
|
|
40155
|
+
this.BarCache.Type=2;
|
|
40156
|
+
this.BarCache.Width=barWidth;
|
|
40109
40157
|
this.SetEmptyBar();
|
|
40110
|
-
if (!this.IsEmptyBar()) this.Canvas.fillStyle=this.Color;
|
|
40111
|
-
bFillBar=true;
|
|
40112
40158
|
}
|
|
40113
40159
|
|
|
40160
|
+
this.Canvas.save();
|
|
40161
|
+
this.ClipClient(this.IsHScreen);
|
|
40162
|
+
|
|
40163
|
+
this.Canvas.strokeStyle=this.BarCache.Color;
|
|
40164
|
+
if (this.BarCache.EmptyBGColor) this.Canvas.fillStyle=this.BarCache.EmptyBGColor; //空心柱子
|
|
40165
|
+
else this.Canvas.fillStyle=this.BarCache.Color;
|
|
40166
|
+
if (IFrameSplitOperator.IsNonEmptyArray(this.BarCache.LineDotted)) this.Canvas.setLineDash(this.BarCache.LineDotted); //虚线
|
|
40167
|
+
if (this.BarCache.Type==1) this.Canvas.lineWidth=this.BarCache.Width;
|
|
40168
|
+
|
|
40114
40169
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
|
|
40115
40170
|
{
|
|
40116
40171
|
var value=this.Data.Data[i];
|
|
40117
|
-
if (value
|
|
40172
|
+
if (!value) continue;
|
|
40173
|
+
if (!IFrameSplitOperator.IsNumber(value.Value)) continue;
|
|
40118
40174
|
|
|
40119
40175
|
var price=value.Value;
|
|
40120
|
-
var price2=
|
|
40121
|
-
if (
|
|
40176
|
+
var price2=0;
|
|
40177
|
+
if (IFrameSplitOperator.IsNumber(value.Value2)) price2=value.Value2;
|
|
40122
40178
|
|
|
40123
40179
|
if (isMinute)
|
|
40124
40180
|
{
|
|
@@ -40131,103 +40187,79 @@ function ChartStickLine()
|
|
|
40131
40187
|
var x=left+(right-left)/2;
|
|
40132
40188
|
}
|
|
40133
40189
|
|
|
40134
|
-
var y=this.ChartFrame.GetYFromData(price);
|
|
40135
|
-
var y2=this.ChartFrame.GetYFromData(price2);
|
|
40190
|
+
var y=this.ChartFrame.GetYFromData(price,false);
|
|
40191
|
+
var y2=this.ChartFrame.GetYFromData(price2,false);
|
|
40136
40192
|
|
|
40137
40193
|
if (x>chartright) break;
|
|
40138
40194
|
|
|
40139
|
-
|
|
40140
|
-
|
|
40141
|
-
|
|
40142
|
-
{
|
|
40143
|
-
var left=x-barWidth/2;
|
|
40144
|
-
var width=barWidth;
|
|
40145
|
-
if (this.IsEmptyBar()) //空心
|
|
40146
|
-
{
|
|
40147
|
-
this.Canvas.beginPath();
|
|
40148
|
-
this.Canvas.rect(ToFixedPoint(Math.min(y,y2)),ToFixedPoint(left),ToFixedRect(Math.abs(y-y2)),ToFixedRect(width));
|
|
40149
|
-
this.Canvas.stroke();
|
|
40150
|
-
}
|
|
40151
|
-
else
|
|
40152
|
-
{
|
|
40153
|
-
this.Canvas.fillRect(ToFixedRect(Math.min(y,y2)),ToFixedRect(left),ToFixedRect(Math.abs(y-y2)),ToFixedRect(width));
|
|
40154
|
-
}
|
|
40155
|
-
}
|
|
40156
|
-
else
|
|
40157
|
-
{
|
|
40158
|
-
var left=x-barWidth/2;
|
|
40159
|
-
var width=barWidth;
|
|
40160
|
-
if (left+width>chartright) width=chartright-left; //不要超过右边框子
|
|
40161
|
-
if (this.IsEmptyBar()) //空心
|
|
40162
|
-
{
|
|
40163
|
-
if (emptyBGColor)
|
|
40164
|
-
this.Canvas.fillRect(ToFixedRect(left),ToFixedRect(Math.min(y,y2)),ToFixedRect(width),ToFixedRect(Math.abs(y-y2)));
|
|
40195
|
+
var xCenter=x;
|
|
40196
|
+
var yTop=Math.min(y,y2);
|
|
40197
|
+
var barHeight=Math.abs(y-y2); //柱子高度
|
|
40165
40198
|
|
|
40166
|
-
|
|
40167
|
-
|
|
40168
|
-
|
|
40169
|
-
|
|
40170
|
-
|
|
40171
|
-
|
|
40172
|
-
|
|
40173
|
-
|
|
40174
|
-
|
|
40199
|
+
this.DrawBar(xCenter, yTop, barHeight);
|
|
40200
|
+
}
|
|
40201
|
+
|
|
40202
|
+
this.Canvas.restore();
|
|
40203
|
+
}
|
|
40204
|
+
|
|
40205
|
+
this.DrawBar=function(xCenter, ytop, barHeight)
|
|
40206
|
+
{
|
|
40207
|
+
if (barHeight<1) barHeight=1;
|
|
40208
|
+
|
|
40209
|
+
if (this.BarCache.Type==1) //线段
|
|
40210
|
+
{
|
|
40211
|
+
if (this.IsHScreen)
|
|
40212
|
+
{
|
|
40213
|
+
this.Canvas.beginPath();
|
|
40214
|
+
this.Canvas.moveTo(ytop,ToFixedPoint(xCenter));
|
|
40215
|
+
this.Canvas.lineTo(ytop+barHeight,ToFixedPoint(xCenter));
|
|
40216
|
+
this.Canvas.stroke();
|
|
40217
|
+
}
|
|
40218
|
+
else
|
|
40219
|
+
{
|
|
40220
|
+
this.Canvas.beginPath();
|
|
40221
|
+
this.Canvas.moveTo(ToFixedPoint(xCenter),ytop);
|
|
40222
|
+
this.Canvas.lineTo(ToFixedPoint(xCenter),ytop+barHeight);
|
|
40223
|
+
this.Canvas.stroke();
|
|
40175
40224
|
}
|
|
40176
|
-
|
|
40225
|
+
}
|
|
40226
|
+
else if (this.BarCache.Type==2) //柱子
|
|
40227
|
+
{
|
|
40228
|
+
if (this.IsHScreen)
|
|
40177
40229
|
{
|
|
40178
|
-
|
|
40230
|
+
var xLeft=xCenter-this.BarCache.Width/2;
|
|
40231
|
+
if (this.IsEmptyBar()) //空心
|
|
40179
40232
|
{
|
|
40180
|
-
if (
|
|
40181
|
-
|
|
40182
|
-
this.Canvas.beginPath();
|
|
40183
|
-
this.Canvas.rect(ToFixedPoint(Math.min(y,y2)),ToFixedPoint(xOffset),ToFixedRect(Math.abs(y-y2)),ToFixedRect(dataWidth));
|
|
40184
|
-
this.Canvas.stroke();
|
|
40185
|
-
}
|
|
40186
|
-
else
|
|
40187
|
-
{
|
|
40188
|
-
if (emptyBGColor)
|
|
40189
|
-
this.Canvas.fillRect(ToFixedRect(xOffset),ToFixedRect(Math.min(y,y2)),ToFixedRect(dataWidth),ToFixedRect(Math.abs(y-y2)));
|
|
40233
|
+
if (this.BarCache.EmptyBGColor) //背景色填充
|
|
40234
|
+
this.Canvas.fillRect(ToFixedRect(ytop),ToFixedRect(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
|
|
40190
40235
|
|
|
40191
|
-
|
|
40192
|
-
|
|
40193
|
-
|
|
40194
|
-
}
|
|
40236
|
+
this.Canvas.beginPath();
|
|
40237
|
+
this.Canvas.rect(ToFixedPoint(ytop),ToFixedPoint(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
|
|
40238
|
+
this.Canvas.stroke();
|
|
40195
40239
|
}
|
|
40196
40240
|
else
|
|
40197
40241
|
{
|
|
40198
|
-
|
|
40199
|
-
{
|
|
40200
|
-
this.Canvas.fillRect(ToFixedRect(Math.min(y,y2)),ToFixedRect(xOffset),ToFixedRect(Math.abs(y-y2)),ToFixedRect(dataWidth));
|
|
40201
|
-
}
|
|
40202
|
-
else
|
|
40203
|
-
{
|
|
40204
|
-
this.Canvas.fillRect(ToFixedRect(xOffset),ToFixedRect(Math.min(y,y2)),ToFixedRect(dataWidth),ToFixedRect(this.CalculateBarHeight(y,y2)));
|
|
40205
|
-
}
|
|
40206
|
-
|
|
40242
|
+
this.Canvas.fillRect(ToFixedRect(ytop),ToFixedRect(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
|
|
40207
40243
|
}
|
|
40208
40244
|
}
|
|
40209
40245
|
else
|
|
40210
40246
|
{
|
|
40211
|
-
|
|
40247
|
+
var xLeft=xCenter-this.BarCache.Width/2;
|
|
40248
|
+
if (this.IsEmptyBar()) //空心
|
|
40212
40249
|
{
|
|
40250
|
+
if (this.BarCache.EmptyBGColor) //背景色填充
|
|
40251
|
+
this.Canvas.fillRect(ToFixedRect(xLeft),ToFixedRect(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
|
|
40252
|
+
|
|
40213
40253
|
this.Canvas.beginPath();
|
|
40214
|
-
this.Canvas.
|
|
40215
|
-
this.Canvas.lineTo(y2,ToFixedPoint(x));
|
|
40254
|
+
this.Canvas.rect(ToFixedPoint(xLeft),ToFixedPoint(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
|
|
40216
40255
|
this.Canvas.stroke();
|
|
40217
40256
|
}
|
|
40218
40257
|
else
|
|
40219
40258
|
{
|
|
40220
|
-
|
|
40221
|
-
this.Canvas.beginPath();
|
|
40222
|
-
this.Canvas.moveTo(xFix,y);
|
|
40223
|
-
if (Math.abs(y-y2)>0) this.Canvas.lineTo(xFix,y2);
|
|
40224
|
-
else this.Canvas.lineTo(xFix,y+1); //太窄了,就画一个像素的宽度
|
|
40225
|
-
this.Canvas.stroke();
|
|
40259
|
+
this.Canvas.fillRect(ToFixedRect(xLeft),ToFixedRect(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
|
|
40226
40260
|
}
|
|
40227
40261
|
}
|
|
40228
40262
|
}
|
|
40229
|
-
|
|
40230
|
-
this.Canvas.restore();
|
|
40231
40263
|
}
|
|
40232
40264
|
|
|
40233
40265
|
this.GetMaxMin=function()
|
|
@@ -76015,6 +76047,12 @@ function JSChartResource()
|
|
|
76015
76047
|
|
|
76016
76048
|
TitleColor:'rgb(250,250,250)', //标题颜色
|
|
76017
76049
|
TitleBGColor:"rgb(200, 66, 69)", //标题背景颜色
|
|
76050
|
+
|
|
76051
|
+
Mark:
|
|
76052
|
+
{
|
|
76053
|
+
LineColor:"rgba(255,165,0,0.6)",
|
|
76054
|
+
LineWidth:2,
|
|
76055
|
+
}
|
|
76018
76056
|
}
|
|
76019
76057
|
|
|
76020
76058
|
this.PopKLineChart=
|
|
@@ -77621,6 +77659,11 @@ function JSChartResource()
|
|
|
77621
77659
|
if (item.BorderColor) dest.BorderColor=item.BorderColor;
|
|
77622
77660
|
if (item.TitleColor) dest.TitleColor=item.TitleColor;
|
|
77623
77661
|
if (item.TitleBGColor) dest.TitleBGColor=item.TitleBGColor;
|
|
77662
|
+
if (item.Mark)
|
|
77663
|
+
{
|
|
77664
|
+
if (item.Mark.LineColor) dest.Mark.LineColor=item.Mark.LineColor;
|
|
77665
|
+
if (IFrameSplitOperator.IsNumber(item.Mark.LineWidth)) dest.Mark.LineWidth=item.Mark.LineWidth;
|
|
77666
|
+
}
|
|
77624
77667
|
}
|
|
77625
77668
|
|
|
77626
77669
|
if (style.PopKLineChart)
|
|
@@ -81109,6 +81152,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
81109
81152
|
this.ShowMinuteChartDialog=function(data, x,y)
|
|
81110
81153
|
{
|
|
81111
81154
|
if (!this.PopMinuteChart) return;
|
|
81155
|
+
if (!ChartData.IsDayPeriod(this.Period,true)) return; //只支持日K
|
|
81112
81156
|
if (!data.Tooltip || !data.Chart) return;
|
|
81113
81157
|
|
|
81114
81158
|
var pixelRatio=GetDevicePixelRatio();
|
|
@@ -81134,7 +81178,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
81134
81178
|
|
|
81135
81179
|
if (!symbol) return;
|
|
81136
81180
|
|
|
81137
|
-
this.PopMinuteChart.Show({ Date:date, Symbol:symbol, Data:data.Tooltip.Data }, x/pixelRatio,y/pixelRatio);
|
|
81181
|
+
this.PopMinuteChart.Show({ Date:date, Symbol:symbol, Data:data.Tooltip.Data, Chart:data.Tooltip.ChartPaint }, x/pixelRatio,y/pixelRatio);
|
|
81138
81182
|
}
|
|
81139
81183
|
|
|
81140
81184
|
|
|
@@ -89960,17 +90004,17 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
|
|
|
89960
90004
|
|
|
89961
90005
|
if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
|
|
89962
90006
|
|
|
90007
|
+
var keyID = e.keyCode ? e.keyCode :e.which;
|
|
90008
|
+
|
|
89963
90009
|
//回调事件
|
|
89964
90010
|
var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN);
|
|
89965
90011
|
if (event && event.Callback)
|
|
89966
90012
|
{
|
|
89967
|
-
var sendData={ e:e, PreventDefault:false };
|
|
90013
|
+
var sendData={ e:e, KeyID:keyID, PreventDefault:false };
|
|
89968
90014
|
event.Callback(event, sendData, this);
|
|
89969
90015
|
if (sendData.PreventDefault) return;
|
|
89970
90016
|
}
|
|
89971
90017
|
|
|
89972
|
-
var keyID = e.keyCode ? e.keyCode :e.which;
|
|
89973
|
-
|
|
89974
90018
|
var draw=false;
|
|
89975
90019
|
if (this.ChartCorssCursor && this.ChartCorssCursor.OnKeyDown) //十字光标 隐藏显示
|
|
89976
90020
|
{
|
|
@@ -129603,6 +129647,11 @@ function GetBlackStyle()
|
|
|
129603
129647
|
{
|
|
129604
129648
|
BGColor:"rgba(0,0,0,0.85)",
|
|
129605
129649
|
BorderColor:"rgb(230,230,230)",
|
|
129650
|
+
|
|
129651
|
+
Mark:
|
|
129652
|
+
{
|
|
129653
|
+
LineColor:"rgba(255,215,0,0.6)",
|
|
129654
|
+
}
|
|
129606
129655
|
},
|
|
129607
129656
|
|
|
129608
129657
|
PopKLineChart:
|
|
@@ -149719,6 +149768,17 @@ function JSPopMinuteChart()
|
|
|
149719
149768
|
Option:JSPopMinuteChart.GetMinuteOption(),
|
|
149720
149769
|
JSChart:null,
|
|
149721
149770
|
Date:null,
|
|
149771
|
+
Symbol:null,
|
|
149772
|
+
Name:null,
|
|
149773
|
+
Chart:null,
|
|
149774
|
+
}
|
|
149775
|
+
|
|
149776
|
+
this.ClearCache=function()
|
|
149777
|
+
{
|
|
149778
|
+
this.Minute.Date=null;
|
|
149779
|
+
this.Minute.Symbol=null;
|
|
149780
|
+
this.Minute.Name=null;
|
|
149781
|
+
this.Minute.Chart=null;
|
|
149722
149782
|
}
|
|
149723
149783
|
|
|
149724
149784
|
this.Inital=function(hqchart, option)
|
|
@@ -149732,6 +149792,11 @@ function JSPopMinuteChart()
|
|
|
149732
149792
|
var item=CloneData(option.Option); //复制一份出来
|
|
149733
149793
|
this.Minute.Option=Object.assign(this.Minute.Option,item);
|
|
149734
149794
|
}
|
|
149795
|
+
|
|
149796
|
+
if (option.EnableMarkBG) //标记背景
|
|
149797
|
+
{
|
|
149798
|
+
this.HQChart.CreateExtendChart("MarkPopMinutePaint");
|
|
149799
|
+
}
|
|
149735
149800
|
}
|
|
149736
149801
|
}
|
|
149737
149802
|
|
|
@@ -149772,6 +149837,15 @@ function JSPopMinuteChart()
|
|
|
149772
149837
|
if (this.HQChart) this.Minute.Option.Language=g_JSChartLocalization.GetLanguageName(this.HQChart.LanguageID);
|
|
149773
149838
|
this.Minute.Option.OnCreatedCallback=(chart)=>{ this.OnCreateHQChart(chart); }
|
|
149774
149839
|
this.Minute.Option.NetworkFilter=(data, callback)=>{ this.NetworkFilter(data, callback); }
|
|
149840
|
+
|
|
149841
|
+
this.Minute.Option.EventCallback=
|
|
149842
|
+
[
|
|
149843
|
+
{
|
|
149844
|
+
event:JSCHART_EVENT_ID.ON_KEYDOWN, //键盘消息
|
|
149845
|
+
callback:(event, data, obj)=>{ this.OnKeyDown(event, data, obj); }
|
|
149846
|
+
},
|
|
149847
|
+
];
|
|
149848
|
+
|
|
149775
149849
|
chart.SetOption(this.Minute.Option); //设置K线配置
|
|
149776
149850
|
|
|
149777
149851
|
document.body.appendChild(divDom);
|
|
@@ -149832,14 +149906,16 @@ function JSPopMinuteChart()
|
|
|
149832
149906
|
if (!data.Symbol || !IFrameSplitOperator.IsPlusNumber(data.Date)) return;
|
|
149833
149907
|
|
|
149834
149908
|
this.Date=data.Date;
|
|
149835
|
-
|
|
149836
|
-
if (data.Name)
|
|
149837
|
-
|
|
149838
|
-
|
|
149909
|
+
this.Symbol=this.Name=data.Symbol;
|
|
149910
|
+
if (data.Name) this.Name=data.Name;
|
|
149911
|
+
this.Chart=data.Chart;
|
|
149912
|
+
|
|
149913
|
+
this.UpdateDialogTitle();
|
|
149839
149914
|
|
|
149840
149915
|
if (this.Minute.JSChart)
|
|
149841
149916
|
{
|
|
149842
|
-
this.Minute.JSChart.ChangeSymbol(
|
|
149917
|
+
this.Minute.JSChart.ChangeSymbol(this.Symbol);
|
|
149918
|
+
this.MarkKLineBG();
|
|
149843
149919
|
}
|
|
149844
149920
|
|
|
149845
149921
|
if (!this.Minute.Option.EnableResize)
|
|
@@ -149862,11 +149938,19 @@ function JSPopMinuteChart()
|
|
|
149862
149938
|
this.DivDialog.style.left = x + "px";
|
|
149863
149939
|
}
|
|
149864
149940
|
|
|
149941
|
+
this.UpdateDialogTitle=function()
|
|
149942
|
+
{
|
|
149943
|
+
var title=`${this.Name} ${IFrameSplitOperator.FormatDateString(this.Date)} 分时图 PageUp/PageDown翻页`;
|
|
149944
|
+
this.TitleBox.DivName.innerText=title;
|
|
149945
|
+
}
|
|
149946
|
+
|
|
149865
149947
|
this.Close=function(e)
|
|
149866
149948
|
{
|
|
149867
149949
|
if (!this.DivDialog) return;
|
|
149868
149950
|
|
|
149951
|
+
this.ClearCache();
|
|
149869
149952
|
this.DivDialog.style.visibility='hidden';
|
|
149953
|
+
this.ClearMarkKLineBG();
|
|
149870
149954
|
}
|
|
149871
149955
|
|
|
149872
149956
|
this.OnMouseDownTitle=function(e)
|
|
@@ -149928,6 +150012,114 @@ function JSPopMinuteChart()
|
|
|
149928
150012
|
|
|
149929
150013
|
if (this.Minute.JSChart) this.Minute.JSChart.SetLanguage(language);
|
|
149930
150014
|
}
|
|
150015
|
+
|
|
150016
|
+
|
|
150017
|
+
this.OnKeyDown=function(event, data, obj)
|
|
150018
|
+
{
|
|
150019
|
+
switch(data.KeyID)
|
|
150020
|
+
{
|
|
150021
|
+
case 33: //page up
|
|
150022
|
+
data.PreventDefault=true;
|
|
150023
|
+
var date=this.GetNextDate(1);
|
|
150024
|
+
if (IFrameSplitOperator.IsPlusNumber(date)) this.ChangeDate(date);
|
|
150025
|
+
break;
|
|
150026
|
+
case 34: //page down
|
|
150027
|
+
data.PreventDefault=true;
|
|
150028
|
+
var date=this.GetNextDate(-1);
|
|
150029
|
+
if (IFrameSplitOperator.IsPlusNumber(date)) this.ChangeDate(date);
|
|
150030
|
+
break;
|
|
150031
|
+
default:
|
|
150032
|
+
return;
|
|
150033
|
+
}
|
|
150034
|
+
}
|
|
150035
|
+
|
|
150036
|
+
this.GetNextDate=function(step)
|
|
150037
|
+
{
|
|
150038
|
+
if (!this.Chart) return null;
|
|
150039
|
+
if (!IFrameSplitOperator.IsNumber(this.Date)) return null;
|
|
150040
|
+
if (step==0) return null;
|
|
150041
|
+
|
|
150042
|
+
var kData=this.Chart.Data;
|
|
150043
|
+
if (!kData || !IFrameSplitOperator.IsNonEmptyArray(kData.Data)) return null;
|
|
150044
|
+
|
|
150045
|
+
var index=-1;
|
|
150046
|
+
for(var i=0;i<kData.Data.length;++i)
|
|
150047
|
+
{
|
|
150048
|
+
var kItem=kData.Data[i];
|
|
150049
|
+
if (!kItem) continue;
|
|
150050
|
+
|
|
150051
|
+
if (kItem.Date==this.Date)
|
|
150052
|
+
{
|
|
150053
|
+
index=i;
|
|
150054
|
+
break;
|
|
150055
|
+
}
|
|
150056
|
+
}
|
|
150057
|
+
|
|
150058
|
+
if (index<0) return null;
|
|
150059
|
+
|
|
150060
|
+
var date=null;
|
|
150061
|
+
if (step>0)
|
|
150062
|
+
{
|
|
150063
|
+
for(var i=1, j=0;j<step && index+i<kData.Data.length;++i)
|
|
150064
|
+
{
|
|
150065
|
+
var kItem=kData.Data[index+i];
|
|
150066
|
+
if (!kItem || !IFrameSplitOperator.IsNumber(kItem.Date)) continue;
|
|
150067
|
+
|
|
150068
|
+
date=kItem.Date;
|
|
150069
|
+
++j;
|
|
150070
|
+
}
|
|
150071
|
+
}
|
|
150072
|
+
else
|
|
150073
|
+
{
|
|
150074
|
+
step=Math.abs(step);
|
|
150075
|
+
for(var i=1, j=0;j<step && index-i>=0;++i)
|
|
150076
|
+
{
|
|
150077
|
+
var kItem=kData.Data[index-i];
|
|
150078
|
+
if (!kItem || !IFrameSplitOperator.IsNumber(kItem.Date)) continue;
|
|
150079
|
+
|
|
150080
|
+
date=kItem.Date;
|
|
150081
|
+
++j;
|
|
150082
|
+
}
|
|
150083
|
+
}
|
|
150084
|
+
|
|
150085
|
+
if (date==this.Date) return null;
|
|
150086
|
+
|
|
150087
|
+
return date;
|
|
150088
|
+
}
|
|
150089
|
+
|
|
150090
|
+
//修改日期
|
|
150091
|
+
this.ChangeDate=function(date)
|
|
150092
|
+
{
|
|
150093
|
+
if (!this.Minute.JSChart) return;
|
|
150094
|
+
|
|
150095
|
+
this.Date=date;
|
|
150096
|
+
this.UpdateDialogTitle();
|
|
150097
|
+
this.Minute.JSChart.ChangeSymbol(this.Symbol);
|
|
150098
|
+
this.MarkKLineBG();
|
|
150099
|
+
}
|
|
150100
|
+
|
|
150101
|
+
this.MarkKLineBG=function()
|
|
150102
|
+
{
|
|
150103
|
+
if (!this.HQChart) return;
|
|
150104
|
+
|
|
150105
|
+
var finder=this.HQChart.GetExtendChartByClassName("MarkPopMinutePaint");
|
|
150106
|
+
if (!finder || !finder.Chart) return;
|
|
150107
|
+
|
|
150108
|
+
finder.Chart.SetDate([this.Date]);
|
|
150109
|
+
this.HQChart.Draw();
|
|
150110
|
+
|
|
150111
|
+
}
|
|
150112
|
+
|
|
150113
|
+
this.ClearMarkKLineBG=function()
|
|
150114
|
+
{
|
|
150115
|
+
if (!this.HQChart) return;
|
|
150116
|
+
|
|
150117
|
+
var finder=this.HQChart.GetExtendChartByClassName("MarkPopMinutePaint");
|
|
150118
|
+
if (!finder || !finder.Chart) return;
|
|
150119
|
+
|
|
150120
|
+
finder.Chart.ClearData();
|
|
150121
|
+
this.HQChart.Draw();
|
|
150122
|
+
}
|
|
149931
150123
|
}
|
|
149932
150124
|
|
|
149933
150125
|
|
|
@@ -150259,6 +150451,118 @@ JSTooltipMinuteChart.GetMinuteOption=function()
|
|
|
150259
150451
|
}
|
|
150260
150452
|
|
|
150261
150453
|
|
|
150454
|
+
///////////////////////////////////////////////////////
|
|
150455
|
+
// K线上标记选中
|
|
150456
|
+
|
|
150457
|
+
function MarkPopMinutePaint()
|
|
150458
|
+
{
|
|
150459
|
+
this.newMethod=IExtendChartPainting; //派生
|
|
150460
|
+
this.newMethod();
|
|
150461
|
+
delete this.newMethod;
|
|
150462
|
+
|
|
150463
|
+
this.ClassName="MarkPopMinutePaint";
|
|
150464
|
+
this.MapDate; //标记日期
|
|
150465
|
+
this.BGColor="rgba(100,100,100,0.2)";
|
|
150466
|
+
this.LineWidth=g_JSChartResource.PopMinuteChart.Mark.LineWidth;
|
|
150467
|
+
this.LineColor=g_JSChartResource.PopMinuteChart.Mark.LineColor;
|
|
150468
|
+
this.SubFrame;
|
|
150469
|
+
this.IsDynamic=true;
|
|
150470
|
+
|
|
150471
|
+
|
|
150472
|
+
this.ReloadResource=function(resource)
|
|
150473
|
+
{
|
|
150474
|
+
this.LineWidth=g_JSChartResource.PopMinuteChart.Mark.LineWidth;
|
|
150475
|
+
this.LineColor=g_JSChartResource.PopMinuteChart.Mark.LineColor;
|
|
150476
|
+
}
|
|
150477
|
+
|
|
150478
|
+
this.SetDate=function(aryDate)
|
|
150479
|
+
{
|
|
150480
|
+
this.MapDate=new Map();
|
|
150481
|
+
if (IFrameSplitOperator.IsNonEmptyArray(aryDate))
|
|
150482
|
+
{
|
|
150483
|
+
for(var i=0;i<aryDate.length;++i)
|
|
150484
|
+
{
|
|
150485
|
+
var date=aryDate[i];
|
|
150486
|
+
this.MapDate.set(date, { Date:date} );
|
|
150487
|
+
}
|
|
150488
|
+
}
|
|
150489
|
+
}
|
|
150490
|
+
|
|
150491
|
+
this.ClearData=function()
|
|
150492
|
+
{
|
|
150493
|
+
this.MapDate=null;
|
|
150494
|
+
}
|
|
150495
|
+
|
|
150496
|
+
this.Draw=function()
|
|
150497
|
+
{
|
|
150498
|
+
this.SubFrame=null;
|
|
150499
|
+
if (!this.HQChart) return;
|
|
150500
|
+
if (!this.ChartFrame || !IFrameSplitOperator.IsNonEmptyArray(this.ChartFrame.SubFrame)) return;
|
|
150501
|
+
if (!this.MapDate || this.MapDate.size<=0) return;
|
|
150502
|
+
|
|
150503
|
+
var kData=this.HQChart.GetKData();
|
|
150504
|
+
if (!kData || !IFrameSplitOperator.IsNonEmptyArray(kData.Data)) return;
|
|
150505
|
+
this.SubFrame=this.ChartFrame.SubFrame[0].Frame;
|
|
150506
|
+
if (!this.SubFrame) return;
|
|
150507
|
+
|
|
150508
|
+
var dataWidth=this.SubFrame.DataWidth;
|
|
150509
|
+
var distanceWidth=this.SubFrame.DistanceWidth;
|
|
150510
|
+
var xPointCount=this.SubFrame.XPointCount;
|
|
150511
|
+
var border=this.SubFrame.GetBorder();
|
|
150512
|
+
var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
150513
|
+
var chartright=border.RightEx;
|
|
150514
|
+
|
|
150515
|
+
var startIndex=kData.DataOffset;
|
|
150516
|
+
var aryBG=[];
|
|
150517
|
+
for(var i=startIndex,j=0;i<kData.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
|
|
150518
|
+
{
|
|
150519
|
+
var kItem=kData.Data[i];
|
|
150520
|
+
if (!kItem) continue;
|
|
150521
|
+
if (!this.MapDate.has(kItem.Date)) continue
|
|
150522
|
+
|
|
150523
|
+
var left=xOffset;
|
|
150524
|
+
var right=xOffset+dataWidth;
|
|
150525
|
+
var x=left+(right-left)/2;
|
|
150526
|
+
|
|
150527
|
+
var bgItem={ Left:left, XCenter:x, Right:right, DataIndex:i, DataWidth:dataWidth };
|
|
150528
|
+
aryBG.push(bgItem);
|
|
150529
|
+
}
|
|
150530
|
+
|
|
150531
|
+
if (IFrameSplitOperator.IsNonEmptyArray(aryBG))
|
|
150532
|
+
{
|
|
150533
|
+
this.Canvas.save();
|
|
150534
|
+
this.DrawBG(aryBG);
|
|
150535
|
+
this.Canvas.restore();
|
|
150536
|
+
}
|
|
150537
|
+
|
|
150538
|
+
this.SubFrame=null;
|
|
150539
|
+
}
|
|
150540
|
+
|
|
150541
|
+
this.DrawBG=function(aryBG)
|
|
150542
|
+
{
|
|
150543
|
+
var border=this.ChartFrame.ChartBorder.GetBorder();
|
|
150544
|
+
var pixelRatio=GetDevicePixelRatio();
|
|
150545
|
+
if (this.MapDate.size==1) //标记一天
|
|
150546
|
+
{
|
|
150547
|
+
var item=aryBG[0];
|
|
150548
|
+
var lineWidth=this.LineWidth*pixelRatio;
|
|
150549
|
+
if (item.DataWidth<=4) lineWidth=1*pixelRatio;
|
|
150550
|
+
|
|
150551
|
+
this.Canvas.lineWidth=lineWidth;
|
|
150552
|
+
this.Canvas.strokeStyle=this.LineColor;
|
|
150553
|
+
this.Canvas.beginPath();
|
|
150554
|
+
this.Canvas.moveTo(item.XCenter,border.TopEx);
|
|
150555
|
+
this.Canvas.lineTo(item.XCenter,border.BottomEx);
|
|
150556
|
+
this.Canvas.stroke();
|
|
150557
|
+
}
|
|
150558
|
+
}
|
|
150559
|
+
}
|
|
150560
|
+
|
|
150561
|
+
|
|
150562
|
+
JSChart.RegisterExtendChartClass("MarkPopMinutePaint", { Create:function() { return new MarkPopMinutePaint}} );
|
|
150563
|
+
|
|
150564
|
+
|
|
150565
|
+
|
|
150262
150566
|
|
|
150263
150567
|
|
|
150264
150568
|
|
|
@@ -155163,7 +155467,7 @@ function HQChartScriptWorker()
|
|
|
155163
155467
|
|
|
155164
155468
|
|
|
155165
155469
|
|
|
155166
|
-
var HQCHART_VERSION="1.1.
|
|
155470
|
+
var HQCHART_VERSION="1.1.14554";
|
|
155167
155471
|
|
|
155168
155472
|
function PrintHQChartVersion()
|
|
155169
155473
|
{
|