hqchart 1.1.14632 → 1.1.14639
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 +25 -193
- package/package.json +1 -1
- package/src/jscommon/umychart.DialogTooltip.js +10 -0
- package/src/jscommon/umychart.NetworkFilterTest.js +112 -0
- package/src/jscommon/umychart.complier.js +4 -0
- package/src/jscommon/umychart.js +97 -187
- package/src/jscommon/umychart.testdata.js +112 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +102 -188
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.NetworkFilterTest.vue.js +112 -0
- package/src/jscommon/umychart.vue/umychart.vue.js +112 -188
|
@@ -57529,6 +57529,8 @@ HQData.Report_APIIndex=function(data, callback)
|
|
|
57529
57529
|
HQData.APIIndex_TITLE(data, callback);
|
|
57530
57530
|
else if (request.Data.indexname=="API_SCATTER_PLOT_V2")
|
|
57531
57531
|
HQData.APIIndex_SCATTER_PLOT_V2(data, callback);
|
|
57532
|
+
else if (request.Data.indexname=="API_KLINE_TABLE")
|
|
57533
|
+
HQData.APIIndex_KLINE_TABLE(data, callback);
|
|
57532
57534
|
}
|
|
57533
57535
|
|
|
57534
57536
|
|
|
@@ -58590,6 +58592,116 @@ HQData.APIIndex_SCATTER_PLOT_V2=function(data, callback)
|
|
|
58590
58592
|
callback(apiData);
|
|
58591
58593
|
}
|
|
58592
58594
|
|
|
58595
|
+
HQData.APIIndex_KLINE_TABLE=function(data, callback)
|
|
58596
|
+
{
|
|
58597
|
+
data.PreventDefault=true;
|
|
58598
|
+
var hqchart=data.HQChart;
|
|
58599
|
+
var kData=data.HQChart.GetKData(); //hqchart图形的分钟数据
|
|
58600
|
+
|
|
58601
|
+
var tableData=
|
|
58602
|
+
{
|
|
58603
|
+
name:'KLINE_TABLE', type:1,
|
|
58604
|
+
Draw:
|
|
58605
|
+
{
|
|
58606
|
+
DrawType:'KLINE_TABLE',
|
|
58607
|
+
DrawData:[ ] , //数据 [ [ { Text, Color: BGColor }, ...... ], [],]
|
|
58608
|
+
RowCount:4,
|
|
58609
|
+
RowName:[ {Name:"账户1",TextAlign:"center"}, {Name:"账户2",TextAlign:"center"}, {Name:"账户3",TextAlign:"center"},{Name:"账户4", TextAlign:"center"}],
|
|
58610
|
+
|
|
58611
|
+
Config:
|
|
58612
|
+
{
|
|
58613
|
+
BGColor:"rgb(0,0,0)",
|
|
58614
|
+
BorderColor:"rgb(220,220,220)",
|
|
58615
|
+
TextColor:"rgb(250,250,250)",
|
|
58616
|
+
ItemMergin:{ Left:2, Right:2, Top:4, Bottom:4, YOffset:3 },
|
|
58617
|
+
RowNamePosition:3,
|
|
58618
|
+
TextFont:{ Family:'微软雅黑' , FontMaxSize:14*GetDevicePixelRatio(), },
|
|
58619
|
+
RowHeightType:1,
|
|
58620
|
+
}
|
|
58621
|
+
},
|
|
58622
|
+
|
|
58623
|
+
};
|
|
58624
|
+
|
|
58625
|
+
var ACCOUNT_TEST_DATA=
|
|
58626
|
+
[
|
|
58627
|
+
{ Name:"账户1", DayCount:5, OperatorID:0 },
|
|
58628
|
+
{ Name:"账户2", DayCount:10, OperatorID:0 },
|
|
58629
|
+
{ Name:"账户3", DayCount:4, OperatorID:0 },
|
|
58630
|
+
{ Name:"账户4", DayCount:8, OperatorID:0 },
|
|
58631
|
+
]
|
|
58632
|
+
|
|
58633
|
+
for(var i=0;i<kData.Data.length;++i)
|
|
58634
|
+
{
|
|
58635
|
+
var kItem=kData.Data[i];
|
|
58636
|
+
|
|
58637
|
+
//一列数据
|
|
58638
|
+
var colItem={ Date:kItem.Date, Time:kItem.Time, Data:[ ] };
|
|
58639
|
+
|
|
58640
|
+
for(var j=0;j<ACCOUNT_TEST_DATA.length;++j)
|
|
58641
|
+
{
|
|
58642
|
+
var accountItem=ACCOUNT_TEST_DATA[j];
|
|
58643
|
+
if (i%accountItem.DayCount==0)
|
|
58644
|
+
{
|
|
58645
|
+
accountItem.OperatorID++;
|
|
58646
|
+
if (accountItem.OperatorID>=3) accountItem.OperatorID=0;
|
|
58647
|
+
|
|
58648
|
+
if (accountItem.OperatorID==1)
|
|
58649
|
+
{
|
|
58650
|
+
colItem.Data[j]=
|
|
58651
|
+
{
|
|
58652
|
+
Text:"买", Color:"rgb(250,250,250)", BGColor:'rgb(250,0,0)', TextAlign:"center",
|
|
58653
|
+
Tooltip:
|
|
58654
|
+
{
|
|
58655
|
+
AryText:
|
|
58656
|
+
[
|
|
58657
|
+
{Title:"日期", Text:`${kItem.Date}`},
|
|
58658
|
+
{Title:"买入价", Text:`${kItem.Close.toFixed(2)}`, TextColor:"rgb(250,0,0)"},
|
|
58659
|
+
{Title:"数量", Text:`${HQData.GetRandomTestData(100,400).toFixed(0)}`,TextColor:"rgb(255,165,0)" },
|
|
58660
|
+
]
|
|
58661
|
+
}
|
|
58662
|
+
};
|
|
58663
|
+
}
|
|
58664
|
+
else if (accountItem.OperatorID==2)
|
|
58665
|
+
{
|
|
58666
|
+
colItem.Data[j]=
|
|
58667
|
+
{
|
|
58668
|
+
Text:"卖", Color:"rgb(250,250,250)", BGColor:'rgb(34,139,34)', TextAlign:"center",
|
|
58669
|
+
Tooltip:
|
|
58670
|
+
{
|
|
58671
|
+
AryText:
|
|
58672
|
+
[
|
|
58673
|
+
{Title:"日期", Text:`${kItem.Date}`},
|
|
58674
|
+
{Title:"卖入价", Text:`${kItem.Close.toFixed(2)}`, TextColor:"rgb(34,139,34)"},
|
|
58675
|
+
{Title:"数量", Text:`${HQData.GetRandomTestData(100,400).toFixed(0)}`,TextColor:"rgb(255,165,0)" },
|
|
58676
|
+
]
|
|
58677
|
+
}
|
|
58678
|
+
};
|
|
58679
|
+
}
|
|
58680
|
+
|
|
58681
|
+
}
|
|
58682
|
+
else
|
|
58683
|
+
{
|
|
58684
|
+
if (accountItem.OperatorID==0) continue; //空闲
|
|
58685
|
+
|
|
58686
|
+
if (accountItem.OperatorID==1)
|
|
58687
|
+
colItem.Data[j]= {Text:"持", Color:"rgb(250,250,250)", BGColor:'rgb(255,140,0)',TextAlign:"center"};
|
|
58688
|
+
}
|
|
58689
|
+
}
|
|
58690
|
+
|
|
58691
|
+
tableData.Draw.DrawData.push(colItem);
|
|
58692
|
+
}
|
|
58693
|
+
|
|
58694
|
+
var apiData=
|
|
58695
|
+
{
|
|
58696
|
+
code:0,
|
|
58697
|
+
stock:{ name:hqchart.Name, symbol:hqchart.Symbol },
|
|
58698
|
+
outdata: { date:kData.GetDate(), time:kData.GetTime(), outvar:[tableData] }
|
|
58699
|
+
};
|
|
58700
|
+
|
|
58701
|
+
console.log('[KLineChart::APIIndex_KLINE_TABLE] apiData ', apiData);
|
|
58702
|
+
callback(apiData);
|
|
58703
|
+
}
|
|
58704
|
+
|
|
58593
58705
|
|
|
58594
58706
|
HQData.RequestVolumeProfileData=function(data, callback)
|
|
58595
58707
|
{
|
|
@@ -22173,6 +22173,7 @@ function ScriptIndex(name,script,args,option)
|
|
|
22173
22173
|
chart.Data=hqChart.GetKData()
|
|
22174
22174
|
if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.EnableTooltip)) chart.EnableTooltip=varItem.Draw.DrawData.EnableTooltip;
|
|
22175
22175
|
if (IFrameSplitOperator.IsBool(varItem.Draw.DrawData.IsDrawFirst)) chart.IsDrawFirst=varItem.Draw.DrawData.IsDrawFirst;
|
|
22176
|
+
if (IFrameSplitOperator.IsBool(varItem.Draw.EnalbeDetailOnVerlap)) chart.EnalbeDetailOnVerlap=varItem.Draw.EnalbeDetailOnVerlap;
|
|
22176
22177
|
if (varItem.Draw.BuildKeyCallback) chart.BuildKeyCallback=varItem.Draw.BuildKeyCallback;
|
|
22177
22178
|
chart.Family=varItem.Draw.DrawData.Family;
|
|
22178
22179
|
chart.TextFont=varItem.Draw.DrawData.TextFont;
|
|
@@ -22243,6 +22244,7 @@ function ScriptIndex(name,script,args,option)
|
|
|
22243
22244
|
if (config.TextColor) chart.TextColor=config.TextColor;
|
|
22244
22245
|
if (config.BorderColor) chart.BorderColor=config.BorderColor;
|
|
22245
22246
|
if (IFrameSplitOperator.IsNumber(config.RowNamePosition)) chart.RowNamePosition=config.RowNamePosition;
|
|
22247
|
+
if (IFrameSplitOperator.IsNumber(config.RowHeightType)) chart.RowHeightType=config.RowHeightType;
|
|
22246
22248
|
|
|
22247
22249
|
if (config.ItemMergin)
|
|
22248
22250
|
{
|
|
@@ -24083,6 +24085,7 @@ function OverlayScriptIndex(name,script,args,option)
|
|
|
24083
24085
|
chart.TextFont=varItem.Draw.DrawData.TextFont;
|
|
24084
24086
|
chart.Texts= varItem.Draw.DrawData.Data;
|
|
24085
24087
|
if (varItem.Draw.AutoPosition) chart.AutoPosition=varItem.Draw.AutoPosition;
|
|
24088
|
+
if (IFrameSplitOperator.IsBool(varItem.Draw.EnalbeDetailOnVerlap)) chart.EnalbeDetailOnVerlap=varItem.Draw.EnalbeDetailOnVerlap;
|
|
24086
24089
|
|
|
24087
24090
|
this.ReloadChartResource(hqChart, windowIndex, chart);
|
|
24088
24091
|
|
|
@@ -25289,6 +25292,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
|
|
|
25289
25292
|
drawItem.Name=draw.Name;
|
|
25290
25293
|
drawItem.DrawType=draw.DrawType;
|
|
25291
25294
|
if (draw.AutoPosition) drawItem.AutoPosition=draw.AutoPosition;
|
|
25295
|
+
drawItem.EnalbeDetailOnVerlap=draw.EnalbeDetailOnVerlap;
|
|
25292
25296
|
if (draw.BuildKeyCallback) drawItem.BuildKeyCallback=draw.BuildKeyCallback;
|
|
25293
25297
|
drawItem.DrawData={ Data:draw.Data, Family:draw.Family, TextFont:draw.TextFont, EnableTooltip:draw.EnableTooltip, IsDrawFirst:draw.IsDrawFirst };
|
|
25294
25298
|
outVarItem.Draw=drawItem;
|
package/src/jscommon/umychart.js
CHANGED
|
@@ -8052,6 +8052,15 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
8052
8052
|
return;
|
|
8053
8053
|
}
|
|
8054
8054
|
}
|
|
8055
|
+
else if (toolTip.Type==9) //ChartKLineTable
|
|
8056
|
+
{
|
|
8057
|
+
if (toolTip.Data.Item && toolTip.Data.Item.Tooltip && this.FloatTooltip)
|
|
8058
|
+
{
|
|
8059
|
+
this.DrawFloatTooltip({X:x, Y:y, YMove:20/pixelTatio}, toolTip);
|
|
8060
|
+
bHideFloatToolip=false;
|
|
8061
|
+
return;
|
|
8062
|
+
}
|
|
8063
|
+
}
|
|
8055
8064
|
|
|
8056
8065
|
|
|
8057
8066
|
if (bHideFloatToolip) this.HideFloatTooltip();
|
|
@@ -32613,6 +32622,7 @@ function ChartKLineTable()
|
|
|
32613
32622
|
this.AryTableData=[];
|
|
32614
32623
|
this.MapCache=null; //key=date/date-time value={ Date:, Time:, Data:[ ] }
|
|
32615
32624
|
this.GetKValue=ChartData.GetKValue;
|
|
32625
|
+
this.AryCellRect=[]; //保存单元格信息
|
|
32616
32626
|
|
|
32617
32627
|
this.BuildCacheData=function()
|
|
32618
32628
|
{
|
|
@@ -32672,6 +32682,7 @@ function ChartKLineTable()
|
|
|
32672
32682
|
|
|
32673
32683
|
this.Draw=function()
|
|
32674
32684
|
{
|
|
32685
|
+
this.AryCellRect=[];
|
|
32675
32686
|
if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
32676
32687
|
if (this.IsShowIndexTitleOnly()) return;
|
|
32677
32688
|
if (this.IsHideScriptIndex()) return;
|
|
@@ -32785,7 +32796,7 @@ function ChartKLineTable()
|
|
|
32785
32796
|
|
|
32786
32797
|
if (this.BGColor)
|
|
32787
32798
|
{
|
|
32788
|
-
var rtRightBG={Left:border.RightEx, Top:border.
|
|
32799
|
+
var rtRightBG={Left:border.RightEx, Top:border.Top, Right:border.ChartWidth, Bottom:border.Bottom };
|
|
32789
32800
|
rtRightBG.Width=rtRightBG.Right-rtRightBG.Left;
|
|
32790
32801
|
rtRightBG.Height=rtRightBG.Bottom-rtRightBG.Top;
|
|
32791
32802
|
this.Canvas.fillStyle=this.BGColor;
|
|
@@ -32826,9 +32837,11 @@ function ChartKLineTable()
|
|
|
32826
32837
|
var x=left,y=top, width=right-left;
|
|
32827
32838
|
var yOffset=3;
|
|
32828
32839
|
if (this.ItemMergin.YOffset) yOffset=this.ItemMergin.YOffset;
|
|
32829
|
-
for(var i=0;i<data.Data.length
|
|
32840
|
+
for(var i=0; i<data.Data.length; ++i, y+=this.RowHeight)
|
|
32830
32841
|
{
|
|
32831
32842
|
var item=data.Data[i];
|
|
32843
|
+
if (!item) continue;
|
|
32844
|
+
|
|
32832
32845
|
var rtBG={Left:x, Top:y, Right:right, Height:this.RowHeight, Width:width };
|
|
32833
32846
|
rtBG.Bottom=rtBG.Top+this.RowHeight;
|
|
32834
32847
|
|
|
@@ -32873,20 +32886,27 @@ function ChartKLineTable()
|
|
|
32873
32886
|
}
|
|
32874
32887
|
}
|
|
32875
32888
|
|
|
32889
|
+
if (rtBG.Width>5)
|
|
32890
|
+
{
|
|
32891
|
+
this.AryCellRect.push({ Item:{ Cell:item, Colunm:data, RowIndex:i, SubCell:subItem, SubIndex:j, Tooltip:subItem.Tooltip, Type:2 }, Rect:rtSubBG });
|
|
32892
|
+
}
|
|
32893
|
+
|
|
32876
32894
|
xCell+=subCellWidth;
|
|
32877
32895
|
}
|
|
32878
32896
|
}
|
|
32879
32897
|
else
|
|
32880
32898
|
{
|
|
32881
|
-
if (item
|
|
32899
|
+
if (item.BGColor)
|
|
32882
32900
|
{
|
|
32883
32901
|
this.Canvas.fillStyle=item.BGColor;
|
|
32884
32902
|
this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
|
|
32885
32903
|
}
|
|
32886
32904
|
|
|
32887
|
-
if (item
|
|
32905
|
+
if (item.Text && rtBG.Width>10)
|
|
32888
32906
|
{
|
|
32889
|
-
this.Canvas.fillStyle=item.Color;
|
|
32907
|
+
if (item.Color) this.Canvas.fillStyle=item.Color;
|
|
32908
|
+
else this.Canvas.fillStyle=this.TextColor;
|
|
32909
|
+
|
|
32890
32910
|
this.Canvas.textBaseline='bottom';
|
|
32891
32911
|
var yText=rtBG.Bottom-yOffset;
|
|
32892
32912
|
|
|
@@ -32906,9 +32926,14 @@ function ChartKLineTable()
|
|
|
32906
32926
|
this.Canvas.fillText(item.Text,rtBG.Left+2,yText, width-4);
|
|
32907
32927
|
}
|
|
32908
32928
|
}
|
|
32929
|
+
|
|
32930
|
+
if (rtBG.Width>5)
|
|
32931
|
+
{
|
|
32932
|
+
this.AryCellRect.push({ Item:{ Cell:item, Colunm:data, RowIndex:i, Tooltip:item.Tooltip, Type:1 }, Rect:rtBG });
|
|
32933
|
+
}
|
|
32909
32934
|
}
|
|
32910
32935
|
|
|
32911
|
-
|
|
32936
|
+
|
|
32912
32937
|
}
|
|
32913
32938
|
}
|
|
32914
32939
|
|
|
@@ -32942,6 +32967,30 @@ function ChartKLineTable()
|
|
|
32942
32967
|
{
|
|
32943
32968
|
return {Min:0, Max:this.RowCount};
|
|
32944
32969
|
}
|
|
32970
|
+
|
|
32971
|
+
this.GetTooltipData=function(x,y,tooltip)
|
|
32972
|
+
{
|
|
32973
|
+
if (!this.IsShow) return false;
|
|
32974
|
+
|
|
32975
|
+
for(var i=0;i<this.AryCellRect.length;++i)
|
|
32976
|
+
{
|
|
32977
|
+
var item=this.AryCellRect[i];
|
|
32978
|
+
if (!item.Rect) continue;
|
|
32979
|
+
|
|
32980
|
+
var rect=item.Rect;
|
|
32981
|
+
if (x>=rect.Left && x<=rect.Right && y>=rect.Top && y<=rect.Bottom)
|
|
32982
|
+
{
|
|
32983
|
+
var data=item.Item;
|
|
32984
|
+
JSConsole.Chart.Log('[ChartKLineTable::GetTooltipData] cell', item);
|
|
32985
|
+
tooltip.Data={ Rect:item.Rect, Item:data };
|
|
32986
|
+
tooltip.ChartPaint=this;
|
|
32987
|
+
tooltip.Type=9; //ChartKLineTable
|
|
32988
|
+
return true;
|
|
32989
|
+
}
|
|
32990
|
+
}
|
|
32991
|
+
|
|
32992
|
+
return false;
|
|
32993
|
+
}
|
|
32945
32994
|
}
|
|
32946
32995
|
|
|
32947
32996
|
//表格
|
|
@@ -34769,7 +34818,7 @@ function ChartArea()
|
|
|
34769
34818
|
}
|
|
34770
34819
|
}
|
|
34771
34820
|
|
|
34772
|
-
//散点图
|
|
34821
|
+
//散点图 建议使用新版本 ChartScatterPlotV2
|
|
34773
34822
|
function ChartScatterPlot()
|
|
34774
34823
|
{
|
|
34775
34824
|
this.newMethod=IChartPainting; //派生
|
|
@@ -34974,7 +35023,7 @@ function ChartScatterPlot()
|
|
|
34974
35023
|
|
|
34975
35024
|
}
|
|
34976
35025
|
|
|
34977
|
-
//散点图
|
|
35026
|
+
//散点图 2.0
|
|
34978
35027
|
function ChartScatterPlotV2()
|
|
34979
35028
|
{
|
|
34980
35029
|
this.newMethod=IChartPainting; //派生
|
|
@@ -43951,6 +44000,9 @@ function ChartDrawSVG()
|
|
|
43951
44000
|
this.BuildKeyCallback=null;
|
|
43952
44001
|
this.MapCache=null; //key=date/date-time value={ Data:[] }
|
|
43953
44002
|
|
|
44003
|
+
this.AryDrawDetail=[]; //需要绘制的文字信息
|
|
44004
|
+
this.EnalbeDetailOnVerlap=false; //详情重叠不显示
|
|
44005
|
+
|
|
43954
44006
|
this.BuildKey=function(item)
|
|
43955
44007
|
{
|
|
43956
44008
|
if (this.BuildKeyCallback) return this.BuildKeyCallback(item);
|
|
@@ -43985,6 +44037,7 @@ function ChartDrawSVG()
|
|
|
43985
44037
|
{
|
|
43986
44038
|
this.TooltipRect=[];
|
|
43987
44039
|
this.AryDrawRect=[];
|
|
44040
|
+
this.AryDrawDetail=[];
|
|
43988
44041
|
this.AutoYOffset=0;
|
|
43989
44042
|
|
|
43990
44043
|
if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
@@ -43993,6 +44046,10 @@ function ChartDrawSVG()
|
|
|
43993
44046
|
if (!this.MapCache || this.MapCache.size<=0) return;
|
|
43994
44047
|
|
|
43995
44048
|
this.DrawSVGV2();
|
|
44049
|
+
|
|
44050
|
+
if (this.EnalbeDetailOnVerlap) this.DrawOnVerlapDetail();
|
|
44051
|
+
|
|
44052
|
+
this.AryDrawDetail=[];
|
|
43996
44053
|
}
|
|
43997
44054
|
|
|
43998
44055
|
this.DrawDetail=function(rtSVG, data, svgItem)
|
|
@@ -44059,6 +44116,21 @@ function ChartDrawSVG()
|
|
|
44059
44116
|
}
|
|
44060
44117
|
}
|
|
44061
44118
|
|
|
44119
|
+
if (this.EnalbeDetailOnVerlap) //启动重叠不会 先不画只计算位置, 后面统一画
|
|
44120
|
+
{
|
|
44121
|
+
this.AryDrawDetail.push({ Rect:rtBorder, AryText:aryText, Data:svgItem });
|
|
44122
|
+
return;
|
|
44123
|
+
}
|
|
44124
|
+
|
|
44125
|
+
this.DrawDetailText(data,aryText,rtBorder);
|
|
44126
|
+
|
|
44127
|
+
this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:svgItem } );
|
|
44128
|
+
}
|
|
44129
|
+
|
|
44130
|
+
this.DrawDetailText=function(data, aryText, rtBorder)
|
|
44131
|
+
{
|
|
44132
|
+
if (!data) return;
|
|
44133
|
+
|
|
44062
44134
|
if (data.BGColor)
|
|
44063
44135
|
{
|
|
44064
44136
|
this.Canvas.fillStyle=data.BGColor;
|
|
@@ -44075,12 +44147,27 @@ function ChartDrawSVG()
|
|
|
44075
44147
|
for(var i=0;i<aryText.length;++i)
|
|
44076
44148
|
{
|
|
44077
44149
|
var item=aryText[i];
|
|
44078
|
-
|
|
44150
|
+
|
|
44079
44151
|
this.Canvas.fillStyle = item.Data.Color;
|
|
44080
44152
|
this.Canvas.fillText(item.Data.Text, item.X, item.Y);
|
|
44081
44153
|
}
|
|
44154
|
+
}
|
|
44082
44155
|
|
|
44083
|
-
|
|
44156
|
+
this.DrawOnVerlapDetail=function()
|
|
44157
|
+
{
|
|
44158
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.AryDrawDetail)) return;
|
|
44159
|
+
|
|
44160
|
+
for(var i=this.AryDrawDetail.length-1;i>=0; --i)
|
|
44161
|
+
{
|
|
44162
|
+
var drawItem=this.AryDrawDetail[i];
|
|
44163
|
+
var rtBorder=drawItem.Rect;
|
|
44164
|
+
|
|
44165
|
+
if (this.IsRectOverlap(rtBorder)) continue;
|
|
44166
|
+
|
|
44167
|
+
this.DrawDetailText(drawItem.Data.Detail, drawItem.AryText, rtBorder);
|
|
44168
|
+
|
|
44169
|
+
this.AryDrawRect.push( {Left:rtBorder.Left, Top:rtBorder.Top, Right:rtBorder.Right, Bottom:rtBorder.Bottom, Type:"Detail", Data:drawItem.Data } );
|
|
44170
|
+
}
|
|
44084
44171
|
}
|
|
44085
44172
|
|
|
44086
44173
|
this.GetDetailPosition=function(rtSVG, data)
|
|
@@ -44442,183 +44529,6 @@ function ChartDrawSVG()
|
|
|
44442
44529
|
}
|
|
44443
44530
|
}
|
|
44444
44531
|
|
|
44445
|
-
/*
|
|
44446
|
-
this.DrawSVG=function()
|
|
44447
|
-
{
|
|
44448
|
-
if (!this.IsShow || this.ChartFrame.IsMinSize) return;
|
|
44449
|
-
if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return;
|
|
44450
|
-
if (!IFrameSplitOperator.IsNonEmptyArray(this.Texts)) return;
|
|
44451
|
-
if (!this.Family) return;
|
|
44452
|
-
|
|
44453
|
-
this.IsHScreen=(this.ChartFrame.IsHScreen===true);
|
|
44454
|
-
var xPointCount=this.ChartFrame.XPointCount;
|
|
44455
|
-
var offset=this.Data.DataOffset;
|
|
44456
|
-
var top=this.ChartBorder.GetTopEx();
|
|
44457
|
-
var bottom=this.ChartBorder.GetBottomEx();
|
|
44458
|
-
var pixelRatio = GetDevicePixelRatio();
|
|
44459
|
-
|
|
44460
|
-
var x=0,y=0;
|
|
44461
|
-
for(var i=0; i<this.Texts.length; ++i)
|
|
44462
|
-
{
|
|
44463
|
-
var item=this.Texts[i];
|
|
44464
|
-
|
|
44465
|
-
if (!item.SVG || !item.SVG.Symbol) continue;
|
|
44466
|
-
if (!IFrameSplitOperator.IsNumber(item.Index)) continue;
|
|
44467
|
-
|
|
44468
|
-
var isMinuteFrame=this.IsMinuteFrame();
|
|
44469
|
-
var index=item.Index-offset;
|
|
44470
|
-
var kItem=this.Data.Data[item.Index];
|
|
44471
|
-
if (index<0 || index>=xPointCount) continue;
|
|
44472
|
-
|
|
44473
|
-
x=this.ChartFrame.GetXFromIndex(index);
|
|
44474
|
-
if (item.Value=="Top") y=top;
|
|
44475
|
-
else if (item.Value=="Bottom") y=bottom;
|
|
44476
|
-
else y=this.ChartFrame.GetYFromData(item.Value, false);
|
|
44477
|
-
if (IFrameSplitOperator.IsNumber(item.YOffset)) y+=item.YOffset; //Y轴偏移
|
|
44478
|
-
|
|
44479
|
-
var svgItem=item.SVG;
|
|
44480
|
-
if (IFrameSplitOperator.IsNumber(svgItem.YOffset)) y+=svgItem.YOffset;
|
|
44481
|
-
|
|
44482
|
-
if (this.AutoPosition)
|
|
44483
|
-
{
|
|
44484
|
-
var pt={ X:x, Y:y };
|
|
44485
|
-
this.CalculateShowPosition(item, pt); //重新计算位置
|
|
44486
|
-
x=pt.X;
|
|
44487
|
-
y=pt.Y;
|
|
44488
|
-
}
|
|
44489
|
-
|
|
44490
|
-
|
|
44491
|
-
var fontSVG=`${svgItem.Size}px ${this.Family}`;
|
|
44492
|
-
this.Canvas.font=fontSVG;
|
|
44493
|
-
var halfSize=svgItem.Size/2;
|
|
44494
|
-
var textBaseline='bottom';
|
|
44495
|
-
var rtSVG={ Left:x-halfSize, Right:x+halfSize, Top:y-svgItem.Size, Bottom:y, Height:svgItem.Size, Width:svgItem.Size };
|
|
44496
|
-
if (svgItem.VAlign===0)
|
|
44497
|
-
{
|
|
44498
|
-
textBaseline="top";
|
|
44499
|
-
rtSVG.Top=y;
|
|
44500
|
-
rtSVG.Bottom=rtSVG.Top+svgItem.Size;
|
|
44501
|
-
}
|
|
44502
|
-
else if (svgItem.VAlign===1)
|
|
44503
|
-
{
|
|
44504
|
-
textBaseline='middle';
|
|
44505
|
-
rtSVG.Top=y-svgItem.Size/2;
|
|
44506
|
-
rtSVG.Bottom=rtSVG.Top+svgItem.Size;
|
|
44507
|
-
}
|
|
44508
|
-
|
|
44509
|
-
if (rtSVG.Top<0)
|
|
44510
|
-
{
|
|
44511
|
-
rtSVG.Top=0;
|
|
44512
|
-
rtSVG.Bottom=svgItem.Size;
|
|
44513
|
-
y=rtSVG.Bottom;
|
|
44514
|
-
}
|
|
44515
|
-
|
|
44516
|
-
this.Canvas.textBaseline=textBaseline;
|
|
44517
|
-
this.Canvas.textAlign='center';
|
|
44518
|
-
this.Canvas.fillStyle = svgItem.Color;
|
|
44519
|
-
this.Canvas.fillText(svgItem.Symbol, x, y);
|
|
44520
|
-
|
|
44521
|
-
this.AryDrawRect.push( {Left:rtSVG.Left, Top:rtSVG.Top, Right:rtSVG.Right, Bottom:rtSVG.Bottom, Type:"SVG", Data:item } );
|
|
44522
|
-
|
|
44523
|
-
if (this.EnableTooltip) this.TooltipRect.push({ Rect:rtSVG,Index:i });
|
|
44524
|
-
|
|
44525
|
-
//文字
|
|
44526
|
-
if (item.Text && item.Text.Content && this.TextFont)
|
|
44527
|
-
{
|
|
44528
|
-
var textItem=item.Text;
|
|
44529
|
-
this.Canvas.font=this.TextFont;
|
|
44530
|
-
this.Canvas.fillStyle=textItem.Color;
|
|
44531
|
-
var yText=y;
|
|
44532
|
-
if (IFrameSplitOperator.IsNumber(textItem.YOffset)) yText+=textItem.YOffset;
|
|
44533
|
-
this.Canvas.fillText(textItem.Content, x, yText);
|
|
44534
|
-
}
|
|
44535
|
-
|
|
44536
|
-
if (item.Detail)
|
|
44537
|
-
{
|
|
44538
|
-
this.DrawDetail(rtSVG,item.Detail, item);
|
|
44539
|
-
}
|
|
44540
|
-
|
|
44541
|
-
//连线
|
|
44542
|
-
if (item.Line)
|
|
44543
|
-
{
|
|
44544
|
-
var lineItem=item.Line;
|
|
44545
|
-
var price=null, yPrice=null;
|
|
44546
|
-
var kItem=this.Data.Data[item.Index];
|
|
44547
|
-
if (lineItem.Value=="Bottom")
|
|
44548
|
-
{
|
|
44549
|
-
yPrice=bottom;
|
|
44550
|
-
}
|
|
44551
|
-
else if (lineItem.Value=="Top")
|
|
44552
|
-
{
|
|
44553
|
-
yPrice=top;
|
|
44554
|
-
}
|
|
44555
|
-
else
|
|
44556
|
-
{
|
|
44557
|
-
switch(lineItem.Value)
|
|
44558
|
-
{
|
|
44559
|
-
case "C":
|
|
44560
|
-
price=kItem.Close;
|
|
44561
|
-
break;
|
|
44562
|
-
case "H":
|
|
44563
|
-
price=kItem.High;
|
|
44564
|
-
break;
|
|
44565
|
-
case "L":
|
|
44566
|
-
price=kItem.Low;
|
|
44567
|
-
break;
|
|
44568
|
-
}
|
|
44569
|
-
|
|
44570
|
-
if (!IFrameSplitOperator.IsNumber(price)) continue;
|
|
44571
|
-
|
|
44572
|
-
yPrice=this.ChartFrame.GetYFromData(price);
|
|
44573
|
-
}
|
|
44574
|
-
|
|
44575
|
-
if (yPrice>=rtSVG.Top && yPrice<=rtSVG.Bottom) continue;
|
|
44576
|
-
|
|
44577
|
-
var yText;
|
|
44578
|
-
if (yPrice<rtSVG.Top)
|
|
44579
|
-
{
|
|
44580
|
-
yText=rtSVG.Top;
|
|
44581
|
-
if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
|
|
44582
|
-
{
|
|
44583
|
-
//yPrice+=lineItem.Blank;
|
|
44584
|
-
yText-=lineItem.SVGBlank;
|
|
44585
|
-
}
|
|
44586
|
-
}
|
|
44587
|
-
else
|
|
44588
|
-
{
|
|
44589
|
-
yText=rtSVG.Bottom;
|
|
44590
|
-
if (IFrameSplitOperator.IsNumber(lineItem.SVGBlank))
|
|
44591
|
-
{
|
|
44592
|
-
//yPrice-=lineItem.Blank;
|
|
44593
|
-
yText+=lineItem.SVGBlank;
|
|
44594
|
-
}
|
|
44595
|
-
}
|
|
44596
|
-
|
|
44597
|
-
if (lineItem.Dash) this.Canvas.setLineDash(lineItem.Dash); //虚线
|
|
44598
|
-
var lineWidth=1*pixelRatio;
|
|
44599
|
-
if (lineItem.Width>0) lineWidth=lineItem.Width*pixelRatio;
|
|
44600
|
-
this.Canvas.lineWidth=lineWidth; //线宽
|
|
44601
|
-
this.Canvas.strokeStyle = lineItem.Color;
|
|
44602
|
-
this.Canvas.beginPath();
|
|
44603
|
-
|
|
44604
|
-
if (this.IsHScreen)
|
|
44605
|
-
{
|
|
44606
|
-
this.Canvas.moveTo(yText, ToFixedPoint(x));
|
|
44607
|
-
this.Canvas.lineTo(yPrice,ToFixedPoint(x));
|
|
44608
|
-
}
|
|
44609
|
-
else
|
|
44610
|
-
{
|
|
44611
|
-
this.Canvas.moveTo(ToFixedPoint2(lineWidth,x),yText);
|
|
44612
|
-
this.Canvas.lineTo(ToFixedPoint2(lineWidth,x),yPrice);
|
|
44613
|
-
}
|
|
44614
|
-
|
|
44615
|
-
this.Canvas.stroke();
|
|
44616
|
-
this.Canvas.setLineDash([]);
|
|
44617
|
-
}
|
|
44618
|
-
}
|
|
44619
|
-
}
|
|
44620
|
-
*/
|
|
44621
|
-
|
|
44622
44532
|
this.GetMaxMin=function()
|
|
44623
44533
|
{
|
|
44624
44534
|
this.IsHScreen=(this.ChartFrame.IsHScreen===true);
|
|
@@ -2015,6 +2015,8 @@ HQData.Report_APIIndex=function(data, callback)
|
|
|
2015
2015
|
HQData.APIIndex_TITLE(data, callback);
|
|
2016
2016
|
else if (request.Data.indexname=="API_SCATTER_PLOT_V2")
|
|
2017
2017
|
HQData.APIIndex_SCATTER_PLOT_V2(data, callback);
|
|
2018
|
+
else if (request.Data.indexname=="API_KLINE_TABLE")
|
|
2019
|
+
HQData.APIIndex_KLINE_TABLE(data, callback);
|
|
2018
2020
|
}
|
|
2019
2021
|
|
|
2020
2022
|
|
|
@@ -3076,6 +3078,116 @@ HQData.APIIndex_SCATTER_PLOT_V2=function(data, callback)
|
|
|
3076
3078
|
callback(apiData);
|
|
3077
3079
|
}
|
|
3078
3080
|
|
|
3081
|
+
HQData.APIIndex_KLINE_TABLE=function(data, callback)
|
|
3082
|
+
{
|
|
3083
|
+
data.PreventDefault=true;
|
|
3084
|
+
var hqchart=data.HQChart;
|
|
3085
|
+
var kData=data.HQChart.GetKData(); //hqchart图形的分钟数据
|
|
3086
|
+
|
|
3087
|
+
var tableData=
|
|
3088
|
+
{
|
|
3089
|
+
name:'KLINE_TABLE', type:1,
|
|
3090
|
+
Draw:
|
|
3091
|
+
{
|
|
3092
|
+
DrawType:'KLINE_TABLE',
|
|
3093
|
+
DrawData:[ ] , //数据 [ [ { Text, Color: BGColor }, ...... ], [],]
|
|
3094
|
+
RowCount:4,
|
|
3095
|
+
RowName:[ {Name:"账户1",TextAlign:"center"}, {Name:"账户2",TextAlign:"center"}, {Name:"账户3",TextAlign:"center"},{Name:"账户4", TextAlign:"center"}],
|
|
3096
|
+
|
|
3097
|
+
Config:
|
|
3098
|
+
{
|
|
3099
|
+
BGColor:"rgb(0,0,0)",
|
|
3100
|
+
BorderColor:"rgb(220,220,220)",
|
|
3101
|
+
TextColor:"rgb(250,250,250)",
|
|
3102
|
+
ItemMergin:{ Left:2, Right:2, Top:4, Bottom:4, YOffset:3 },
|
|
3103
|
+
RowNamePosition:3,
|
|
3104
|
+
TextFont:{ Family:'微软雅黑' , FontMaxSize:14*GetDevicePixelRatio(), },
|
|
3105
|
+
RowHeightType:1,
|
|
3106
|
+
}
|
|
3107
|
+
},
|
|
3108
|
+
|
|
3109
|
+
};
|
|
3110
|
+
|
|
3111
|
+
var ACCOUNT_TEST_DATA=
|
|
3112
|
+
[
|
|
3113
|
+
{ Name:"账户1", DayCount:5, OperatorID:0 },
|
|
3114
|
+
{ Name:"账户2", DayCount:10, OperatorID:0 },
|
|
3115
|
+
{ Name:"账户3", DayCount:4, OperatorID:0 },
|
|
3116
|
+
{ Name:"账户4", DayCount:8, OperatorID:0 },
|
|
3117
|
+
]
|
|
3118
|
+
|
|
3119
|
+
for(var i=0;i<kData.Data.length;++i)
|
|
3120
|
+
{
|
|
3121
|
+
var kItem=kData.Data[i];
|
|
3122
|
+
|
|
3123
|
+
//一列数据
|
|
3124
|
+
var colItem={ Date:kItem.Date, Time:kItem.Time, Data:[ ] };
|
|
3125
|
+
|
|
3126
|
+
for(var j=0;j<ACCOUNT_TEST_DATA.length;++j)
|
|
3127
|
+
{
|
|
3128
|
+
var accountItem=ACCOUNT_TEST_DATA[j];
|
|
3129
|
+
if (i%accountItem.DayCount==0)
|
|
3130
|
+
{
|
|
3131
|
+
accountItem.OperatorID++;
|
|
3132
|
+
if (accountItem.OperatorID>=3) accountItem.OperatorID=0;
|
|
3133
|
+
|
|
3134
|
+
if (accountItem.OperatorID==1)
|
|
3135
|
+
{
|
|
3136
|
+
colItem.Data[j]=
|
|
3137
|
+
{
|
|
3138
|
+
Text:"买", Color:"rgb(250,250,250)", BGColor:'rgb(250,0,0)', TextAlign:"center",
|
|
3139
|
+
Tooltip:
|
|
3140
|
+
{
|
|
3141
|
+
AryText:
|
|
3142
|
+
[
|
|
3143
|
+
{Title:"日期", Text:`${kItem.Date}`},
|
|
3144
|
+
{Title:"买入价", Text:`${kItem.Close.toFixed(2)}`, TextColor:"rgb(250,0,0)"},
|
|
3145
|
+
{Title:"数量", Text:`${HQData.GetRandomTestData(100,400).toFixed(0)}`,TextColor:"rgb(255,165,0)" },
|
|
3146
|
+
]
|
|
3147
|
+
}
|
|
3148
|
+
};
|
|
3149
|
+
}
|
|
3150
|
+
else if (accountItem.OperatorID==2)
|
|
3151
|
+
{
|
|
3152
|
+
colItem.Data[j]=
|
|
3153
|
+
{
|
|
3154
|
+
Text:"卖", Color:"rgb(250,250,250)", BGColor:'rgb(34,139,34)', TextAlign:"center",
|
|
3155
|
+
Tooltip:
|
|
3156
|
+
{
|
|
3157
|
+
AryText:
|
|
3158
|
+
[
|
|
3159
|
+
{Title:"日期", Text:`${kItem.Date}`},
|
|
3160
|
+
{Title:"卖入价", Text:`${kItem.Close.toFixed(2)}`, TextColor:"rgb(34,139,34)"},
|
|
3161
|
+
{Title:"数量", Text:`${HQData.GetRandomTestData(100,400).toFixed(0)}`,TextColor:"rgb(255,165,0)" },
|
|
3162
|
+
]
|
|
3163
|
+
}
|
|
3164
|
+
};
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
}
|
|
3168
|
+
else
|
|
3169
|
+
{
|
|
3170
|
+
if (accountItem.OperatorID==0) continue; //空闲
|
|
3171
|
+
|
|
3172
|
+
if (accountItem.OperatorID==1)
|
|
3173
|
+
colItem.Data[j]= {Text:"持", Color:"rgb(250,250,250)", BGColor:'rgb(255,140,0)',TextAlign:"center"};
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
|
|
3177
|
+
tableData.Draw.DrawData.push(colItem);
|
|
3178
|
+
}
|
|
3179
|
+
|
|
3180
|
+
var apiData=
|
|
3181
|
+
{
|
|
3182
|
+
code:0,
|
|
3183
|
+
stock:{ name:hqchart.Name, symbol:hqchart.Symbol },
|
|
3184
|
+
outdata: { date:kData.GetDate(), time:kData.GetTime(), outvar:[tableData] }
|
|
3185
|
+
};
|
|
3186
|
+
|
|
3187
|
+
console.log('[KLineChart::APIIndex_KLINE_TABLE] apiData ', apiData);
|
|
3188
|
+
callback(apiData);
|
|
3189
|
+
}
|
|
3190
|
+
|
|
3079
3191
|
|
|
3080
3192
|
HQData.RequestVolumeProfileData=function(data, callback)
|
|
3081
3193
|
{
|