hqchart 1.1.13709 → 1.1.13717

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.
@@ -35970,6 +35970,303 @@ function ChartMACD()
35970
35970
  }
35971
35971
  }
35972
35972
 
35973
+ function ChartClipColorStick()
35974
+ {
35975
+ this.newMethod=IChartPainting; //派生
35976
+ this.newMethod();
35977
+ delete this.newMethod;
35978
+
35979
+ this.ClassName="ChartClipColorStick";
35980
+ this.UpColor=g_JSChartResource.UpBarColor;
35981
+ this.DownColor=g_JSChartResource.DownBarColor;
35982
+ this.LineWidth=1;
35983
+ //差值线
35984
+ this.DownDiffColor=g_JSChartResource.DownBarColor;
35985
+ this.UpDiffColor=g_JSChartResource.UpBarColor;
35986
+
35987
+ this.BaseLineColor; //基准线
35988
+
35989
+ this.BaseValue=0;
35990
+ this.Super_GetMaxMin=this.GetMaxMin; //父类的方法
35991
+
35992
+ this.SetOption=function(option)
35993
+ {
35994
+ if (!option) return;
35995
+
35996
+ if (option.UpColor) this.UpColor=option.UpColor;
35997
+ if (option.DownColor) this.DownColor=option.DownColor;
35998
+ if (option.DownDiffColor) this.DownDiffColor=option.DownDiffColor;
35999
+ if (option.UpDiffColor) this.UpDiffColor=option.UpDiffColor;
36000
+ if (option.BaseLineColor) this.BaseLineColor=option.BaseLineColor;
36001
+ if (IFrameSplitOperator.IsNumber(option.BaseValue)) this.BaseValue=option.BaseValue;
36002
+ }
36003
+
36004
+ this.Draw=function()
36005
+ {
36006
+ if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
36007
+ if (this.IsShowIndexTitleOnly()) return;
36008
+ if (this.IsHideScriptIndex()) return;
36009
+
36010
+ if (this.NotSupportMessage)
36011
+ {
36012
+ this.DrawNotSupportmessage();
36013
+ return;
36014
+ }
36015
+
36016
+ this.Canvas.save();
36017
+ var dataWidth=this.ChartFrame.DataWidth;
36018
+ var lineWidth=this.LineWidth*GetDevicePixelRatio();
36019
+ if (this.LineWidth==50) lineWidth=dataWidth;
36020
+ else if (lineWidth>dataWidth) lineWidth=dataWidth;
36021
+
36022
+ if (IFrameSplitOperator.IsNumber(this.BaseValue) && this.BaseValue!=0)
36023
+ {
36024
+ this.DrawBaseLine();
36025
+
36026
+ if (this.BaseValue>0) this.DrawBars(lineWidth, true);
36027
+ else this.DrawBars(lineWidth, false);
36028
+ }
36029
+ else
36030
+ {
36031
+ //上下分开画
36032
+ this.DrawBars(lineWidth, true);
36033
+ this.DrawBars(lineWidth, false);
36034
+ }
36035
+
36036
+
36037
+ this.Canvas.restore();
36038
+ }
36039
+
36040
+ this.DrawBars=function(lineWidth, bUpBar)
36041
+ {
36042
+ var isMinute=this.IsMinuteFrame();
36043
+ var dataWidth=this.ChartFrame.DataWidth;
36044
+ var distanceWidth=this.ChartFrame.DistanceWidth;
36045
+ var xPointCount=this.ChartFrame.XPointCount;
36046
+ var isHSCreen=this.ChartFrame.IsHScreen===true;
36047
+
36048
+ if (isHSCreen)
36049
+ {
36050
+ var border=this.ChartBorder.GetHScreenBorder();
36051
+ var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
36052
+ var chartright=border.BottomEx;
36053
+ var lockRect=this.GetLockRect();
36054
+ if (lockRect) chartright=lockRect.Top;
36055
+ }
36056
+ else
36057
+ {
36058
+ var border=this.ChartBorder.GetBorder();
36059
+ var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
36060
+
36061
+ var chartright=border.RightEx;
36062
+ var lockRect=this.GetLockRect();
36063
+ if (lockRect) chartright=lockRect.Left;
36064
+ }
36065
+
36066
+ var yBottom=this.ChartFrame.GetYFromData(this.BaseValue);
36067
+ var aryBar=[], aryDiffBar=[];
36068
+ for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
36069
+ {
36070
+ var value=this.Data.Data[i];
36071
+ if (value==null) continue;
36072
+ if (bUpBar)
36073
+ {
36074
+ if (value<0) continue;
36075
+ }
36076
+ else
36077
+ {
36078
+ if (value>=0) continue;
36079
+ }
36080
+
36081
+ if (isMinute)
36082
+ {
36083
+ var x=this.ChartFrame.GetXFromIndex(j);
36084
+ }
36085
+ else
36086
+ {
36087
+ var left=xOffset;
36088
+ var right=xOffset+dataWidth;
36089
+ if (right>chartright) break;
36090
+ var x=left+(right-left)/2;
36091
+ }
36092
+
36093
+ if (x>chartright) break;
36094
+
36095
+ var bDiffBar=false;
36096
+ var diffValue=null;
36097
+ if (this.BaseValue>0)
36098
+ {
36099
+ if (value<this.BaseValue)
36100
+ {
36101
+ bDiffBar=true;
36102
+ diffValue=this.BaseValue-(this.BaseValue-value);
36103
+ }
36104
+ }
36105
+ else if (this.BaseValue<0)
36106
+ {
36107
+ if (value>this.BaseValue)
36108
+ {
36109
+ bDiffBar=true;
36110
+ diffValue=this.BaseValue+(value-this.BaseValue)
36111
+ }
36112
+ }
36113
+
36114
+ if (!bDiffBar)
36115
+ {
36116
+ var y=this.ChartFrame.GetYFromData(value);
36117
+ aryBar.push({X:x, Y:y});
36118
+ }
36119
+ else
36120
+ {
36121
+ var y=this.ChartFrame.GetYFromData(diffValue);
36122
+ aryDiffBar.push({X:x, Y:y});
36123
+ }
36124
+ }
36125
+
36126
+ this.Canvas.lineWidth=lineWidth;
36127
+ if (bUpBar) this.Canvas.strokeStyle=this.UpColor;
36128
+ else this.Canvas.strokeStyle=this.DownColor;
36129
+
36130
+ this.DrawStick(aryBar,lineWidth,yBottom);
36131
+
36132
+ if (this.BaseValue>0)
36133
+ {
36134
+ this.Canvas.strokeStyle=this.UpDiffColor;
36135
+ this.DrawStick(aryDiffBar,lineWidth,yBottom);
36136
+ }
36137
+ else if (this.BaseValue<0)
36138
+ {
36139
+ this.Canvas.strokeStyle=this.DownDiffColor;
36140
+ this.DrawStick(aryDiffBar,lineWidth,yBottom);
36141
+ }
36142
+
36143
+ }
36144
+
36145
+ this.DrawStick=function(aryData, lineWidth, yBottom)
36146
+ {
36147
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryData)) return;
36148
+
36149
+ var isHSCreen=this.ChartFrame.IsHScreen===true;
36150
+ var drawCount=0;
36151
+ this.Canvas.beginPath();
36152
+ for(var i=0; i<aryData.length; ++i)
36153
+ {
36154
+ var item=aryData[i];
36155
+ var y=item.Y;
36156
+ var xFix=ToFixedPoint2(lineWidth, item.X); //毛边修正
36157
+
36158
+ if (isHSCreen)
36159
+ {
36160
+ this.Canvas.moveTo(yBottom,ToFixedPoint(x));
36161
+ this.Canvas.lineTo(y,ToFixedPoint(x));
36162
+ }
36163
+ else
36164
+ {
36165
+ this.Canvas.moveTo(xFix,yBottom);
36166
+ this.Canvas.lineTo(xFix,y);
36167
+ }
36168
+
36169
+ ++drawCount;
36170
+ }
36171
+
36172
+ if (drawCount>0) this.Canvas.stroke();
36173
+ }
36174
+
36175
+ this.DrawBaseLine=function()
36176
+ {
36177
+ if (!IFrameSplitOperator.IsNumber(this.BaseValue) || this.BaseValue==0) return;
36178
+ if (!this.BaseLineColor) return;
36179
+
36180
+ var isHSCreen=this.ChartFrame.IsHScreen===true;
36181
+ var border=this.ChartFrame.GetBorder();
36182
+ var y=this.ChartFrame.GetYFromData(this.BaseValue);
36183
+
36184
+ this.Canvas.strokeStyle=this.BaseLineColor;
36185
+ this.Canvas.lineWidth=1*GetDevicePixelRatio();
36186
+
36187
+ if (isHSCreen)
36188
+ {
36189
+
36190
+ }
36191
+ else
36192
+ {
36193
+ var yFix=ToFixedPoint(y);
36194
+ this.Canvas.beginPath();
36195
+ this.Canvas.moveTo(border.Left,yFix);
36196
+ this.Canvas.lineTo(border.Right,yFix);
36197
+ this.Canvas.stroke();
36198
+ }
36199
+ }
36200
+
36201
+ this.GetMaxMin=function()
36202
+ {
36203
+ if (!IFrameSplitOperator.IsNumber(this.BaseValue) || this.BaseValue==0)
36204
+ return this.Super_GetMaxMin();
36205
+
36206
+ var xPointCount=this.ChartFrame.XPointCount;
36207
+ var start=this.Data.DataOffset;
36208
+ if (this.ChartFrame.GlobalOption && this.ChartFrame.GlobalOption.IsValueFullRange)
36209
+ {
36210
+ start=0;
36211
+ xPointCount=this.Data.Data.length;
36212
+ }
36213
+
36214
+ var range={ Min:null, Max:null }, maxDiffValue=null; //基准值的差值
36215
+ if(!this.Data || !this.Data.Data) return range;
36216
+
36217
+ if (this.BaseValue>0) range.Min=this.BaseValue;
36218
+ else range.Max=this.BaseValue;
36219
+
36220
+ for(var i=start,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
36221
+ {
36222
+ var value=this.Data.Data[i];
36223
+ if (value==null || isNaN(value)) continue;
36224
+
36225
+ if (this.BaseValue>0)
36226
+ {
36227
+ if (value<0) continue;
36228
+
36229
+ if (value<this.BaseValue)
36230
+ {
36231
+ var diffValue=this.BaseValue-value;
36232
+ if (maxDiffValue==null || maxDiffValue<diffValue) maxDiffValue=diffValue;
36233
+ continue;
36234
+ }
36235
+ }
36236
+ else
36237
+ {
36238
+ if (value>0) continue;
36239
+
36240
+ if (value>this.BaseValue)
36241
+ {
36242
+ var diffValue=value-this.BaseValue;
36243
+ if (maxDiffValue==null || maxDiffValue<diffValue) maxDiffValue=diffValue;
36244
+ continue;
36245
+ }
36246
+ }
36247
+
36248
+ if (range.Max==null) range.Max=value;
36249
+ if (range.Min==null) range.Min=value;
36250
+
36251
+ if (range.Max<value) range.Max=value;
36252
+ if (range.Min>value) range.Min=value;
36253
+ }
36254
+
36255
+ if (this.BaseValue>0)
36256
+ {
36257
+ if (IFrameSplitOperator.IsNumber(maxDiffValue) && IFrameSplitOperator.IsNumber(range.Min))
36258
+ range.Min-=maxDiffValue;
36259
+ }
36260
+ else
36261
+ {
36262
+ if (IFrameSplitOperator.IsNumber(maxDiffValue) && IFrameSplitOperator.IsNumber(range.Max))
36263
+ range.Max+=maxDiffValue;
36264
+ }
36265
+
36266
+ return range;
36267
+ }
36268
+ }
36269
+
35973
36270
  //柱子
35974
36271
  function ChartBar()
35975
36272
  {
@@ -247,7 +247,8 @@ function JSKeyboardChartContainer(uielement)
247
247
  this.NetworkFilter; //数据回调接口
248
248
  this.Data={ XOffset:0, YOffset:0, Data:[] }; //股票列表
249
249
  this.MapSymbol=new Map();
250
- this.SourceData={ Data:[] } //码表数据 Data:[ { Symbol:, Spell, Name:, Color:}]
250
+ this.SourceData={ Data:[] } //码表数据 Data:[ { Symbol:, Spell, Name:, Color: TypeName:, TypeID } ]
251
+ this.FunctionKeyData=[]; //功能键 { Priority:, Data:[ { Symbol:, Spell, Name:, Color:, TypeName:, TypeID } ]
251
252
 
252
253
  //事件回调
253
254
  this.mapEvent=new Map(); //通知外部调用 key:JSCHART_EVENT_ID value:{Callback:回调,}
@@ -274,10 +275,44 @@ function JSKeyboardChartContainer(uielement)
274
275
  if (option && option.Redraw==true) this.Draw();
275
276
  }
276
277
 
278
+ this.SearchFunctionKeyData=function(strSearch)
279
+ {
280
+ if (strSearch.length<=0) return null;
281
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.FunctionKeyData)) return null;
282
+
283
+ var aryData=[];
284
+ for(var i=0; i<this.FunctionKeyData.length; ++i)
285
+ {
286
+ var groupData=this.FunctionKeyData[i];
287
+ if (!groupData) continue;
288
+ if (!IFrameSplitOperator.IsNonEmptyArray(groupData.Data)) continue;
289
+
290
+ var aryExactQuery=[]; //精确查询
291
+ var aryFuzzyQuery=[]; //模糊查询
292
+ var aryEqualQuery=[]; //相等
293
+
294
+ for(var j=0;j<groupData.Data.length;++j)
295
+ {
296
+ var item=groupData.Data[j];
297
+ if (this.SearchSymbol(item, strSearch, aryExactQuery, aryFuzzyQuery,aryEqualQuery)) continue;
298
+ }
299
+
300
+ if (IFrameSplitOperator.IsNonEmptyArray(aryEqualQuery)) aryData.push(...aryEqualQuery);
301
+ if (IFrameSplitOperator.IsNonEmptyArray(aryExactQuery)) aryData.push(...aryExactQuery);
302
+ if (IFrameSplitOperator.IsNonEmptyArray(aryFuzzyQuery)) aryData.push(...aryFuzzyQuery);
303
+ }
304
+
305
+ if (aryData.length>0) return aryData;
306
+
307
+ return null;
308
+ }
309
+
277
310
  this.Search=function(strText)
278
311
  {
279
312
  var aryExactQuery=[]; //精确查询
280
313
  var aryFuzzyQuery=[]; //模糊查询
314
+ var aryEqualQuery=[]; //相等
315
+ var aryFuncKeyQuery=null;
281
316
  this.MapSymbol.clear();
282
317
  this.Data.Data=[];
283
318
  this.Data.XOffset=0;
@@ -286,17 +321,21 @@ function JSKeyboardChartContainer(uielement)
286
321
  var strSearch=strText.trim();
287
322
  if (strSearch.length>0)
288
323
  {
324
+ aryFuncKeyQuery=this.SearchFunctionKeyData(strSearch);
325
+
289
326
  for(var i=0;i<this.SourceData.Data.length;++i)
290
327
  {
291
328
  var item=this.SourceData.Data[i];
292
- if (this.SearchSymbol(item, strSearch, aryExactQuery, aryFuzzyQuery)) continue;
329
+ if (this.SearchSymbol(item, strSearch, aryExactQuery, aryFuzzyQuery, aryEqualQuery)) continue;
293
330
  else if (this.SearchSpell(item, strSearch, aryExactQuery, aryFuzzyQuery)) continue;
294
331
  }
295
332
  }
296
-
297
- if (IFrameSplitOperator.IsNonEmptyArray(aryExactQuery) || IFrameSplitOperator.IsNonEmptyArray(aryFuzzyQuery))
298
- this.Data.Data=aryExactQuery.concat(aryFuzzyQuery);
299
333
 
334
+ if (IFrameSplitOperator.IsNonEmptyArray(aryFuncKeyQuery)) this.Data.Data.push(...aryFuncKeyQuery);
335
+ if (IFrameSplitOperator.IsNonEmptyArray(aryEqualQuery)) this.Data.Data.push(...aryEqualQuery);
336
+ if (IFrameSplitOperator.IsNonEmptyArray(aryExactQuery)) this.Data.Data.push(...aryExactQuery);
337
+ if (IFrameSplitOperator.IsNonEmptyArray(aryFuzzyQuery)) this.Data.Data.push(...aryFuzzyQuery);
338
+
300
339
  this.ChartPaint[0].SelectedRow=0;
301
340
  this.ChartPaint[0].SizeChange=true;
302
341
 
@@ -305,12 +344,13 @@ function JSKeyboardChartContainer(uielement)
305
344
  this.Draw();
306
345
  }
307
346
 
308
- this.SearchSymbol=function(item, strText, aryExactQuery, aryFuzzyQuery)
347
+ this.SearchSymbol=function(item, strText, aryExactQuery, aryFuzzyQuery, aryEqualQuery)
309
348
  {
310
349
  var find=item.Symbol.indexOf(strText);
311
350
  if (find<0) return false;
312
351
 
313
- if (find==0) aryExactQuery.push(item.Symbol);
352
+ if (item.Symbol==strText) aryEqualQuery.push(item.Symbol);
353
+ else if (find==0) aryExactQuery.push(item.Symbol);
314
354
  else aryFuzzyQuery.push(item.Symbol);
315
355
 
316
356
  this.MapSymbol.set(item.Symbol, item);
@@ -335,8 +375,21 @@ function JSKeyboardChartContainer(uielement)
335
375
 
336
376
  this.SetSymbolData=function(arySymbol)
337
377
  {
338
- this.SourceData.Data=arySymbol;
339
-
378
+ this.SourceData.Data=[];
379
+ for(var i=0;i<arySymbol.length;++i)
380
+ {
381
+ var item=arySymbol[i];
382
+ if (IFrameSplitOperator.IsNumber(item.Priority))
383
+ {
384
+ if (!this.FunctionKeyData[item.Priority]) this.FunctionKeyData[item.Priority]={ Priority:item.Priority, Data:[] };
385
+ this.FunctionKeyData[item.Priority].Data.push(item);
386
+ }
387
+ else
388
+ {
389
+ this.SourceData.Data.push(item);
390
+ }
391
+ }
392
+
340
393
  /*
341
394
  //测试
342
395
  this.MapSymbol.clear();
@@ -609,11 +662,13 @@ function JSKeyboardChartContainer(uielement)
609
662
  if (!chart) return false;
610
663
 
611
664
  var data=chart.GetSelectedSymbol();
665
+ var selItem=this.MapSymbol.get(data.Symbol);
666
+ if (!selItem) return false;
612
667
 
613
668
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYBOARD_SELECTED)
614
669
  if (event && event.Callback)
615
670
  {
616
- event.Callback(event, { Data:data }, this);
671
+ event.Callback(event, { Data:data, RowData:selItem }, this);
617
672
  }
618
673
  }
619
674
 
@@ -1223,6 +1278,38 @@ function ChartSymbolList()
1223
1278
  this.SetColumn=function(aryColumn)
1224
1279
  {
1225
1280
  if (!IFrameSplitOperator.IsNonEmptyArray(aryColumn)) return;
1281
+
1282
+ this.Column=[];
1283
+ for(var i=0;i<aryColumn.length;++i)
1284
+ {
1285
+ var item=aryColumn[i];
1286
+ var colItem=this.GetDefaultColunm(item.Type);
1287
+ if (!colItem) continue;
1288
+
1289
+ if (item.Title) colItem.Title=item.Title;
1290
+ if (item.TextAlign) colItem.TextAlign=item.TextAlign;
1291
+ if (item.MaxText) colItem.MaxText=item.MaxText;
1292
+
1293
+ this.Column.push(colItem);
1294
+ }
1295
+ }
1296
+
1297
+ this.GetDefaultColunm=function(id)
1298
+ {
1299
+ var DEFAULT_COLUMN=
1300
+ [
1301
+ { Type:KEYBOARD_COLUMN_ID.SHORT_SYMBOL_ID, Title:"代码", TextAlign:"left", Width:null, MaxText:"888888" },
1302
+ { Type:KEYBOARD_COLUMN_ID.NAME_ID, Title:"名称", TextAlign:"left", Width:null, MaxText:"擎擎擎擎擎擎" },
1303
+ { Type:KEYBOARD_COLUMN_ID.TYPE_NAME_ID, Title:"类型", TextAlign:"right", Width:null, MaxText:"擎擎擎擎" },
1304
+ ];
1305
+
1306
+ for(var i=0;i<DEFAULT_COLUMN.length;++i)
1307
+ {
1308
+ var item=DEFAULT_COLUMN[i];
1309
+ if (item.Type==id) return item;
1310
+ }
1311
+
1312
+ return null;
1226
1313
  }
1227
1314
 
1228
1315
  this.Draw=function()
@@ -1553,8 +1553,8 @@ input[type="color"] {
1553
1553
  .jchart_pop_keyboard_dailog
1554
1554
  {
1555
1555
  position: absolute;
1556
- width: 230px;
1557
- height:360px;
1556
+ width: 300px;
1557
+ height:440px;
1558
1558
  left: 1px;
1559
1559
  top: 1px;
1560
1560
  z-index: 999;
@@ -1027,7 +1027,7 @@ HQData.Keyboard_RequestSymbolList=function(data, callback)
1027
1027
  var shortSymbol=item[0];
1028
1028
  shortSymbol=shortSymbol.replace(".sh", "");
1029
1029
  shortSymbol=shortSymbol.replace(".sz", "");
1030
- var symbolItem={ Symbol:item[0], Name:item[1], ShortSymbol:shortSymbol, Spell:item[3], Type:item[2] };
1030
+ var symbolItem={ Symbol:item[0], Name:item[1], ShortSymbol:shortSymbol, Spell:item[3], Type:item[2], Data:{ Symbol:item[0], Type:0 } };
1031
1031
  if (symbolItem.Type=="EQA")
1032
1032
  {
1033
1033
  symbolItem.TypeName="股票";
@@ -1041,6 +1041,15 @@ HQData.Keyboard_RequestSymbolList=function(data, callback)
1041
1041
  arySymbol.push(symbolItem);
1042
1042
  }
1043
1043
 
1044
+ arySymbol.push( { Symbol:"01", Name:"分时成交明细", TypeName:"功能键", Priority:1, Color:"rgb(220,20,60)" , Data:{ PageName:"分时成交明细", Type:2 }} );
1045
+ arySymbol.push( { Symbol:"02", Name:"分价表", TypeName:"功能键", Priority:1, Color:"rgb(220,20,60)" ,Data:{ PageName:"分价表", Type:2 }} );
1046
+ arySymbol.push( { Symbol:"06", Name:"自选股", TypeName:"功能键", Priority:1 , Color:"rgb(220,20,60)", Data:{ PageName:"自选股", Type:2 }} );
1047
+
1048
+ arySymbol.push( { Symbol:"MACD", Name:"平滑异同平均线", TypeName:"指标", Priority:2 , Color:"rgb(0,0,255)", Data:{ Index:"MACD", Type:1 }} );
1049
+ arySymbol.push( { Symbol:"RSI", Name:"相对强弱指标", TypeName:"指标", Priority:2, Color:"rgb(0,0,255)",Data:{ Index:"RSI", Type:1 }} );
1050
+ arySymbol.push( { Symbol:"MA", Name:"均线", TypeName:"指标", Priority:2, Color:"rgb(0,0,255)" ,Data:{ Index:"MA", Type:1 } } );
1051
+ arySymbol.push( { Symbol:"BOLL", Name:"布林线", TypeName:"指标", Priority:2, Color:"rgb(0,0,255)" ,Data:{ Index:"BOLL", Type:1 } } );
1052
+
1044
1053
  callback(arySymbol);
1045
1054
  }
1046
1055