hqchart 1.1.14604 → 1.1.14611

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.
@@ -133474,14 +133474,6 @@ function JSReportChartContainer(uielement)
133474
133474
 
133475
133475
  this.Canvas=uielement.getContext("2d"); //画布
133476
133476
 
133477
- this.Tooltip=document.createElement("div");
133478
- this.Tooltip.className='jsreport-tooltip';
133479
- this.Tooltip.style.background=g_JSChartResource.TooltipBGColor;
133480
- this.Tooltip.style.opacity=g_JSChartResource.TooltipAlpha;
133481
- this.Tooltip.style["pointer-events"]="none";
133482
- this.Tooltip.id=Guid();
133483
- uielement.parentNode.appendChild(this.Tooltip);
133484
-
133485
133477
  this.Symbol; //板块代码
133486
133478
  this.Name; //板块名称
133487
133479
  this.NetworkFilter; //数据回调接口
@@ -135522,7 +135514,7 @@ function JSReportChartContainer(uielement)
135522
135514
 
135523
135515
  if (reportChart)
135524
135516
  {
135525
- var moveRow=reportChart.OnDrawgRow(x,y,e);
135517
+ var moveRow=reportChart.OnDragRow(x,y,e);
135526
135518
  if (moveRow )
135527
135519
  {
135528
135520
  if (moveRow.Type==2)
@@ -135595,6 +135587,8 @@ function JSReportChartContainer(uielement)
135595
135587
  var yMove=e.clientY-this.DragHeader.Click.Y;
135596
135588
  if ( Math.abs(yMove)<=1 && Math.abs(xMove)<=1) return;
135597
135589
 
135590
+ var reportChart=this.GetReportChart();
135591
+ var clickData=this.DragHeader.ClickData;
135598
135592
  this.DragHeader.LastMove.X=e.clientX;
135599
135593
  this.DragHeader.LastMove.Y=e.clientY;
135600
135594
  if (!this.DragHeader.MovePoint)
@@ -135607,8 +135601,17 @@ function JSReportChartContainer(uielement)
135607
135601
  this.DragHeader.MovePoint.Y=y;
135608
135602
  }
135609
135603
 
135610
- this.OnMoveDragHeader(x,y,e);
135611
- this.ShowDragHeaderTooltip(x,y,e);
135604
+ var moveData=reportChart.OnDragHeader(x,y,e);
135605
+ if (!moveData) return;
135606
+ if (moveData.Type!=1) return;
135607
+
135608
+ if (moveData.Header.Index!=clickData.Header.Index)
135609
+ {
135610
+ this.DragHeader.MoveToData=moveData;
135611
+ }
135612
+
135613
+ reportChart.DragHeader=this.DragHeader;
135614
+ this.Draw();
135612
135615
  }
135613
135616
  else if (this.DragColumnWidth && this.DragColumnWidth.ClickData) //列宽度拖拽
135614
135617
  {
@@ -135650,57 +135653,6 @@ function JSReportChartContainer(uielement)
135650
135653
  this.Draw();
135651
135654
  }
135652
135655
 
135653
- this.OnMoveDragHeader=function(x, y,e)
135654
- {
135655
- var chart=this.ChartPaint[0];
135656
- if (!chart) return;
135657
-
135658
- var clickData=this.DragHeader.ClickData;
135659
- this.DragHeader.MoveToData=null;
135660
-
135661
- if (!clickData.Header.IsFixed) //固定列不能拖
135662
- {
135663
- var yHeader=this.DragHeader.ClickPoint.Y;
135664
- var moveData=chart.OnMouseDown(x,yHeader,e);
135665
- if (!moveData || !moveData.Header) return;
135666
- if (moveData.Header.IsFixed) return;
135667
- if (moveData.Header.Index== clickData.Header.Index) return;
135668
-
135669
- this.DragHeader.MoveToData=moveData;
135670
- console.log(`[JSReportChartContainer::OnMoveDragHeader] Click[Index=${clickData.Header.Index}, Title=${clickData.Header.Column.Title}] => Move[Index=${moveData.Header.Index}, Title=${moveData.Header.Column.Title}]`);
135671
- }
135672
- }
135673
-
135674
- this.ShowDragHeaderTooltip=function(x,y,e)
135675
- {
135676
- if (!this.DragHeader) return;
135677
- var drag=this.DragHeader;
135678
- if (!drag.ClickData || !drag.MovePoint) return;
135679
-
135680
- var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_DRAG_HEADER_TOOLTIP);
135681
- if (event)
135682
- {
135683
- var sendData={ PreventDefault:false, e, X:x, Y:y, DragHeader:this.DragHeader, Tooltip:this.Tooltip };
135684
- event.Callback(event,sendData,this);
135685
- if (sendData.PreventDefault) return;
135686
- }
135687
-
135688
- var title=drag.ClickData.Header.Column.Title;
135689
- this.Tooltip.className='jchart-chartdrawsvg-tooltip'; //ChartDrawSVG指标数据
135690
- this.Tooltip.style.position = "absolute";
135691
- this.Tooltip.style.left = e.clientX + "px";
135692
- this.Tooltip.style.top = e.clientY+ "px";
135693
- this.Tooltip.style.width = 100+"px";
135694
- this.Tooltip.style.height =null;
135695
- this.Tooltip.innerHTML=title;
135696
- this.Tooltip.style.display = "block";
135697
- }
135698
-
135699
- this.HideTooltip=function()
135700
- {
135701
- if (this.Tooltip.style.display!="none") this.Tooltip.style.display = "none";
135702
- }
135703
-
135704
135656
  this.DocOnMouseUp=function(e)
135705
135657
  {
135706
135658
  //清空事件
@@ -135737,6 +135689,12 @@ function JSReportChartContainer(uielement)
135737
135689
  this.DragMove=null;
135738
135690
  this.DragColumnWidth=null;
135739
135691
 
135692
+ if (reportChart.DragHeader)
135693
+ {
135694
+ bRedraw=true;
135695
+ reportChart.DragHeader=null;
135696
+ }
135697
+
135740
135698
  if (bRedraw) this.Draw();
135741
135699
 
135742
135700
  if (dragHeader)
@@ -137821,6 +137779,7 @@ function ChartReport()
137821
137779
 
137822
137780
  this.ShowSymbol=[]; //显示的股票列表 { Index:序号(排序用), Symbol:股票代码 }
137823
137781
  this.DragRow; //拖拽行
137782
+ this.DragHeader; //拖拽表头
137824
137783
 
137825
137784
  this.Tab;
137826
137785
  this.VScrollbar;
@@ -138028,6 +137987,11 @@ function ChartReport()
138028
137987
  Bottom:g_JSChartResource.Report.LimitBorder.Mergin.Bottom
138029
137988
  }
138030
137989
 
137990
+ this.DragRowColor=g_JSChartResource.Report.DragRow.Color;
137991
+ this.DragRowTextColor=g_JSChartResource.Report.DragRow.TextColor;
137992
+ this.DragMoveRowColor=g_JSChartResource.Report.DragRow.MoveRowColor;
137993
+ this.DragSrcRowColor=g_JSChartResource.Report.DragRow.SrcRowColor;
137994
+
138031
137995
  //排序图标
138032
137996
  this.SortConfig=
138033
137997
  {
@@ -138447,6 +138411,7 @@ function ChartReport()
138447
138411
 
138448
138412
  this.ClipClient();
138449
138413
 
138414
+ this.DrawDragHeaderBG();
138450
138415
  this.DrawHeader();
138451
138416
  this.DrawBody();
138452
138417
  this.Canvas.restore();
@@ -138464,6 +138429,8 @@ function ChartReport()
138464
138429
 
138465
138430
  this.DrawDragRow();
138466
138431
 
138432
+ this.DrawDragHeader();
138433
+
138467
138434
  if (this.VScrollbar)
138468
138435
  {
138469
138436
  var bottom=this.ChartBorder.GetBottom();
@@ -138474,6 +138441,60 @@ function ChartReport()
138474
138441
  this.SizeChange=false;
138475
138442
  }
138476
138443
 
138444
+ this.DrawDragHeaderBG=function()
138445
+ {
138446
+ if (!this.DragHeader) return;
138447
+
138448
+ var left=this.RectClient.Left;
138449
+ var right=this.RectClient.Right;
138450
+ var top=this.RectClient.Top;
138451
+ var bottom=top+this.HeaderHeight+this.RowHeight*this.RowCount+this.FixedRowHeight*this.FixedRowCount;
138452
+
138453
+ //竖线
138454
+ var columnLeft=left;
138455
+ for(var i=0;i<this.FixedColumn && i<this.Column.length; ++i)
138456
+ {
138457
+ var item=this.Column[i];
138458
+ columnLeft+=item.Width;
138459
+ }
138460
+
138461
+ for(var i=this.FixedColumn+this.Data.XOffset;i<this.Column.length;++i)
138462
+ {
138463
+ var item=this.Column[i];
138464
+
138465
+ if (this.DragHeader)
138466
+ {
138467
+ if (this.DragHeader.ClickData)
138468
+ {
138469
+ var clickData=this.DragHeader.ClickData;
138470
+ if (clickData.Header.Index==i)
138471
+ {
138472
+ var rtBG={ Left:columnLeft,Top:top, Bottom:bottom, Right:columnLeft+item.Width };
138473
+ rtBG.Width=rtBG.Right-rtBG.Left;
138474
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
138475
+ this.Canvas.fillStyle=this.DragSrcRowColor;
138476
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
138477
+ }
138478
+ }
138479
+
138480
+ if (this.DragHeader.MoveToData)
138481
+ {
138482
+ var moveToData=this.DragHeader.MoveToData;
138483
+ if (moveToData.Header.Index==i)
138484
+ {
138485
+ var rtBG={ Left:columnLeft,Top:top, Bottom:bottom, Right:columnLeft+item.Width };
138486
+ rtBG.Width=rtBG.Right-rtBG.Left;
138487
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
138488
+ this.Canvas.fillStyle=this.DragMoveRowColor;
138489
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
138490
+ }
138491
+ }
138492
+ }
138493
+
138494
+ columnLeft+=item.Width;
138495
+ }
138496
+ }
138497
+
138477
138498
  //更新缓存变量
138478
138499
  this.UpdateCacheData=function()
138479
138500
  {
@@ -138635,7 +138656,8 @@ function ChartReport()
138635
138656
  if (!item.Title || item.Title.length<=0) continue;
138636
138657
  var text=item.Title;
138637
138658
  itemWidth=this.Canvas.measureText(text).width;
138638
- if (item.Sort>0) itemWidth+this.SortConfig.Size*pixelRatio;
138659
+ if (item.Sort>0) itemWidth+=this.SortConfig.Size*pixelRatio;
138660
+
138639
138661
  itemWidth+=(4+this.HeaderMergin.Left+this.HeaderMergin.Right);
138640
138662
  if (item.Width<itemWidth) item.Width=itemWidth;
138641
138663
  }
@@ -138667,7 +138689,7 @@ function ChartReport()
138667
138689
  this.IsShowAllColumn=(subWidth<reportWidth);
138668
138690
  }
138669
138691
 
138670
- this.DrawHeaderItem=function(column, rtCell, index)
138692
+ this.DrawHeaderItem=function(column, rtCell, index, option)
138671
138693
  {
138672
138694
  if (column.HeaderBGColor) //背景色
138673
138695
  {
@@ -138711,12 +138733,18 @@ function ChartReport()
138711
138733
  //图标
138712
138734
  if (column.Icon) lastItem.Icon=column.Icon;
138713
138735
 
138736
+ if (option)
138737
+ {
138738
+ if (option.HeaderColor) drawInfo.HeaderColor=option.HeaderColor;
138739
+ }
138740
+
138714
138741
  this.DrawHeaderText(column, drawInfo);
138715
138742
  }
138716
138743
 
138717
138744
  this.DrawHeaderText=function(column, drawInfo)
138718
138745
  {
138719
- if (column.HeaderColor) this.Canvas.fillStyle=column.HeaderColor;
138746
+ if (drawInfo.HeaderColor) this.Canvas.fillStyle=drawInfo.HeaderColor;
138747
+ else if (column.HeaderColor) this.Canvas.fillStyle=column.HeaderColor;
138720
138748
  else this.Canvas.fillStyle=this.HeaderColor;
138721
138749
 
138722
138750
  var pixelRatio=GetDevicePixelRatio();
@@ -141423,7 +141451,7 @@ function ChartReport()
141423
141451
 
141424
141452
  }
141425
141453
 
141426
- this.OnDrawgRow=function(x, y, e) //Type: 5=顶部 6=空白行 2=行 7=底部
141454
+ this.OnDragRow=function(x, y, e) //Type: 5=顶部 6=空白行 2=行 7=底部
141427
141455
  {
141428
141456
  if (!this.Data) return null;
141429
141457
  if (!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return null;
@@ -141459,6 +141487,26 @@ function ChartReport()
141459
141487
  return { Type:7 };
141460
141488
  }
141461
141489
 
141490
+ this.OnDragHeader=function(x,y,e) //Type:1=行 2=左边 3=右边 4=空白 5=固定行
141491
+ {
141492
+ if (!this.IsShowHeader) return null;
141493
+
141494
+ var left=this.RectClient.Left;
141495
+ var right=this.RectClient.Right;
141496
+ var top=this.RectClient.Top;
141497
+ var bottom=top+this.HeaderHeight;
141498
+
141499
+ if (x<left) return { Type:2 };
141500
+ else if (x>right) return { Type:3 };
141501
+
141502
+ var cell=this.PtInItem(x,top+2,top,bottom);
141503
+ if (!cell) return { Type:4 };
141504
+
141505
+ if (cell.IsFixed) return { Type:5 }
141506
+
141507
+ return { Type:1, Header:cell };
141508
+ }
141509
+
141462
141510
  this.OnClickButton=function(x, y, e, status)
141463
141511
  {
141464
141512
  if (e.button!=0) return false;
@@ -141727,6 +141775,47 @@ function ChartReport()
141727
141775
 
141728
141776
  }
141729
141777
 
141778
+ this.DrawDragHeader=function()
141779
+ {
141780
+ if (!this.DragHeader) return;
141781
+ var drag=this.DragHeader;
141782
+ var clickData=drag.ClickData;
141783
+ var rtHeader=clickData.Header.Rect;
141784
+ var headerWidth=rtHeader.Right-rtHeader.Left;
141785
+ var rtRow={ Left:drag.LastMove.X-headerWidth/2, Top:this.RectClient.Top, Width:headerWidth };
141786
+ rtRow.Bottom=rtRow.Top+this.HeaderHeight+this.RowHeight*this.RowCount+this.FixedRowHeight*this.FixedRowCount;
141787
+ rtRow.Right=rtRow.Left+rtRow.Width;
141788
+ rtRow.Height=rtRow.Bottom-rtRow.Top;
141789
+
141790
+ //背景
141791
+ this.Canvas.fillStyle=this.DragRowColor;
141792
+ this.Canvas.fillRect(rtRow.Left, rtRow.Top, rtRow.Width, rtRow.Height);
141793
+
141794
+ //文字
141795
+ var cellHeader={ Left:rtRow.Left, Top:rtRow.Top, Right:rtRow.Right, Width:rtRow.Width, Height:this.HeaderHeight };
141796
+ cellHeader.Bottom=cellHeader.Top+cellHeader.Height;
141797
+ this.DrawHeaderItem(clickData.Header.Column, cellHeader, clickData.Header.Index, { HeaderColor:this.DragRowTextColor });
141798
+
141799
+ var textTop=cellHeader.Bottom+this.FixedRowHeight*this.FixedRowCount;
141800
+ this.Canvas.font=this.ItemFont;
141801
+ var dataCount=this.GetAllRowCount();
141802
+ for(var i=this.Data.YOffset, j=0; i<dataCount && j<this.RowCount ;++i, ++j)
141803
+ {
141804
+ var symbol=this.Data.Data[i];
141805
+
141806
+ var data= { Symbol:symbol , Stock:null, Block:null };
141807
+ if (this.GetStockDataCallback) data.Stock=this.GetStockDataCallback(symbol);
141808
+ if (this.GetBlockDataCallback) data.Block=this.GetBlockDataCallback(symbol);
141809
+ if (this.GetFlashBGDataCallback) data.FlashBG=this.GetFlashBGDataCallback(symbol, Date.now());
141810
+ data.Decimal=GetfloatPrecision(symbol); //小数位数
141811
+
141812
+ var item=this.Column[clickData.Header.Index];
141813
+ this.DrawItem(i, data, item, cellHeader.Left, textTop, 3);
141814
+
141815
+ textTop+=this.RowHeight;
141816
+ }
141817
+ }
141818
+
141730
141819
  this.GetTooltipData=function(x,y)
141731
141820
  {
141732
141821
  if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipRect)) return null;
@@ -151933,10 +152022,13 @@ function JSPopKeyboard()
151933
152022
  this.Destroy=function()
151934
152023
  {
151935
152024
  if (this.DivDialog) document.body.removeChild(this.DivDialog);
152025
+
151936
152026
  this.DivDialog=null;
151937
152027
  this.TitleBox=null;
151938
152028
  if (!this.Keyboard.JSChart) this.Keyboard.JSChart.ChartDestory();
151939
152029
  this.Keyboard.JSChart=null;
152030
+
152031
+ window.removeEventListener('mousedown', (e)=>{ this.OnWindowMouseDown(e)}); //注销监听
151940
152032
  }
151941
152033
 
151942
152034
  this.Create=function()
@@ -156652,7 +156744,7 @@ function HQChartScriptWorker()
156652
156744
 
156653
156745
 
156654
156746
 
156655
- var HQCHART_VERSION="1.1.14603";
156747
+ var HQCHART_VERSION="1.1.14610";
156656
156748
 
156657
156749
  function PrintHQChartVersion()
156658
156750
  {