hqchart 1.1.13644 → 1.1.13654
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.NetworkFilterTest.vue.js +7 -2
- package/lib/umychart.vue.js +311 -72
- package/package.json +1 -1
- package/src/jscommon/umychart.DialogDrawTool.js +1 -1
- package/src/jscommon/umychart.NetworkFilterTest.js +57 -0
- package/src/jscommon/umychart.PopMinuteChart.js +268 -0
- package/src/jscommon/umychart.js +102 -168
- package/src/jscommon/umychart.resource/css/tools.css +42 -0
- package/src/jscommon/umychart.style.js +6 -0
- package/src/jscommon/umychart.testdata.js +57 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +109 -169
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.NetworkFilterTest.vue.js +57 -0
- package/src/jscommon/umychart.vue/umychart.vue.js +378 -170
package/package.json
CHANGED
|
@@ -48701,6 +48701,11 @@ HQData.NetworkFilter=function(data, callback)
|
|
|
48701
48701
|
HQData.RequestMinuteDaysData(data, callback);
|
|
48702
48702
|
break;
|
|
48703
48703
|
|
|
48704
|
+
case "MinuteChartContainer::RequestPopMinuteData": //弹出分时图数据
|
|
48705
|
+
//HQChart使用教程29-走势图如何对接第3方数据2-最新分时数据 格式跟这个一样
|
|
48706
|
+
HQData.RequestPopMinuteData(data, callback);
|
|
48707
|
+
break;
|
|
48708
|
+
|
|
48704
48709
|
//HQChart使用教程30-K线图如何对接第3方数据1
|
|
48705
48710
|
case 'KLineChartContainer::RequestHistoryData': //日线全量数据下载
|
|
48706
48711
|
//HQChart使用教程30-K线图如何对接第3方数据2-日K数据
|
|
@@ -48840,6 +48845,58 @@ HQData.RequestMinuteData=function(data, callback)
|
|
|
48840
48845
|
}, 50);
|
|
48841
48846
|
}
|
|
48842
48847
|
|
|
48848
|
+
HQData.RequestPopMinuteData=function(data, callback)
|
|
48849
|
+
{
|
|
48850
|
+
data.PreventDefault=true;
|
|
48851
|
+
var symbol=data.Request.Data.symbol[0]; //请求的股票代码
|
|
48852
|
+
var date=data.Request.Data.date;
|
|
48853
|
+
var callcation=data.Request.Data.callcation; //集合竞价
|
|
48854
|
+
console.log(`[HQData::RequestPopMinuteData] Symbol=${symbol} Date=${date}`);
|
|
48855
|
+
|
|
48856
|
+
setTimeout(()=>{
|
|
48857
|
+
var srcStock=MINUTE_1DAY_DATA.stock[0];
|
|
48858
|
+
var stockItem={ date:date, minute:[], yclose:srcStock.yclose, symbol:srcStock.symbol, name:srcStock.symbol, IsHistoryMinute:true };
|
|
48859
|
+
if (callcation.Before)
|
|
48860
|
+
{
|
|
48861
|
+
var before=
|
|
48862
|
+
[
|
|
48863
|
+
//[交易时间, 价格,成交量, 成交金额, 日期(可选,YYYYMMDD)],
|
|
48864
|
+
[915, srcStock.yclose,0,0],
|
|
48865
|
+
[916, srcStock.yclose+0.01,0,0],
|
|
48866
|
+
[917, srcStock.yclose+0.03,0,0],
|
|
48867
|
+
[918, srcStock.yclose+0.02,0,0],
|
|
48868
|
+
[919, srcStock.yclose+0.02,0,0],
|
|
48869
|
+
[920, srcStock.yclose+0.01,0,0],
|
|
48870
|
+
[921, srcStock.yclose,0,0],
|
|
48871
|
+
[922, srcStock.yclose-0.02,0,0],
|
|
48872
|
+
[923, srcStock.yclose-0.03,0,0],
|
|
48873
|
+
[924, srcStock.yclose,0,0],
|
|
48874
|
+
[925, srcStock.yclose,0,0],
|
|
48875
|
+
];
|
|
48876
|
+
|
|
48877
|
+
var beforeinfo={ totalcount:11, ver:1.0 };
|
|
48878
|
+
|
|
48879
|
+
stockItem.before=before;
|
|
48880
|
+
stockItem.beforeinfo=beforeinfo;
|
|
48881
|
+
}
|
|
48882
|
+
|
|
48883
|
+
for(var i=0;i<srcStock.minute.length;++i)
|
|
48884
|
+
{
|
|
48885
|
+
var item=srcStock.minute[i];
|
|
48886
|
+
var newItem=CloneData(item);
|
|
48887
|
+
newItem.date=date;
|
|
48888
|
+
|
|
48889
|
+
stockItem.minute.push(newItem);
|
|
48890
|
+
}
|
|
48891
|
+
|
|
48892
|
+
var hqchartData={code:0, stock:[stockItem] };
|
|
48893
|
+
|
|
48894
|
+
|
|
48895
|
+
callback(hqchartData);
|
|
48896
|
+
}, 50);
|
|
48897
|
+
}
|
|
48898
|
+
|
|
48899
|
+
|
|
48843
48900
|
HQData.RequestMinuteDaysData=function(data, callback)
|
|
48844
48901
|
{
|
|
48845
48902
|
data.PreventDefault=true;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2018 jones
|
|
3
|
+
|
|
4
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
|
|
6
|
+
开源项目 https://github.com/jones2000/HQChart
|
|
7
|
+
|
|
8
|
+
jones_2000@163.com
|
|
9
|
+
|
|
10
|
+
K线点击弹出指定日期分时图
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
function JSPopMinuteChart()
|
|
15
|
+
{
|
|
16
|
+
this.DivDialog=null;
|
|
17
|
+
this.DivInfoText=null;
|
|
18
|
+
this.HQChart=null;
|
|
19
|
+
this.DragTitle=null;
|
|
20
|
+
this.Date=null;
|
|
21
|
+
this.ID=Guid();
|
|
22
|
+
|
|
23
|
+
this.Minute=
|
|
24
|
+
{
|
|
25
|
+
Option:JSPopMinuteChart.GetMinuteOption(),
|
|
26
|
+
JSChart:null,
|
|
27
|
+
Date:null,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
this.Inital=function(hqchart)
|
|
31
|
+
{
|
|
32
|
+
this.HQChart=hqchart;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
this.Create=function()
|
|
36
|
+
{
|
|
37
|
+
var divDom=document.createElement('div');
|
|
38
|
+
divDom.className='jchart_pop_minute_dailog';
|
|
39
|
+
divDom.id=this.ID;
|
|
40
|
+
divDom.style["background-color"]=g_JSChartResource.PopMinuteChart.BGColor;
|
|
41
|
+
divDom.style["border-color"]=g_JSChartResource.PopMinuteChart.BorderColor;
|
|
42
|
+
|
|
43
|
+
var divTitle=document.createElement("div");
|
|
44
|
+
divTitle.className='jschart_pop_minute_chart_Title_Div';
|
|
45
|
+
divTitle.onmousedown=(e)=>{ this.OnMouseDownTitle(e); }
|
|
46
|
+
divDom.appendChild(divTitle);
|
|
47
|
+
|
|
48
|
+
var divInfoText=document.createElement("div");
|
|
49
|
+
divInfoText.className="";
|
|
50
|
+
divInfoText.innerText="分时图";
|
|
51
|
+
this.DivInfoText=divInfoText;
|
|
52
|
+
divTitle.appendChild(divInfoText);
|
|
53
|
+
|
|
54
|
+
var divClose=document.createElement("div");
|
|
55
|
+
divClose.className='jschart_pop_minute_chart_Close_Div';
|
|
56
|
+
divClose.innerText="x";
|
|
57
|
+
divClose.onmousedown=(e)=>{ this.Close(e); }
|
|
58
|
+
divTitle.appendChild(divClose);
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
var divChart=document.createElement('div');
|
|
62
|
+
divChart.className='jschart_pop_minute_chart';
|
|
63
|
+
divDom.appendChild(divChart);
|
|
64
|
+
|
|
65
|
+
this.DivDialog=divDom;
|
|
66
|
+
|
|
67
|
+
var chart=JSChart.Init(divChart);
|
|
68
|
+
this.Minute.JSChart=chart;
|
|
69
|
+
this.Minute.Option.OnCreatedCallback=(chart)=>{ this.OnCreateHQChart(chart); }
|
|
70
|
+
this.Minute.Option.NetworkFilter=(data, callback)=>{ this.NetworkFilter(data, callback); }
|
|
71
|
+
chart.SetOption(this.Minute.Option); //设置K线配置
|
|
72
|
+
|
|
73
|
+
document.body.appendChild(divDom);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
this.NetworkFilter=function(data, callback)
|
|
77
|
+
{
|
|
78
|
+
if (!this.HQChart || !this.HQChart.NetworkFilter) return;
|
|
79
|
+
|
|
80
|
+
if (data.Name== 'MinuteChartContainer::RequestMinuteData') //分时图数据对接
|
|
81
|
+
{
|
|
82
|
+
data.Request.Data.date=this.Date;
|
|
83
|
+
data.Name="MinuteChartContainer::RequestPopMinuteData";
|
|
84
|
+
data.Explain="指定日期分时数据"
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
this.HQChart.NetworkFilter(data, callback);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
this.OnCreateHQChart=function(chart)
|
|
91
|
+
{
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
this.Destroy=function()
|
|
96
|
+
{
|
|
97
|
+
if (this.DivDialog) document.body.removeChild(this.DivDialog);
|
|
98
|
+
this.DivDialog=null;
|
|
99
|
+
this.DivInfoText=null;
|
|
100
|
+
this.Minute.JSChart=null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
this.IsShow=function()
|
|
104
|
+
{
|
|
105
|
+
if (!this.DivDialog) return false;
|
|
106
|
+
|
|
107
|
+
return this.DivDialog.style.visibility==='visible';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
this.Show=function(data, x,y)
|
|
111
|
+
{
|
|
112
|
+
if (!this.DivDialog) this.Create();
|
|
113
|
+
if (!data.Symbol || !IFrameSplitOperator.IsPlusNumber(data.Date));
|
|
114
|
+
|
|
115
|
+
this.Date=data.Date;
|
|
116
|
+
var name=data.Symbol;
|
|
117
|
+
if (data.Name) name=data.Name;
|
|
118
|
+
var title=`${name} ${IFrameSplitOperator.FormatDateString(data.Date)} 分时图`
|
|
119
|
+
this.DivInfoText.innerText=title;
|
|
120
|
+
|
|
121
|
+
if (this.Minute.JSChart)
|
|
122
|
+
{
|
|
123
|
+
this.Minute.JSChart.ChangeSymbol(data.Symbol);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
//超出窗口调整位置
|
|
127
|
+
var height=this.DivDialog.offsetHeight;
|
|
128
|
+
var width=this.DivDialog.offsetWidth;
|
|
129
|
+
var xRight=window.innerWidth-5;
|
|
130
|
+
var ybottom=window.innerHeight-5;
|
|
131
|
+
if (x+width>xRight) x=xRight-width;
|
|
132
|
+
if (y+height>ybottom) y=ybottom-height;
|
|
133
|
+
|
|
134
|
+
this.DivDialog.style.visibility='visible';
|
|
135
|
+
this.DivDialog.style.top = y + "px";
|
|
136
|
+
this.DivDialog.style.left = x + "px";
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
this.Close=function(e)
|
|
140
|
+
{
|
|
141
|
+
if (!this.DivDialog) return;
|
|
142
|
+
|
|
143
|
+
this.DivDialog.style.visibility='hidden';
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
this.OnMouseDownTitle=function(e)
|
|
147
|
+
{
|
|
148
|
+
if (!this.DivDialog) return;
|
|
149
|
+
|
|
150
|
+
var dragData={ X:e.clientX, Y:e.clientY };
|
|
151
|
+
dragData.YOffset=e.clientX - this.DivDialog.offsetLeft;
|
|
152
|
+
dragData.XOffset=e.clientY - this.DivDialog.offsetTop;
|
|
153
|
+
this.DragTitle=dragData;
|
|
154
|
+
|
|
155
|
+
document.onmousemove=(e)=>{ this.DocOnMouseMoveTitle(e); }
|
|
156
|
+
document.onmouseup=(e)=>{ this.DocOnMouseUpTitle(e); }
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
this.DocOnMouseMoveTitle=function(e)
|
|
160
|
+
{
|
|
161
|
+
if (!this.DragTitle) return;
|
|
162
|
+
|
|
163
|
+
var left = e.clientX - this.DragTitle.YOffset;
|
|
164
|
+
var top = e.clientY - this.DragTitle.XOffset;
|
|
165
|
+
|
|
166
|
+
var right=left+this.DivDialog.offsetWidth;
|
|
167
|
+
var bottom=top+ this.DivDialog.offsetHeight;
|
|
168
|
+
|
|
169
|
+
if ((right+5)>=window.innerWidth) left=window.innerWidth-this.DivDialog.offsetWidth-5;
|
|
170
|
+
if ((bottom+5)>=window.innerHeight) top=window.innerHeight-this.DivDialog.offsetHeight-5;
|
|
171
|
+
|
|
172
|
+
this.DivDialog.style.left = left + 'px';
|
|
173
|
+
this.DivDialog.style.top = top + 'px';
|
|
174
|
+
|
|
175
|
+
if(e.preventDefault) e.preventDefault();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
this.DocOnMouseUpTitle=function(e)
|
|
179
|
+
{
|
|
180
|
+
this.DragTitle=null;
|
|
181
|
+
this.onmousemove = null;
|
|
182
|
+
this.onmouseup = null;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
this.ReloadResource=function(option)
|
|
186
|
+
{
|
|
187
|
+
if (!this.DivDialog) return;
|
|
188
|
+
|
|
189
|
+
this.DivDialog.style["background-color"]=g_JSChartResource.PopMinuteChart.BGColor;
|
|
190
|
+
this.DivDialog.style["border-color"]=g_JSChartResource.PopMinuteChart.BorderColor;
|
|
191
|
+
|
|
192
|
+
if (this.Minute.JSChart) this.Minute.JSChart.ReloadResource(option);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
JSPopMinuteChart.GetMinuteOption=function()
|
|
198
|
+
{
|
|
199
|
+
var option=
|
|
200
|
+
{
|
|
201
|
+
Type:'分钟走势图', //创建图形类型
|
|
202
|
+
Windows: //窗口指标
|
|
203
|
+
[
|
|
204
|
+
//{ Index:"VOL" },
|
|
205
|
+
//{ Index:"RSI" }
|
|
206
|
+
],
|
|
207
|
+
|
|
208
|
+
Symbol:null, // cf1909.czc
|
|
209
|
+
IsAutoUpdate:false, //是自动更新数据
|
|
210
|
+
AutoUpdateFrequency:10000, //数据更新频率
|
|
211
|
+
DayCount:1, //1 最新交易日数据 >1 多日走势图
|
|
212
|
+
IsShowRightMenu:false, //是否显示右键菜单
|
|
213
|
+
|
|
214
|
+
EnableSelectRect:true,
|
|
215
|
+
EnableZoomIndexWindow:true,
|
|
216
|
+
EnableResize:true,
|
|
217
|
+
|
|
218
|
+
//BeforeOpen:{IsShow:true, Width:120, IsShowMultiDay:true, MulitiDayWidth:100, },
|
|
219
|
+
//AfterClose:{IsShow:true, Width:100, IsShowMultiDay:true, MulitiDayWidth:50, ShareVol:2 }, //ShareVol:0=盘后成交量独立坐标, 1==盘后成交量主图共用 2==盘后成交量盘前共用
|
|
220
|
+
|
|
221
|
+
CorssCursorInfo:{ Left:2, Right:1, Bottom:1 },
|
|
222
|
+
|
|
223
|
+
MinuteLine:
|
|
224
|
+
{
|
|
225
|
+
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
MinuteTitle:
|
|
229
|
+
{
|
|
230
|
+
IsShowTime:true,
|
|
231
|
+
IsShowName:false,
|
|
232
|
+
IsShowDate:true,
|
|
233
|
+
IsShowVolTitle:true,
|
|
234
|
+
//IsAlwaysShowLastData:true,
|
|
235
|
+
IsTitleShowLatestData:true,
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
MinuteVol:
|
|
239
|
+
{
|
|
240
|
+
BarColorType:1,
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
//Language:'EN',
|
|
244
|
+
|
|
245
|
+
Border: //边框
|
|
246
|
+
{
|
|
247
|
+
Left:20, //左边间距
|
|
248
|
+
Right:20, //右边间距
|
|
249
|
+
Top:25,
|
|
250
|
+
Bottom:25,
|
|
251
|
+
|
|
252
|
+
AutoLeft:{ Blank:10, MinWidth:60 },
|
|
253
|
+
AutoRight:{ Blank:10, MinWidth:60 },
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
Frame: //子框架设置
|
|
257
|
+
[
|
|
258
|
+
{ SplitCount:5 },
|
|
259
|
+
{ SplitCount:3 },
|
|
260
|
+
{ SplitCount:3 },
|
|
261
|
+
],
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return option;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|