hqchart 1.1.13588 → 1.1.13595

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.13588",
3
+ "version": "1.1.13595",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -2602,6 +2602,7 @@ var JSCHART_EVENT_ID=
2602
2602
  ON_CLICK_REPORT_CHECKBOX:141, //报价列表checkbox
2603
2603
  ON_CLICK_REPORT_BUTTON:142, //报价列表按钮
2604
2604
  ON_CLICK_REPORT_LINK:143, //报价列表 链接
2605
+ ON_CREATE_REPORT_HEADER_MENU:144, //报价列表 表头菜单
2605
2606
 
2606
2607
 
2607
2608
  ON_CHANGE_INDEX:150, //切换指标
@@ -2778,8 +2779,10 @@ var JSCHART_MENU_ID=
2778
2779
 
2779
2780
 
2780
2781
  CMD_REPORT_CHANGE_BLOCK_ID:60, //报价列表 切换板块ID
2781
-
2782
-
2782
+ CMD_REPORT_COLUMN_SORT_ID:61, //报价列表 表头排序 Arg[列序号, 排序方向]
2783
+ CMD_REPORT_COLUMN_DEL_ID:62, //报价列表 删除列
2784
+ CMD_REPORT_COLUMN_MOVE_ID:63, //报价列表 列移动
2785
+ CMD_REPORT_COLUMN_FILTER_ID:64, //报价列表 筛选
2783
2786
  }
2784
2787
 
2785
2788
 
@@ -56956,6 +56959,16 @@ function ChartArrowMarker()
56956
56959
  this.OnlyMoveXIndex=true;
56957
56960
  this.IsSupportMagnet=true;
56958
56961
 
56962
+ this.Super_SetOption=this.SetOption; //父类函数
56963
+
56964
+ this.SetOption=function(option)
56965
+ {
56966
+ this.Super_SetOption(option);
56967
+
56968
+ if (option.AreaColor) this.AreaColor=option.AreaColor;
56969
+ else this.AreaColor=IChartDrawPicture.ColorToRGBA(this.LineColor, 0.6);
56970
+ }
56971
+
56959
56972
  this.CalculatePoint=function(angle, ptStart, ptEnd, lineWidth)
56960
56973
  {
56961
56974
  var theta=angle; //三角斜边一直线夹角
@@ -56999,9 +57012,12 @@ function ChartArrowMarker()
56999
57012
  this.Canvas.lineTo(outArrow.Bottom.X,outArrow.Bottom.Y);
57000
57013
  this.Canvas.lineTo(insideArrow.Bottom.X,insideArrow.Bottom.Y);
57001
57014
  this.Canvas.lineTo(ptStart.X,ptStart.Y);
57002
- this.Canvas.closePath();
57003
57015
 
57004
- this.Canvas.fillStyle=this.LineColor;
57016
+ this.Canvas.strokeStyle=this.LineColor;
57017
+ this.Canvas.stroke();
57018
+
57019
+ this.Canvas.closePath();
57020
+ this.Canvas.fillStyle=this.AreaColor;
57005
57021
  this.Canvas.fill();
57006
57022
 
57007
57023
  /*
@@ -65792,6 +65808,9 @@ function ChartPriceRange()
65792
65808
 
65793
65809
  this.DrawArrow({X:ToFixedPoint(xCenter), Y:ptStart.Y}, {X:ToFixedPoint(xCenter), Y:ptEnd.Y});
65794
65810
 
65811
+ var bottom=this.Frame.ChartBorder.GetBottomEx();
65812
+ var top=this.Frame.ChartBorder.GetTopEx();
65813
+
65795
65814
  //文字输出
65796
65815
  var startValue=this.Frame.GetYData(ptStart.Y,false);
65797
65816
  var endValue=this.Frame.GetYData(ptEnd.Y,false);
@@ -65807,6 +65826,23 @@ function ChartPriceRange()
65807
65826
  else rtTextBG.Top=ptEnd.Y+4;
65808
65827
  rtTextBG.Bottom=rtTextBG.Top+rtTextBG.Height;
65809
65828
 
65829
+ if (diffValue>0)
65830
+ {
65831
+ if (rtTextBG.Top<=top)
65832
+ {
65833
+ rtTextBG.Top=top;
65834
+ rtTextBG.Bottom=rtTextBG.Top+rtTextBG.Height;
65835
+ }
65836
+ }
65837
+ else
65838
+ {
65839
+ if (rtTextBG.Bottom>=bottom)
65840
+ {
65841
+ rtTextBG.Bottom=bottom;
65842
+ rtTextBG.Top=rtTextBG.Bottom-rtTextBG.Height;
65843
+ }
65844
+ }
65845
+
65810
65846
  if (this.Label.EnableBGColor)
65811
65847
  {
65812
65848
  var path=new Path2D();
@@ -65913,6 +65949,7 @@ function ChartDateRange()
65913
65949
 
65914
65950
 
65915
65951
  //文字输出
65952
+ var bottom=this.Frame.ChartBorder.GetBottomEx();
65916
65953
  var startIndex=this.Frame.GetXData(ptStart.X,false);
65917
65954
  var endIndex=this.Frame.GetXData(ptEnd.X,false);
65918
65955
  var barCount=endIndex-startIndex+1;
@@ -65924,6 +65961,12 @@ function ChartDateRange()
65924
65961
  var rtTextBG={ Left:xCenter-textWidth/2, Top:ptEnd.Y+4, Width:textWidth, Height:textHeight+2 };
65925
65962
  rtTextBG.Bottom=rtTextBG.Top+rtTextBG.Height;
65926
65963
 
65964
+ if (rtTextBG.Bottom>=bottom)
65965
+ {
65966
+ rtTextBG.Bottom=bottom;
65967
+ rtTextBG.Top=rtTextBG.Bottom-rtTextBG.Height;
65968
+ }
65969
+
65927
65970
  if (this.Label.EnableBGColor)
65928
65971
  {
65929
65972
  var path=new Path2D();
@@ -865,7 +865,7 @@ function JSReportChartContainer(uielement)
865
865
  //更新数据
866
866
  this.UpdateFullData=function(data)
867
867
  {
868
- var arySymbol=[];
868
+ var arySymbol=[];
869
869
  if (IFrameSplitOperator.IsNonEmptyArray(data.data))
870
870
  {
871
871
  //0=证券代码 1=股票名称
@@ -883,17 +883,19 @@ function JSReportChartContainer(uielement)
883
883
  stock=new HQReportItem();
884
884
  stock.OriginalSymbol=symbol;
885
885
  this.MapStockData.set(symbol, stock);
886
+
886
887
  }
887
888
 
888
889
  stock.Symbol=this.GetSymbolNoSuffix(symbol);
889
890
  stock.Name=item[1];
890
891
  this.ReadStockJsonData(stock, item);
891
-
892
892
  arySymbol.push(symbol);
893
893
  }
894
894
  }
895
895
 
896
896
  //设置显示数据
897
+ this.Data.Data=[];
898
+ this.SourceData.Data=[];
897
899
  if (IFrameSplitOperator.IsNonEmptyArray(arySymbol))
898
900
  {
899
901
  for(var i=0;i<arySymbol.length;++i)
@@ -3016,10 +3018,73 @@ function JSReportChartContainer(uielement)
3016
3018
  }
3017
3019
  }
3018
3020
 
3021
+ //列排序
3022
+ this.SortColumn=function(index, sortType)
3023
+ {
3024
+ if (index<0) return false;
3025
+ var reportChart=this.GetReportChart();
3026
+ if (!reportChart) return false;
3027
+
3028
+ var column=reportChart.Column[index];
3029
+
3030
+ if (!column) return false;
3031
+ if (column.Sort!=1 && column.Sort!=2) return false;
3032
+
3033
+ var sortInfo={ Field:index, Sort:sortType };
3034
+ if (sortInfo.Sort==0) //不排序还原
3035
+ {
3036
+ this.Data.Data=[];
3037
+ if (IFrameSplitOperator.IsNonEmptyArray(this.SourceData.Data))
3038
+ this.Data.Data=this.SourceData.Data.slice();
3039
+ }
3040
+ else if (sortInfo.Sort==1 || sortInfo.Sort==2)
3041
+ {
3042
+ if (column.Sort==1) //本地排序
3043
+ {
3044
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_LOCAL_SORT);
3045
+ if (event && event.Callback)
3046
+ {
3047
+ var sendData={ Column:column, SortInfo:sortInfo, SymbolList:this.Data.Data, Result:null };
3048
+ event.Callback (event, sendData, this);
3049
+ if (Array.isArray(sendData.Result)) this.Data.Data=sendData.Result;
3050
+ }
3051
+ else
3052
+ {
3053
+ this.Data.Data.sort((left, right)=> { return this.LocalSort(left, right, column, sortInfo.Sort); });
3054
+ }
3055
+ }
3056
+ else if (column.Sort==2) //远程排序
3057
+ {
3058
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return;
3059
+
3060
+ this.SortInfo.Field=sortInfo.Field;
3061
+ this.SortInfo.Sort=sortInfo.Sort;
3062
+ this.Data.YOffset=0;
3063
+ this.ResetReportSelectStatus();
3064
+ this.RequestStockSortData(column, sortInfo.Field, sortInfo.Sort); //远程排序
3065
+ return true;
3066
+ }
3067
+ }
3068
+
3069
+ this.Data.YOffset=0;
3070
+ this.ResetReportSelectStatus();
3071
+ this.SortInfo.Field=sortInfo.Field;
3072
+ this.SortInfo.Sort=sortInfo.Sort;
3073
+ this.Draw();
3074
+ this.DelayUpdateStockData();
3075
+ return true;
3076
+ }
3077
+
3019
3078
  //点表头
3020
3079
  this.OnClickHeader=function(clickData, e)
3021
3080
  {
3022
3081
  var header=clickData.Header;
3082
+ if (header.Column && header.Column.EnablePopupHeaderMenu)
3083
+ {
3084
+ this.PopupHeaderMenu(clickData, e);
3085
+ return;
3086
+ }
3087
+
3023
3088
  if (header.Column && (header.Column.Sort==1 || header.Column.Sort==2))
3024
3089
  {
3025
3090
  var index=header.Index;
@@ -3098,6 +3163,52 @@ function JSReportChartContainer(uielement)
3098
3163
  }
3099
3164
  }
3100
3165
 
3166
+ this.PopupHeaderMenu=function(clickData, e)
3167
+ {
3168
+ if (!this.JSPopMenu) return;
3169
+ if (!this.GetEventCallback) return;
3170
+
3171
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_REPORT_HEADER_MENU);
3172
+ if (!event || !event.Callback) return;
3173
+
3174
+ var header=clickData.Header;
3175
+ var column=header.Column;
3176
+ var menuData={ Menu:null, Position:JSPopMenu.POSITION_ID.DROPDOWN_MENU_ID };
3177
+ menuData.ClickCallback=(data)=>{ this.OnClickHeaderMenu(column, data); }
3178
+
3179
+ var sendData={ MenuData:menuData, Column:column, Index:header.Index, PreventDefault:false, e:e };
3180
+ event.Callback(event, sendData, this);
3181
+ if (sendData.PreventDefault==true) return;
3182
+
3183
+ if (!menuData.Menu) return;
3184
+
3185
+ this.PopupMenuByDrapdown(menuData, header.Rect);
3186
+ }
3187
+
3188
+ //下拉菜单
3189
+ this.PopupMenuByDrapdown=function(menuData, rtButton)
3190
+ {
3191
+ if (!this.JSPopMenu) return;
3192
+
3193
+ var pixelRatio=GetDevicePixelRatio();
3194
+ var rtCell={ Left:rtButton.Left/pixelRatio, Right:rtButton.Right/pixelRatio, Bottom:rtButton.Bottom/pixelRatio, Top:rtButton.Top/pixelRatio };
3195
+ rtCell.Width=rtCell.Right-rtCell.Left;
3196
+ rtCell.Height=rtCell.Bottom-rtCell.Top;
3197
+
3198
+ var rtClient=this.UIElement.getBoundingClientRect();
3199
+ var rtScroll=GetScrollPosition();
3200
+
3201
+ var offsetLeft=rtClient.left+rtScroll.Left;
3202
+ var offsetTop=rtClient.top+rtScroll.Top;
3203
+ rtCell.Left+=offsetLeft;
3204
+ rtCell.Right+=offsetLeft;
3205
+ rtCell.Top+=offsetTop;
3206
+ rtCell.Bottom+=offsetTop;
3207
+
3208
+ this.JSPopMenu.CreatePopMenu(menuData);
3209
+ this.JSPopMenu.PopupMenuByDrapdown(rtCell);
3210
+ }
3211
+
3101
3212
  this.GetTabPopMenu=function(tabItem)
3102
3213
  {
3103
3214
  var aryMenu=[ ];
@@ -3213,6 +3324,24 @@ function JSReportChartContainer(uielement)
3213
3324
  this.Draw();
3214
3325
  }
3215
3326
 
3327
+ this.OnClickHeaderMenu=function(menuData, data)
3328
+ {
3329
+ JSConsole.Chart.Log('[JSReportChartContainer::OnClickHeaderMenu] ',menuData, data);
3330
+
3331
+ var cmdID=data.Data.ID;
3332
+ var aryArgs=data.Data.Args;
3333
+
3334
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MENU_COMMAND); //回调通知外部
3335
+ if (event && event.Callback)
3336
+ {
3337
+ var data={ PreventDefault:false, CommandID:cmdID, Args:aryArgs, SrcData:data, MenuData:menuData };
3338
+ event.Callback(event,data,this);
3339
+ if (data.PreventDefault) return;
3340
+ }
3341
+
3342
+ this.ExecuteMenuCommand(cmdID,aryArgs);
3343
+ }
3344
+
3216
3345
  this.ExecuteMenuCommand=function(cmdID, aryArgs)
3217
3346
  {
3218
3347
  JSConsole.Chart.Log('[JSReportChartContainer::ExecuteMenuCommand] cmdID=, aryArgs=', cmdID,aryArgs);
@@ -3229,6 +3358,22 @@ function JSReportChartContainer(uielement)
3229
3358
  case JSCHART_MENU_ID.CMD_REPORT_CHANGE_BLOCK_ID:
3230
3359
  if (srcParam) this.ChangeSymbol(srcParam);
3231
3360
  break;
3361
+ case JSCHART_MENU_ID.CMD_REPORT_COLUMN_SORT_ID:
3362
+ if (IFrameSplitOperator.IsNumber(param) && IFrameSplitOperator.IsNumber(aryArgs[1]))
3363
+ this.SortColumn(param, aryArgs[1]);
3364
+ break;
3365
+ case JSCHART_MENU_ID.CMD_REPORT_COLUMN_MOVE_ID:
3366
+ if (IFrameSplitOperator.IsNumber(param) && IFrameSplitOperator.IsNumber(aryArgs[1]))
3367
+ {
3368
+ var leftIndex=param;
3369
+ var rightIndex=param+aryArgs[1];
3370
+ this.SwapColumn(leftIndex, rightIndex, {Redraw:true});
3371
+ }
3372
+ break;
3373
+ case JSCHART_MENU_ID.CMD_REPORT_COLUMN_DEL_ID:
3374
+ if (IFrameSplitOperator.IsNumber(param))
3375
+ this.DeleteColumn(param, {Redraw:true});
3376
+ break;
3232
3377
  }
3233
3378
  }
3234
3379
 
@@ -3246,6 +3391,20 @@ function JSReportChartContainer(uielement)
3246
3391
  }
3247
3392
  }
3248
3393
 
3394
+ this.DeleteColumn=function(index, option)
3395
+ {
3396
+ var reportChart=this.GetReportChart();
3397
+ if (!reportChart) return;
3398
+
3399
+ if (!reportChart.DeleteColumn(index)) return;
3400
+
3401
+ if (option && option.Redraw)
3402
+ {
3403
+ this.SetSizeChange(true);
3404
+ this.Draw();
3405
+ }
3406
+ }
3407
+
3249
3408
  //本地排序
3250
3409
  this.LocalSort=function(left, right, column, sortType)
3251
3410
  {
@@ -4100,6 +4259,9 @@ function ChartReport()
4100
4259
  else colItem.IsDrawCallback=false;
4101
4260
  if (item.Icon) colItem.Icon=item.Icon;
4102
4261
 
4262
+ //点击表头弹出菜单
4263
+ if (IFrameSplitOperator.IsBool(item.EnablePopupHeaderMenu)) colItem.EnablePopupHeaderMenu=item.EnablePopupHeaderMenu;
4264
+
4103
4265
  if (item.Sort==1 || item.Sort==2) //1本地排序 2=远程排序
4104
4266
  {
4105
4267
  colItem.SortType=[1,2]; //默认 降序 ,升序
@@ -4207,6 +4369,15 @@ function ChartReport()
4207
4369
  return true;
4208
4370
  }
4209
4371
 
4372
+ this.DeleteColumn=function(index)
4373
+ {
4374
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Column)) return false;
4375
+ if (index<0 || index>=this.Column.length) return false;
4376
+
4377
+ this.Column.splice(index,1);
4378
+ return true;
4379
+ }
4380
+
4210
4381
  this.GetXScrollPos=function()
4211
4382
  {
4212
4383
  return this.Data.XOffset;
@@ -54,6 +54,18 @@
54
54
  <div class="content unicode" style="display: block;">
55
55
  <ul class="icon_lists dib-box">
56
56
 
57
+ <li class="dib">
58
+ <span class="icon hqchart_drawtool">&#xe6a5;</span>
59
+ <div class="name">箭头</div>
60
+ <div class="code-name">&amp;#xe6a5;</div>
61
+ </li>
62
+
63
+ <li class="dib">
64
+ <span class="icon hqchart_drawtool">&#xe60d;</span>
65
+ <div class="name">长箭头</div>
66
+ <div class="code-name">&amp;#xe60d;</div>
67
+ </li>
68
+
57
69
  <li class="dib">
58
70
  <span class="icon hqchart_drawtool">&#xe707;</span>
59
71
  <div class="name">边框</div>
@@ -456,9 +468,9 @@
456
468
  <pre><code class="language-css"
457
469
  >@font-face {
458
470
  font-family: 'hqchart_drawtool';
459
- src: url('iconfont.woff2?t=1717590716827') format('woff2'),
460
- url('iconfont.woff?t=1717590716827') format('woff'),
461
- url('iconfont.ttf?t=1717590716827') format('truetype');
471
+ src: url('iconfont.woff2?t=1721662981231') format('woff2'),
472
+ url('iconfont.woff?t=1721662981231') format('woff'),
473
+ url('iconfont.ttf?t=1721662981231') format('truetype');
462
474
  }
463
475
  </code></pre>
464
476
  <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@@ -484,6 +496,24 @@
484
496
  <div class="content font-class">
485
497
  <ul class="icon_lists dib-box">
486
498
 
499
+ <li class="dib">
500
+ <span class="icon hqchart_drawtool icon-big_arrow"></span>
501
+ <div class="name">
502
+ 箭头
503
+ </div>
504
+ <div class="code-name">.icon-big_arrow
505
+ </div>
506
+ </li>
507
+
508
+ <li class="dib">
509
+ <span class="icon hqchart_drawtool icon-bottom-arrow-solid"></span>
510
+ <div class="name">
511
+ 长箭头
512
+ </div>
513
+ <div class="code-name">.icon-bottom-arrow-solid
514
+ </div>
515
+ </li>
516
+
487
517
  <li class="dib">
488
518
  <span class="icon hqchart_drawtool icon-biankuang"></span>
489
519
  <div class="name">
@@ -1087,6 +1117,22 @@
1087
1117
  <div class="content symbol">
1088
1118
  <ul class="icon_lists dib-box">
1089
1119
 
1120
+ <li class="dib">
1121
+ <svg class="icon svg-icon" aria-hidden="true">
1122
+ <use xlink:href="#icon-big_arrow"></use>
1123
+ </svg>
1124
+ <div class="name">箭头</div>
1125
+ <div class="code-name">#icon-big_arrow</div>
1126
+ </li>
1127
+
1128
+ <li class="dib">
1129
+ <svg class="icon svg-icon" aria-hidden="true">
1130
+ <use xlink:href="#icon-bottom-arrow-solid"></use>
1131
+ </svg>
1132
+ <div class="name">长箭头</div>
1133
+ <div class="code-name">#icon-bottom-arrow-solid</div>
1134
+ </li>
1135
+
1090
1136
  <li class="dib">
1091
1137
  <svg class="icon svg-icon" aria-hidden="true">
1092
1138
  <use xlink:href="#icon-biankuang"></use>
@@ -1,8 +1,8 @@
1
1
  @font-face {
2
2
  font-family: "hqchart_drawtool"; /* Project id 4529603 */
3
- src: url('iconfont.woff2?t=1717590716827') format('woff2'),
4
- url('iconfont.woff?t=1717590716827') format('woff'),
5
- url('iconfont.ttf?t=1717590716827') format('truetype');
3
+ src: url('iconfont.woff2?t=1721662981231') format('woff2'),
4
+ url('iconfont.woff?t=1721662981231') format('woff'),
5
+ url('iconfont.ttf?t=1721662981231') format('truetype');
6
6
  }
7
7
 
8
8
  .hqchart_drawtool {
@@ -13,6 +13,14 @@
13
13
  -moz-osx-font-smoothing: grayscale;
14
14
  }
15
15
 
16
+ .icon-big_arrow:before {
17
+ content: "\e6a5";
18
+ }
19
+
20
+ .icon-bottom-arrow-solid:before {
21
+ content: "\e60d";
22
+ }
23
+
16
24
  .icon-biankuang:before {
17
25
  content: "\e707";
18
26
  }