hqchart 1.1.13232 → 1.1.13245
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 +195 -197
- package/package.json +1 -1
- package/src/jscommon/umychart.DialogDrawTool.js +427 -0
- package/src/jscommon/umychart.complier.js +17 -2
- package/src/jscommon/umychart.js +73 -305
- package/src/jscommon/umychart.popMenu.js +8 -0
- package/src/jscommon/umychart.resource/css/tools.css +102 -0
- package/src/jscommon/umychart.resource/css/umychart.drawtool.dailog.css +98 -0
- package/src/jscommon/umychart.resource/js/codemirror/javascript.js +1 -1
- package/src/jscommon/umychart.style.js +10 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +101 -308
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +537 -308
package/package.json
CHANGED
|
@@ -0,0 +1,427 @@
|
|
|
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
|
+
内置画图工具 设置框
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
JS_DRAWTOOL_MENU_ID=
|
|
14
|
+
{
|
|
15
|
+
CMD_SELECTED_ID:1,
|
|
16
|
+
CMD_CHANGE_LINE_COLOR_ID:2,
|
|
17
|
+
CMD_DELETE_ALL_RAW_CHART_ID:3
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
function JSDialogDrawTool()
|
|
21
|
+
{
|
|
22
|
+
this.AryChartGroup=
|
|
23
|
+
[
|
|
24
|
+
{
|
|
25
|
+
Title:"线段",
|
|
26
|
+
AryChart:
|
|
27
|
+
[
|
|
28
|
+
{ Title: '线段', ClassName: 'hqchart_drawtool icon-draw_line', Type:0, Data:{ ID:"线段" } },
|
|
29
|
+
{ Title: '射线', ClassName: 'hqchart_drawtool icon-draw_rays', Type:0, Data:{ ID:"射线" } },
|
|
30
|
+
{ Title: '标价线', ClassName: 'hqchart_drawtool icon-price_line', Type:0, Data:{ ID:"标价线" } },
|
|
31
|
+
{ Title: '垂直线', ClassName: 'hqchart_drawtool icon-vertical_line', Type:0, Data:{ ID:"垂直线" } },
|
|
32
|
+
{ Title: '箭头', ClassName: 'hqchart_drawtool icon-draw_rays', Type:0, Data:{ ID:"箭头" } },
|
|
33
|
+
{ Title: '趋势线', ClassName: 'hqchart_drawtool icon-draw_trendline', Type:0, Data:{ ID:"趋势线" } },
|
|
34
|
+
{ Title: '水平线', ClassName: 'hqchart_drawtool icon-draw_hline', Type:0, Data:{ ID:"水平线" } },
|
|
35
|
+
{ Title: '涂鸦线段', ClassName: 'hqchart_drawtool icon-draw_line', Type:0, Data:{ ID:"涂鸦线段" } },
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
Title:"通道",
|
|
40
|
+
AryChart:
|
|
41
|
+
[
|
|
42
|
+
{ Title: '平行线', ClassName: 'hqchart_drawtool icon-draw_parallel_lines', Type:0, Data:{ ID:"平行线" } },
|
|
43
|
+
{ Title: '水平线段', ClassName: 'hqchart_drawtool icon-draw_hlinesegment', Type:0, Data:{ ID:"水平线段" } },
|
|
44
|
+
{ Title: '平行射线', ClassName: 'hqchart_drawtool icon-draw_p_rays_lines', Type:0, Data:{ ID:"平行射线" } },
|
|
45
|
+
{ Title: '平行通道', ClassName: 'hqchart_drawtool icon-draw_parallelchannel',Type:0, Data:{ ID:"平行通道" } },
|
|
46
|
+
{ Title: '价格通道线', ClassName: 'hqchart_drawtool icon-draw_pricechannel', Type:0, Data:{ ID:"价格通道线" } },
|
|
47
|
+
{ Title: '箱型线', ClassName: 'iconfont icon-draw_box', Type:0, Data:{ ID:"箱型线" } },
|
|
48
|
+
{ Title:"不相交通道", ClassName:"hqchart_drawtool icon-buxiangjiaojiao", Type:0, Data:{ ID:"DisjointChannel"} },
|
|
49
|
+
{ Title:"平滑顶/底", ClassName:"hqchart_drawtool icon-tubiao_buxiangjiaotongdao", Type:0, Data:{ ID:"FlatTop"}}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
Title:"多边形",
|
|
54
|
+
AryChart:
|
|
55
|
+
[
|
|
56
|
+
{ Title: '圆弧线', ClassName: 'hqchart_drawtool icon-draw_arc', Type:0, Data:{ ID:"圆弧线" } },
|
|
57
|
+
{ Title: '矩形', ClassName: 'hqchart_drawtool icon-rectangle', Type:0, Data:{ ID:"矩形" } },
|
|
58
|
+
{ Title: '平行四边形', ClassName: 'hqchart_drawtool icon-draw_quadrangle', Type:0, Data:{ ID:"平行四边形" } },
|
|
59
|
+
{ Title: '三角形', ClassName: 'hqchart_drawtool icon-draw_triangle', Type:0, Data:{ ID:"三角形" } },
|
|
60
|
+
{ Title: '圆', ClassName: 'hqchart_drawtool icon-draw_circle', Type:0, Data:{ ID:"圆" } },
|
|
61
|
+
{ Title: '对称角度', ClassName: 'hqchart_drawtool icon-draw_symangle', Type:0, Data:{ ID:"对称角度" } },
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
Title:"波浪线",
|
|
66
|
+
AryChart:
|
|
67
|
+
[
|
|
68
|
+
{ Title: 'M头W底', ClassName: 'hqchart_drawtool icon-draw_wavemw', Type:0, Data:{ ID:"M头W底" } },
|
|
69
|
+
{ Title: '头肩型', ClassName: 'hqchart_drawtool icon-draw_head_shoulders_bt', Type:0, Data:{ ID:"头肩型" } },
|
|
70
|
+
{ Title: '波浪尺', ClassName: 'hqchart_drawtool icon-waveruler', Type:0, Data:{ ID:"波浪尺" } },
|
|
71
|
+
{ Title: 'AB波浪尺', ClassName: 'hqchart_drawtool icon-waveruler', Type:0, Data:{ ID:"AB波浪尺" } },
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
Title:"测量工具",
|
|
76
|
+
AryChart:
|
|
77
|
+
[
|
|
78
|
+
{ Title: '价格范围', ClassName: 'hqchart_drawtool icon-shijianfanwei', Type:0, Data:{ ID:"PriceRange" } },
|
|
79
|
+
{ Title: '时间范围', ClassName: 'hqchart_drawtool icon-jiagefanwei', Type:0, Data:{ ID:"DateRange" } },
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
Title:"文字",
|
|
84
|
+
AryChart:
|
|
85
|
+
[
|
|
86
|
+
{ Title: '价格标签', ClassName: 'hqchart_drawtool icon-Tooltip', Type:0, Data:{ ID:"PriceLabel" } },
|
|
87
|
+
{ Title: '价格注释', ClassName: 'hqchart_drawtool icon-tooltiptext', Type:0, Data:{ ID:"PriceNote" } },
|
|
88
|
+
{ Title: '向上箭头', ClassName: 'iconfont icon-arrow_up', Type:0, Data:{ ID:"icon-arrow_up" } },
|
|
89
|
+
{ Title: '向下箭头', ClassName: 'iconfont icon-arrow_down', Type:0, Data:{ ID:"icon-arrow_down" } },
|
|
90
|
+
{ Title: '向左箭头', ClassName: 'iconfont icon-arrow_left', Type:0, Data:{ ID:"icon-arrow_left" }},
|
|
91
|
+
{ Title: '向右箭头', ClassName: 'iconfont icon-arrow_right', Type:0, Data:{ ID:"icon-arrow_right" }},
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
this.ToolConfig=
|
|
98
|
+
{
|
|
99
|
+
Title:"工具",
|
|
100
|
+
AryTool:
|
|
101
|
+
[
|
|
102
|
+
{ Title:"选中", ClassName:'hqchart_drawtool icon-arrow', Type:1, Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_SELECTED_ID} },
|
|
103
|
+
{ Title:'尺子', ClassName: 'hqchart_drawtool icon-ruler', Type:0, Data:{ ID:"尺子" } },
|
|
104
|
+
{ Title:"点击切换颜色", ClassName: 'hqchart_drawtool icon-fangkuai', Type:2, Data:{ ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID }},
|
|
105
|
+
{ Title:"删除所有画线", ClassName: 'hqchart_drawtool icon-recycle_bin', Type:2, Data:{ ID:JS_DRAWTOOL_MENU_ID.CMD_DELETE_ALL_RAW_CHART_ID }}
|
|
106
|
+
]
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
this.DivDialog=null;
|
|
111
|
+
this.AryDivChart=[];
|
|
112
|
+
this.HQChart=null;
|
|
113
|
+
this.LineColor='rgb(255,140,0)';
|
|
114
|
+
this.LineColorIndex=0;
|
|
115
|
+
this.RandomLineColor=["rgb(255,69,0)", "rgb(0,191,255)", "rgb(255,0,255)", "rgb(255,105,180)"];
|
|
116
|
+
this.LineWidth=1*GetDevicePixelRatio();
|
|
117
|
+
this.ColumnCount=4;
|
|
118
|
+
|
|
119
|
+
this.DragTitle=null;
|
|
120
|
+
|
|
121
|
+
this.Inital=function(hqchart)
|
|
122
|
+
{
|
|
123
|
+
this.LineColor=g_JSChartResource.DrawPicture.LineColor[0];
|
|
124
|
+
this.RandomLineColor.splice(0,0,this.LineColor);
|
|
125
|
+
this.HQChart=hqchart;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
this.Create=function()
|
|
129
|
+
{
|
|
130
|
+
var divDom=document.createElement("div");
|
|
131
|
+
divDom.className='UMyChart_DrawTool_Dialog_Div';
|
|
132
|
+
|
|
133
|
+
var divTitle=document.createElement("div");
|
|
134
|
+
divTitle.className='UMyChart_DrawTool_Title_Div';
|
|
135
|
+
divTitle.innerText="画图工具";
|
|
136
|
+
divTitle.onmousedown=(e)=>{ this.OnMouseDownTitle(e); }
|
|
137
|
+
|
|
138
|
+
var divClose=document.createElement("div");
|
|
139
|
+
divClose.className='UMyChart_DrawTool_Close_Div';
|
|
140
|
+
divClose.innerText="x";
|
|
141
|
+
divClose.onmousedown=(e)=>{ this.Close(e); }
|
|
142
|
+
divTitle.appendChild(divClose);
|
|
143
|
+
|
|
144
|
+
divDom.appendChild(divTitle);
|
|
145
|
+
|
|
146
|
+
var table=document.createElement("table");
|
|
147
|
+
table.className="UMyChart_DrawTool_Table";
|
|
148
|
+
divDom.appendChild(table);
|
|
149
|
+
|
|
150
|
+
var tbody=document.createElement("tbody");
|
|
151
|
+
tbody.className="UMyChart_DrawTool_Tbody";
|
|
152
|
+
table.appendChild(tbody);
|
|
153
|
+
|
|
154
|
+
for(var i=0;i<this.AryChartGroup.length;++i)
|
|
155
|
+
{
|
|
156
|
+
var item=this.AryChartGroup[i];
|
|
157
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(item.AryChart)) continue;
|
|
158
|
+
|
|
159
|
+
this.CreateChartGroupItem(item, tbody);
|
|
160
|
+
|
|
161
|
+
var trDom=document.createElement("tr");
|
|
162
|
+
trDom.className='UMyChart_DrawTool_Group_End_Tr';
|
|
163
|
+
tbody.appendChild(trDom);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
//工具栏
|
|
167
|
+
this.CreateToolGroup(tbody);
|
|
168
|
+
|
|
169
|
+
this.DivDialog=divDom;
|
|
170
|
+
|
|
171
|
+
document.body.appendChild(divDom);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
this.Destroy=function()
|
|
175
|
+
{
|
|
176
|
+
this.AryDivChart=[];
|
|
177
|
+
document.body.remove(this.DivDialog);
|
|
178
|
+
this.DivDialog=null;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
this.CreateChartGroupItem=function(groupItem, tbody)
|
|
182
|
+
{
|
|
183
|
+
var trDom=document.createElement("tr");
|
|
184
|
+
trDom.className='UMyChart_DrawTool_Group_Tr';
|
|
185
|
+
tbody.appendChild(trDom);
|
|
186
|
+
|
|
187
|
+
var tdDom=document.createElement("td");
|
|
188
|
+
tdDom.className="UMyChart_DrawTool_Group_Td";
|
|
189
|
+
tdDom.innerText=groupItem.Title;
|
|
190
|
+
tdDom.colSpan=this.ColumnCount;
|
|
191
|
+
trDom.appendChild(tdDom);
|
|
192
|
+
|
|
193
|
+
var chartCount=groupItem.AryChart.length;
|
|
194
|
+
for(var i=0,j=0;i<chartCount;)
|
|
195
|
+
{
|
|
196
|
+
var trDom=document.createElement("tr");
|
|
197
|
+
trDom.className='UMyChart_DrawTool_Tr';
|
|
198
|
+
|
|
199
|
+
for(j=0;j<this.ColumnCount && i<chartCount; ++j, ++i)
|
|
200
|
+
{
|
|
201
|
+
var item=groupItem.AryChart[i];
|
|
202
|
+
this.CreateChartItem(item, trDom);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
tbody.appendChild(trDom);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
this.CreateChartItem=function(item, trDom)
|
|
210
|
+
{
|
|
211
|
+
var tdDom=document.createElement("td");
|
|
212
|
+
tdDom.className="UMyChart_DrawTool_Td";
|
|
213
|
+
tdDom.title=item.Title;
|
|
214
|
+
trDom.appendChild(tdDom);
|
|
215
|
+
|
|
216
|
+
var spanDom=document.createElement("span");
|
|
217
|
+
spanDom.className=item.ClassName;
|
|
218
|
+
spanDom.classList.add("UMyChart_DrawTool_Span");
|
|
219
|
+
tdDom.appendChild(spanDom);
|
|
220
|
+
|
|
221
|
+
var data={ Item:item, TD:tdDom, Span:spanDom };
|
|
222
|
+
tdDom.onmousedown=(e)=> { this.OnClickItem(e, data); }; //点击
|
|
223
|
+
|
|
224
|
+
this.AryDivChart.push(data);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
this.OnClickItem=function(e, data)
|
|
228
|
+
{
|
|
229
|
+
console.log('[JSDialogDrawTool::OnClickChartItem] ', data);
|
|
230
|
+
if (!data.Item || !data.Item.Data) return;
|
|
231
|
+
|
|
232
|
+
var type=data.Item.Type;
|
|
233
|
+
var id=data.Item.Data.ID;
|
|
234
|
+
if (type==2 && id==JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID)
|
|
235
|
+
{
|
|
236
|
+
this.OnChangeLineColor(data);
|
|
237
|
+
}
|
|
238
|
+
else if (type==2 && id==JS_DRAWTOOL_MENU_ID.CMD_DELETE_ALL_RAW_CHART_ID)
|
|
239
|
+
{
|
|
240
|
+
this.DeleteAllChart();
|
|
241
|
+
}
|
|
242
|
+
else if (type==1 && id==JS_DRAWTOOL_MENU_ID.CMD_SELECTED_ID)
|
|
243
|
+
{
|
|
244
|
+
this.ClearAllSelectedChart();
|
|
245
|
+
this.ClearCurrnetDrawPicture();
|
|
246
|
+
}
|
|
247
|
+
else if (type==0)
|
|
248
|
+
{
|
|
249
|
+
this.ClearAllSelectedChart();
|
|
250
|
+
data.Span.classList.add("UMyChart_DrawTool_Span_Selected");
|
|
251
|
+
this.CreateDrawPicture(data);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
//清空选中状态
|
|
256
|
+
this.ClearAllSelectedChart=function()
|
|
257
|
+
{
|
|
258
|
+
for(var i=0;i<this.AryDivChart.length;++i)
|
|
259
|
+
{
|
|
260
|
+
var item=this.AryDivChart[i];
|
|
261
|
+
item.Span.classList.remove("UMyChart_DrawTool_Span_Selected");
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
this.CreateToolGroup=function(tbody)
|
|
266
|
+
{
|
|
267
|
+
var trDom=document.createElement("tr");
|
|
268
|
+
trDom.className='UMyChart_DrawTool_Group_Tr';
|
|
269
|
+
tbody.appendChild(trDom);
|
|
270
|
+
|
|
271
|
+
var tdDom=document.createElement("td");
|
|
272
|
+
tdDom.className="UMyChart_DrawTool_Group_Td";
|
|
273
|
+
tdDom.innerText=this.ToolConfig.Title;
|
|
274
|
+
tdDom.colSpan=this.ColumnCount;
|
|
275
|
+
trDom.appendChild(tdDom);
|
|
276
|
+
|
|
277
|
+
var chartCount=this.ToolConfig.AryTool.length;
|
|
278
|
+
for(var i=0,j=0;i<chartCount;)
|
|
279
|
+
{
|
|
280
|
+
var trDom=document.createElement("tr");
|
|
281
|
+
trDom.className='UMyChart_DrawTool_Tr';
|
|
282
|
+
|
|
283
|
+
for(j=0;j<this.ColumnCount && i<chartCount; ++j, ++i)
|
|
284
|
+
{
|
|
285
|
+
var item=this.ToolConfig.AryTool[i];
|
|
286
|
+
this.CreateToolItem(item, trDom);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
tbody.appendChild(trDom);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
this.CreateToolItem=function(item, trDom)
|
|
294
|
+
{
|
|
295
|
+
var tdDom=document.createElement("td");
|
|
296
|
+
tdDom.className="UMyChart_DrawTool_Td";
|
|
297
|
+
tdDom.title=item.Title;
|
|
298
|
+
trDom.appendChild(tdDom);
|
|
299
|
+
|
|
300
|
+
var spanDom=document.createElement("span");
|
|
301
|
+
spanDom.className=item.ClassName;
|
|
302
|
+
spanDom.classList.add("UMyChart_DrawTool_Span");
|
|
303
|
+
tdDom.appendChild(spanDom);
|
|
304
|
+
var data={ Item:item, TD:tdDom, Span:spanDom };
|
|
305
|
+
|
|
306
|
+
if (item.Type==2 && item.Data.ID==JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID) //颜色
|
|
307
|
+
{
|
|
308
|
+
spanDom.style['color']=this.LineColor;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
tdDom.onmousedown=(e)=> { this.OnClickItem(e, data); }; //点击
|
|
312
|
+
|
|
313
|
+
this.AryDivChart.push(data);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
this.OnChangeLineColor=function(data)
|
|
319
|
+
{
|
|
320
|
+
++this.LineColorIndex;
|
|
321
|
+
var index=this.LineColorIndex%this.RandomLineColor.length;
|
|
322
|
+
this.LineColor=this.RandomLineColor[index];
|
|
323
|
+
|
|
324
|
+
data.Span.style['color']=this.LineColor;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
//清空所有画图工具
|
|
328
|
+
this.DeleteAllChart=function()
|
|
329
|
+
{
|
|
330
|
+
if (!this.HQChart) return;
|
|
331
|
+
|
|
332
|
+
this.HQChart.ClearChartDrawPicture();
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
this.CreateDrawPicture=function(data)
|
|
336
|
+
{
|
|
337
|
+
if (!this.HQChart) return null;
|
|
338
|
+
|
|
339
|
+
var option=
|
|
340
|
+
{
|
|
341
|
+
LineColor:this.LineColor, //线段颜色
|
|
342
|
+
LineWidth:this.LineWidth, //线段宽度
|
|
343
|
+
//PointColor:'rgba(255,130,71,0.5)' //点颜色
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
var name=data.Item.Data.ID;
|
|
347
|
+
if (["icon-arrow_up","icon-arrow_down","icon-arrow_left", "icon-arrow_right"].includes(name)) option=null;
|
|
348
|
+
|
|
349
|
+
this.HQChart.CreateChartDrawPicture(name, option, (chart)=>{ this.OnFinishDrawPicture(chart, data); });
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
this.ClearCurrnetDrawPicture=function()
|
|
353
|
+
{
|
|
354
|
+
if (this.HQChart) this.HQChart.ClearCurrnetDrawPicture();
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
//画图工具绘制完成
|
|
358
|
+
this.OnFinishDrawPicture=function(chart, data)
|
|
359
|
+
{
|
|
360
|
+
data.Span.classList.remove("UMyChart_DrawTool_Span_Selected");
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
this.Show=function(x, y)
|
|
364
|
+
{
|
|
365
|
+
if (!this.DivDialog) return;
|
|
366
|
+
|
|
367
|
+
this.DivDialog.style.visibility='visible';
|
|
368
|
+
this.DivDialog.style.top = y + "px";
|
|
369
|
+
this.DivDialog.style.left = x + "px";
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
this.Close=function(e)
|
|
373
|
+
{
|
|
374
|
+
if (!this.DivDialog) return;
|
|
375
|
+
|
|
376
|
+
this.DivDialog.style.visibility='hidden';
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
this.IsShow=function()
|
|
380
|
+
{
|
|
381
|
+
if (!this.DivDialog) return false;
|
|
382
|
+
|
|
383
|
+
return this.DivDialog.style.visibility==='visible';
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
this.OnMouseDownTitle=function(e)
|
|
387
|
+
{
|
|
388
|
+
if (!this.DivDialog) return;
|
|
389
|
+
|
|
390
|
+
var dragData={ X:e.clientX, Y:e.clientY };
|
|
391
|
+
dragData.YOffset=e.clientX - this.DivDialog.offsetLeft;
|
|
392
|
+
dragData.XOffset=e.clientY - this.DivDialog.offsetTop;
|
|
393
|
+
this.DragTitle=dragData;
|
|
394
|
+
|
|
395
|
+
document.onmousemove=(e)=>{ this.DocOnMouseMoveTitle(e); }
|
|
396
|
+
document.onmouseup=(e)=>{ this.DocOnMouseUpTitle(e); }
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
this.DocOnMouseMoveTitle=function(e)
|
|
400
|
+
{
|
|
401
|
+
if (!this.DragTitle) return;
|
|
402
|
+
|
|
403
|
+
var left = e.clientX - this.DragTitle.YOffset;
|
|
404
|
+
var top = e.clientY - this.DragTitle.XOffset;
|
|
405
|
+
|
|
406
|
+
var right=left+this.DivDialog.offsetWidth;
|
|
407
|
+
var bottom=top+ this.DivDialog.offsetHeight;
|
|
408
|
+
|
|
409
|
+
if ((right+5)>=window.innerWidth) left=window.innerWidth-this.DivDialog.offsetWidth-5;
|
|
410
|
+
if ((bottom+5)>=window.innerHeight) top=window.innerHeight-this.DivDialog.offsetHeight-5;
|
|
411
|
+
|
|
412
|
+
this.DivDialog.style.left = left + 'px'
|
|
413
|
+
this.DivDialog.style.top = top + 'px'
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
this.DocOnMouseUpTitle=function(e)
|
|
417
|
+
{
|
|
418
|
+
this.DragTitle=null;
|
|
419
|
+
this.onmousemove = null;
|
|
420
|
+
this.onmouseup = null;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
@@ -10388,6 +10388,11 @@ function JSDraw(errorHandler,symbolData)
|
|
|
10388
10388
|
return offset;
|
|
10389
10389
|
}
|
|
10390
10390
|
|
|
10391
|
+
this.KLINETYPE=function(type)
|
|
10392
|
+
{
|
|
10393
|
+
return type;
|
|
10394
|
+
}
|
|
10395
|
+
|
|
10391
10396
|
this.FIRSTDRAW=function(value)
|
|
10392
10397
|
{
|
|
10393
10398
|
return value;
|
|
@@ -10986,7 +10991,7 @@ function JSDraw(errorHandler,symbolData)
|
|
|
10986
10991
|
{
|
|
10987
10992
|
for(var i in condition)
|
|
10988
10993
|
{
|
|
10989
|
-
drawData[i]=null;
|
|
10994
|
+
drawData.Data[i]=null;
|
|
10990
10995
|
if (!condition[i]) continue;
|
|
10991
10996
|
|
|
10992
10997
|
if (isNumber)
|
|
@@ -11011,7 +11016,7 @@ function JSDraw(errorHandler,symbolData)
|
|
|
11011
11016
|
var count=this.SymbolData.Data.Data.length;
|
|
11012
11017
|
for(var i=0; i<count; ++i)
|
|
11013
11018
|
{
|
|
11014
|
-
drawData[i]=null;
|
|
11019
|
+
drawData.Data[i]=null;
|
|
11015
11020
|
if (isNumber)
|
|
11016
11021
|
{
|
|
11017
11022
|
drawData.Data[i]=data;
|
|
@@ -17155,6 +17160,7 @@ function JSExecute(ast,option)
|
|
|
17155
17160
|
var vLineConfig=null;
|
|
17156
17161
|
var isFirstDraw=null;
|
|
17157
17162
|
let xOffset=null, yOffset=null;
|
|
17163
|
+
var klineType=null;
|
|
17158
17164
|
for(let j=0; j<item.Expression.Expression.length; ++j)
|
|
17159
17165
|
{
|
|
17160
17166
|
let itemExpression=item.Expression.Expression[j];
|
|
@@ -17312,6 +17318,10 @@ function JSExecute(ast,option)
|
|
|
17312
17318
|
vLineConfig=itemExpression.Draw;
|
|
17313
17319
|
varName=null;
|
|
17314
17320
|
}
|
|
17321
|
+
else if (itemExpression.Callee.Name=="KLINETYPE")
|
|
17322
|
+
{
|
|
17323
|
+
klineType=itemExpression.Out;
|
|
17324
|
+
}
|
|
17315
17325
|
}
|
|
17316
17326
|
}
|
|
17317
17327
|
else if (itemExpression.Type==Syntax.BinaryExpression)
|
|
@@ -17459,6 +17469,7 @@ function JSExecute(ast,option)
|
|
|
17459
17469
|
if (IFrameSplitOperator.IsNumber(xOffset)) outVar.XOffset=xOffset;
|
|
17460
17470
|
if (IFrameSplitOperator.IsNumber(yOffset)) outVar.YOffset=yOffset;
|
|
17461
17471
|
if (IFrameSplitOperator.IsBool(isFirstDraw)) outVar.IsFirstDraw=isFirstDraw;
|
|
17472
|
+
if (IFrameSplitOperator.IsNumber(klineType)) outVar.KLineType=klineType;
|
|
17462
17473
|
this.OutVarTable.push(outVar);
|
|
17463
17474
|
}
|
|
17464
17475
|
else if (varName)
|
|
@@ -17898,6 +17909,9 @@ function JSExecute(ast,option)
|
|
|
17898
17909
|
node.Draw=this.Draw.DRAWKLINE_IF(args[0],args[1],args[2],args[3],args[4]);
|
|
17899
17910
|
node.Out=[];
|
|
17900
17911
|
break;
|
|
17912
|
+
case "KLINETYPE": //K线类型 和DRAWKLINE连用
|
|
17913
|
+
node.Out=this.Draw.KLINETYPE(args[0]);
|
|
17914
|
+
break;
|
|
17901
17915
|
case "DRAWOVERLAYKLINE":
|
|
17902
17916
|
node.Draw=this.Draw.DRAWOVERLAYKLINE(args[0],args[1],args[2],args[3]);
|
|
17903
17917
|
node.Out=[];
|
|
@@ -20698,6 +20712,7 @@ function ScriptIndex(name,script,args,option)
|
|
|
20698
20712
|
chart.Data.Data=varItem.Draw.DrawData;
|
|
20699
20713
|
chart.IsShowMaxMinPrice=false;
|
|
20700
20714
|
chart.IsShowKTooltip=false;
|
|
20715
|
+
if (IFrameSplitOperator.IsNumber(varItem.KLineType)) chart.DrawType=varItem.KLineType;
|
|
20701
20716
|
|
|
20702
20717
|
if (varItem.Color) //如果设置了颜色,使用外面设置的颜色
|
|
20703
20718
|
chart.UnchagneColor=chart.DownColor=chart.UpColor=this.GetColor(varItem.Color);
|