hqchart 1.1.13672 → 1.1.13682

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.
@@ -257,6 +257,7 @@ function JSKeyboardChartContainer(uielement)
257
257
 
258
258
  //拖拽滚动条
259
259
  this.DragYScroll=null; //{Start:{x,y}, End:{x, y}}
260
+
260
261
  this.IsDestroy=false; //是否已经销毁了
261
262
 
262
263
  this.ChartDestory=function() //销毁
@@ -297,6 +298,7 @@ function JSKeyboardChartContainer(uielement)
297
298
  this.Data.Data=aryExactQuery.concat(aryFuzzyQuery);
298
299
 
299
300
  this.ChartPaint[0].SelectedRow=0;
301
+ this.ChartPaint[0].SizeChange=true;
300
302
 
301
303
  JSConsole.Chart.Log(`[JSKeyboardChart:Search] search=${strSearch}, source=${this.SourceData.Data.length} match=${this.Data.Data.length}`);
302
304
 
@@ -373,6 +375,12 @@ function JSKeyboardChartContainer(uielement)
373
375
  chart.Data=this.Data;
374
376
  this.ChartPaint[0]=chart;
375
377
 
378
+ chart.VScrollbar=new ChartKeyboardVScrollbar();
379
+ chart.VScrollbar.Frame=this.Frame;
380
+ chart.VScrollbar.Canvas=this.Canvas;
381
+ chart.VScrollbar.ChartBorder=this.Frame.ChartBorder;
382
+ chart.VScrollbar.Report=chart;
383
+
376
384
  if (option)
377
385
  {
378
386
 
@@ -624,7 +632,7 @@ function JSKeyboardChartContainer(uielement)
624
632
 
625
633
  this.UIOnMouseDown=function(e)
626
634
  {
627
- this.DragXScroll=null;
635
+ this.DragYScroll=null;
628
636
  this.DragMove={ Click:{ X:e.clientX, Y:e.clientY }, Move:{X:e.clientX, Y:e.clientY}, PreMove:{X:e.clientX, Y:e.clientY } };
629
637
 
630
638
  var pixelTatio = GetDevicePixelRatio();
@@ -643,6 +651,29 @@ function JSKeyboardChartContainer(uielement)
643
651
  if (clickData.Redraw==true)
644
652
  this.Draw();
645
653
  }
654
+ else if (clickData.Type==5 && e.button==0) //右侧滚动条
655
+ {
656
+ var scroll=clickData.VScrollbar;
657
+ if (scroll.Type==1) //顶部按钮
658
+ {
659
+ if (this.MoveYOffset(-1))
660
+ this.Draw();
661
+ }
662
+ else if (scroll.Type==2) //底部按钮
663
+ {
664
+ if (this.MoveYOffset(1))
665
+ this.Draw();
666
+ }
667
+ else if (scroll.Type==3) //滚动条
668
+ {
669
+ this.DragYScroll={ Click:{X:x, Y:y}, LastMove:{X:x, Y:y} };
670
+ }
671
+ else if (scroll.Type==4) //滚动条内部
672
+ {
673
+ if (this.SetYOffset(scroll.Pos))
674
+ this.Draw();
675
+ }
676
+ }
646
677
  }
647
678
 
648
679
  document.onmousemove=(e)=>{ this.DocOnMouseMove(e); }
@@ -688,68 +719,17 @@ function JSKeyboardChartContainer(uielement)
688
719
  var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
689
720
  var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
690
721
 
691
- //JSConsole.Chart.Log(`[JSReportChartContainer::DocOnMouseMove] x=${x}, y=${y}`);
692
-
693
- if (this.DragRow)
694
- {
695
- var drag=this.DragRow;
696
- var moveSetpY=drag.LastMove.Y-e.clientY;
697
- if (Math.abs(moveSetpY)<2) return;
698
- var reportChart=this.GetReportChart();
699
- drag.LastMove.X=e.clientX;
700
- drag.LastMove.Y=e.clientY;
701
- drag.Inside={X:x, Y:y};
702
-
703
- if (reportChart)
704
- {
705
- var moveRow=reportChart.OnDrawgRow(x,y,e);
706
- if (moveRow )
707
- {
708
- if (moveRow.Type==2)
709
- {
710
- if (moveRow.Data.DataIndex!=drag.Data.Row.DataIndex)
711
- {
712
- drag.MoveRow=moveRow;
713
- }
714
- }
715
- else if (moveRow.Type==7)
716
- {
717
- var pageStatus=reportChart.GetCurrentPageStatus();
718
- if (!pageStatus.IsEnd)
719
- {
720
- this.MoveYOffset(1, false);
721
- drag.MoveRow=null;
722
-
723
- this.EnablePageScroll=true;
724
- this.AutoScrollPage(2);
725
- }
726
- }
727
- else if (moveRow.Type==5)
728
- {
729
- if (this.Data.YOffset>0)
730
- {
731
- this.MoveYOffset(-1, false);
732
- drag.MoveRow=null;
733
-
734
- this.EnablePageScroll=true;
735
- this.AutoScrollPage(-2);
736
- }
737
- }
738
- }
739
- reportChart.DragRow=drag;
740
- }
741
-
742
- this.Draw();
743
- }
744
- else if (this.DragXScroll)
722
+ if (this.DragYScroll)
745
723
  {
746
724
  var chart=this.ChartPaint[0];
747
- if (!chart || !chart.Tab) return;
725
+ if (!chart || !chart.VScrollbar) return;
726
+
727
+ this.DragYScroll.LastMove.X=x;
728
+ this.DragYScroll.LastMove.Y=y;
748
729
 
749
- this.DragXScroll.LastMove.X=x;
750
- this.DragXScroll.LastMove.Y=y;
751
- var pos=chart.Tab.GetScrollPostionByPoint(x,y);
752
- if (this.SetXOffset(pos)) this.Draw();
730
+ var pos=chart.VScrollbar.GetScrollPostionByPoint(x,y);
731
+ if (this.SetYOffset(pos))
732
+ this.Draw();
753
733
  }
754
734
  }
755
735
 
@@ -759,6 +739,8 @@ function JSKeyboardChartContainer(uielement)
759
739
  document.onmousemove=null;
760
740
  document.onmouseup=null;
761
741
 
742
+ this.DragYScroll=null;
743
+
762
744
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYBOARD_MOUSEUP)
763
745
  if (event && event.Callback)
764
746
  {
@@ -1065,6 +1047,21 @@ function JSKeyboardChartContainer(uielement)
1065
1047
  return result;
1066
1048
  }
1067
1049
  }
1050
+
1051
+ this.SetYOffset=function(pos)
1052
+ {
1053
+ if (!IFrameSplitOperator.IsNumber(pos)) return false;
1054
+ var chart=this.ChartPaint[0];
1055
+ if (!chart) return false;
1056
+
1057
+ var maxOffset=chart.GetYScrollRange();
1058
+ if (pos<0) pos=0;
1059
+ if (pos>maxOffset) pos=maxOffset;
1060
+
1061
+ this.Data.YOffset=pos;
1062
+
1063
+ return true;
1064
+ }
1068
1065
  }
1069
1066
 
1070
1067
  function JSKeyboardFrame()
@@ -1074,14 +1071,14 @@ function JSKeyboardFrame()
1074
1071
 
1075
1072
  this.BorderLine=null; //1=上 2=下 4=左 8=右
1076
1073
 
1077
- this.BorderColor=g_JSChartResource.Report.BorderColor; //边框线
1074
+ this.BorderColor=g_JSChartResource.Keyboard.BorderColor; //边框线
1078
1075
 
1079
1076
  this.LogoTextColor=g_JSChartResource.FrameLogo.TextColor;
1080
1077
  this.LogoTextFont=g_JSChartResource.FrameLogo.Font;
1081
1078
 
1082
- this.ReloadResource=function(resource)
1079
+ this.ReloadResource=function(option)
1083
1080
  {
1084
- this.BorderColor=g_JSChartResource.Report.BorderColor; //边框线
1081
+ this.BorderColor=g_JSChartResource.Keyboard.BorderColor; //边框线
1085
1082
  this.LogoTextColor=g_JSChartResource.FrameLogo.TextColor;
1086
1083
  this.LogoTextFont=g_JSChartResource.FrameLogo.Font;
1087
1084
  }
@@ -1156,7 +1153,8 @@ var KEYBOARD_COLUMN_ID=
1156
1153
  SHORT_SYMBOL_ID:0, //不带后缀代码
1157
1154
  SYMBOL_ID:1,
1158
1155
  NAME_ID:2, //简称
1159
- TYPE_ID:3 //类型
1156
+ TYPE_ID:3, //类型
1157
+ TYPE_NAME_ID:4, //类型中文名字
1160
1158
  }
1161
1159
 
1162
1160
 
@@ -1177,10 +1175,12 @@ function ChartSymbolList()
1177
1175
  this.IsDrawBorder=false; //是否绘制单元格边框
1178
1176
 
1179
1177
  this.ShowSymbol=[]; //显示的股票列表 { Index:序号(排序用), Symbol:股票代码 }
1178
+
1179
+ this.VScrollbar; //竖向滚动条
1180
1180
 
1181
1181
  this.BorderColor=g_JSChartResource.Keyboard.BorderColor; //边框线
1182
1182
  this.SelectedColor=g_JSChartResource.Keyboard.SelectedColor; //选中行
1183
- this.TextColor=g_JSChartResource.Keyboard.TextColor; //文字颜色
1183
+ this.TextColor=g_JSChartResource.Keyboard.TextColor; //文字颜色
1184
1184
 
1185
1185
  //表格内容配置
1186
1186
  this.ItemFontConfig={ Size:g_JSChartResource.Keyboard.Item.Font.Size, Name:g_JSChartResource.Keyboard.Item.Font.Name };
@@ -1204,14 +1204,20 @@ function ChartSymbolList()
1204
1204
  [
1205
1205
  { Type:KEYBOARD_COLUMN_ID.SHORT_SYMBOL_ID, Title:"代码", TextAlign:"left", Width:null, MaxText:"888888" },
1206
1206
  { Type:KEYBOARD_COLUMN_ID.NAME_ID, Title:"名称", TextAlign:"left", Width:null, MaxText:"擎擎擎擎擎擎" },
1207
- { Type:KEYBOARD_COLUMN_ID.TYPE_ID, Title:"类型", TextAlign:"right", Width:null, MaxText:"擎擎擎擎" },
1207
+ //{ Type:KEYBOARD_COLUMN_ID.TYPE_ID, Title:"类型", TextAlign:"right", Width:null, MaxText:"擎擎擎擎" },
1208
+ { Type:KEYBOARD_COLUMN_ID.TYPE_NAME_ID, Title:"类型", TextAlign:"right", Width:null, MaxText:"擎擎擎擎" },
1209
+
1208
1210
  ];
1209
1211
 
1210
1212
  this.RectClient={ };
1211
1213
 
1212
1214
  this.ReloadResource=function(resource)
1213
1215
  {
1214
-
1216
+ this.BorderColor=g_JSChartResource.Keyboard.BorderColor; //边框线
1217
+ this.SelectedColor=g_JSChartResource.Keyboard.SelectedColor; //选中行
1218
+ this.TextColor=g_JSChartResource.Keyboard.TextColor; //文字颜色
1219
+
1220
+ if (this.VScrollbar) this.VScrollbar.ReloadResource(resource);
1215
1221
  }
1216
1222
 
1217
1223
  this.SetColumn=function(aryColumn)
@@ -1226,10 +1232,11 @@ function ChartSymbolList()
1226
1232
  if (this.SizeChange) this.CalculateSize();
1227
1233
  else this.UpdateCacheData();
1228
1234
 
1235
+ var bShowVScrollbar=this.IsShowVScrollbar();
1229
1236
  this.Canvas.save();
1230
1237
 
1231
1238
  this.Canvas.beginPath();
1232
- this.Canvas.rect(this.RectClient.Left,this.RectClient.Top,(this.RectClient.Right-this.RectClient.Left),(this.RectClient.Bottom-this.RectClient.Top));
1239
+ this.Canvas.rect(this.RectClient.Left,this.RectClient.Top+1,(this.RectClient.Right-this.RectClient.Left),(this.RectClient.Bottom-(this.RectClient.Top+1)));
1233
1240
  //this.Canvas.stroke(); //调试用
1234
1241
  this.Canvas.clip();
1235
1242
 
@@ -1238,6 +1245,12 @@ function ChartSymbolList()
1238
1245
 
1239
1246
  this.DrawBorder();
1240
1247
 
1248
+ if (this.VScrollbar && bShowVScrollbar)
1249
+ {
1250
+ var bottom=this.ChartBorder.GetBottom();
1251
+ this.VScrollbar.DrawScrollbar(this.RectClient.Left,this.RectClient.Top+2, this.RectClient.Right+this.VScrollbar.ButtonSize+2, bottom-2);
1252
+ }
1253
+
1241
1254
  this.SizeChange=false;
1242
1255
  }
1243
1256
 
@@ -1248,6 +1261,12 @@ function ChartSymbolList()
1248
1261
  this.RectClient.Right=this.ChartBorder.GetRight();
1249
1262
  this.RectClient.Top=this.ChartBorder.GetTop();
1250
1263
  this.RectClient.Bottom=this.ChartBorder.GetBottom();
1264
+
1265
+ var bShowVScrollbar=this.IsShowVScrollbar();
1266
+ if (bShowVScrollbar && this.VScrollbar && this.VScrollbar.Enable)
1267
+ {
1268
+ this.RectClient.Right-=(this.VScrollbar.ButtonSize+2);
1269
+ }
1251
1270
  }
1252
1271
 
1253
1272
  this.GetPageSize=function(recalculate) //recalculate 是否重新计算
@@ -1281,6 +1300,8 @@ function ChartSymbolList()
1281
1300
 
1282
1301
  this.CalculateSize=function() //计算大小
1283
1302
  {
1303
+ if (this.VScrollbar && this.VScrollbar.Enable) this.VScrollbar.CalculateSize();
1304
+
1284
1305
  this.UpdateCacheData();
1285
1306
 
1286
1307
  var pixelRatio=GetDevicePixelRatio();
@@ -1450,11 +1471,11 @@ function ChartSymbolList()
1450
1471
  if (stock.Color) drawInfo.TextColor=stock.Color;
1451
1472
  }
1452
1473
  }
1453
- else if (column.Type==KEYBOARD_COLUMN_ID.TYPE_ID)
1474
+ else if (column.Type==KEYBOARD_COLUMN_ID.TYPE_NAME_ID)
1454
1475
  {
1455
- if (stock && stock.Type)
1476
+ if (stock && stock.TypeName)
1456
1477
  {
1457
- drawInfo.Text=this.TextEllipsis(stock.Type, textWidth, column.MaxText);
1478
+ drawInfo.Text=this.TextEllipsis(stock.TypeName, textWidth, column.MaxText);
1458
1479
  if (stock.Color) drawInfo.TextColor=stock.Color;
1459
1480
  }
1460
1481
  }
@@ -1475,6 +1496,7 @@ function ChartSymbolList()
1475
1496
  else if (textAlign=='right')
1476
1497
  {
1477
1498
  x=left+width-2;
1499
+ if (left+width-2>this.RectClient.Right) x=this.RectClient.Right-2;
1478
1500
  this.Canvas.textAlign="right";
1479
1501
  }
1480
1502
  else
@@ -1529,6 +1551,12 @@ function ChartSymbolList()
1529
1551
  else
1530
1552
  var uiElement={Left:null, Top:null};
1531
1553
 
1554
+ if (this.VScrollbar)
1555
+ {
1556
+ var item=this.VScrollbar.OnMouseDown(x,y,e);
1557
+ if (item) return { Type:5, VScrollbar:item }; //右侧滚动条
1558
+ }
1559
+
1532
1560
  var row=this.PtInBody(x,y);
1533
1561
  if (row)
1534
1562
  {
@@ -1689,5 +1717,56 @@ function ChartSymbolList()
1689
1717
  event.Callback(event,data,this);
1690
1718
  }
1691
1719
  }
1720
+
1721
+ this.GetYScrollRange=function()
1722
+ {
1723
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return 0;
1724
+
1725
+ var maxOffset=this.Data.Data.length-this.RowCount;
1726
+
1727
+ return maxOffset;
1728
+ }
1729
+
1730
+ //大于1屏数据 显示滚动条
1731
+ this.IsShowVScrollbar=function()
1732
+ {
1733
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return false;
1734
+
1735
+ return this.Data.Data.length>this.RowCount;
1736
+ }
1737
+ }
1738
+
1739
+ //纵向滚动条
1740
+ function ChartKeyboardVScrollbar()
1741
+ {
1742
+ this.newMethod=ChartVScrollbar; //派生
1743
+ this.newMethod();
1744
+ delete this.newMethod;
1745
+
1746
+ this.ClassName='ChartKeyboardVScrollbar';
1747
+ this.Enable=true;
1748
+
1749
+ this.ScrollBarHeight=g_JSChartResource.Keyboard.VScrollbar.ScrollBarHeight;
1750
+ this.ButtonColor=g_JSChartResource.Keyboard.VScrollbar.ButtonColor;
1751
+ this.BarColor=g_JSChartResource.Keyboard.VScrollbar.BarColor;
1752
+ this.BorderColor=g_JSChartResource.Keyboard.VScrollbar.BorderColor;
1753
+ this.BGColor=g_JSChartResource.Keyboard.VScrollbar.BGColor;
1754
+ this.Mergin={ Left:2, Right:2, Top:2, Bottom:2 };
1755
+ this.BarWithConfig={ Size:g_JSChartResource.Keyboard.VScrollbar.BarWidth.Size };
1756
+
1757
+ this.ReloadResource=function(resource)
1758
+ {
1759
+ this.ScrollBarHeight=g_JSChartResource.Keyboard.VScrollbar.ScrollBarHeight;
1760
+ this.ButtonColor=g_JSChartResource.Keyboard.VScrollbar.ButtonColor;
1761
+ this.BarColor=g_JSChartResource.Keyboard.VScrollbar.BarColor;
1762
+ this.BorderColor=g_JSChartResource.Keyboard.VScrollbar.BorderColor;
1763
+ this.BGColor=g_JSChartResource.Keyboard.VScrollbar.BGColor;
1764
+ this.BarWithConfig={ Size:g_JSChartResource.Keyboard.VScrollbar.BarWidth.Size };
1765
+ }
1766
+
1767
+ this.IsShowCallback=function()
1768
+ {
1769
+ return true;
1770
+ }
1692
1771
  }
1693
1772
 
@@ -7773,7 +7773,7 @@ function ChartVScrollbar()
7773
7773
  this.ChartBorder; //边框信息
7774
7774
  this.ChartFrame; //框架画法
7775
7775
  this.Name; //名称
7776
- this.ClassName='ChartReportTab'; //类名
7776
+ this.ClassName='ChartVScrollbar'; //类名
7777
7777
  this.IsDrawFirst=false;
7778
7778
  this.GetEventCallback; //获取事件
7779
7779
  this.Report;
@@ -1554,7 +1554,7 @@ input[type="color"] {
1554
1554
  {
1555
1555
  position: absolute;
1556
1556
  width: 230px;
1557
- height:380px;
1557
+ height:360px;
1558
1558
  left: 1px;
1559
1559
  top: 1px;
1560
1560
  z-index: 999;
@@ -1574,25 +1574,38 @@ input[type="color"] {
1574
1574
  display: flex;
1575
1575
  cursor: default;
1576
1576
  user-select: none;
1577
- background-color:rgb(222,222,222)
1577
+ background-color:rgb(222,222,222);
1578
+
1579
+ }
1580
+ .jschart_keyboard_Close_Div
1581
+ {
1582
+ margin-left: auto;
1583
+ padding-right: 4px;
1584
+ cursor:pointer;
1585
+ }
1586
+
1587
+ .jschart_keyboard_Title
1588
+ {
1589
+ margin-left:2px;
1578
1590
  }
1579
1591
 
1580
1592
  .jschart_keyboard_Input_Div
1581
1593
  {
1582
1594
  display: flex;
1583
1595
  height:25px;
1584
-
1585
1596
  }
1586
1597
 
1587
1598
  .jschart_keyboard_input
1588
1599
  {
1589
1600
  width:100%;
1590
1601
  margin:2px;
1602
+ border: 1px solid rgb(192,192,192);
1591
1603
  }
1592
1604
 
1593
1605
  .jschart_keyboard_Chart_Div
1594
1606
  {
1595
- flex: 1
1607
+ flex: 1;
1608
+ margin:2px;
1596
1609
  }
1597
1610
 
1598
1611
 
@@ -884,7 +884,16 @@ HQData.Keyboard_RequestSymbolList=function(data, callback)
884
884
  shortSymbol=shortSymbol.replace(".sh", "");
885
885
  shortSymbol=shortSymbol.replace(".sz", "");
886
886
  var symbolItem={ Symbol:item[0], Name:item[1], ShortSymbol:shortSymbol, Spell:item[3], Type:item[2] };
887
- if (i%5==0) symbolItem.Color="rgb(255,0,0)";
887
+ if (symbolItem.Type=="EQA")
888
+ {
889
+ symbolItem.TypeName="股票";
890
+ }
891
+ else if (symbolItem.Type=="IDX")
892
+ {
893
+ symbolItem.TypeName="指数";
894
+ symbolItem.Color="rgb(30,144,255)";
895
+ }
896
+
888
897
  arySymbol.push(symbolItem);
889
898
  }
890
899