hqchart 1.1.14613 → 1.1.14621
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 +30 -10
- package/package.json +1 -1
- package/src/jscommon/umychart.NetworkFilterTest.js +63 -0
- package/src/jscommon/umychart.complier.js +44 -1
- package/src/jscommon/umychart.js +349 -1
- package/src/jscommon/umychart.report.js +11 -2
- package/src/jscommon/umychart.testdata.js +63 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +405 -5
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.NetworkFilterTest.vue.js +63 -0
- package/src/jscommon/umychart.vue/umychart.vue.js +405 -5
|
@@ -57527,6 +57527,8 @@ HQData.Report_APIIndex=function(data, callback)
|
|
|
57527
57527
|
HQData.APIIndex_DRAWKLINE(data, callback);
|
|
57528
57528
|
else if (request.Data.indexname=="API_TITLE")
|
|
57529
57529
|
HQData.APIIndex_TITLE(data, callback);
|
|
57530
|
+
else if (request.Data.indexname=="API_SCATTER_PLOT_V2")
|
|
57531
|
+
HQData.APIIndex_SCATTER_PLOT_V2(data, callback);
|
|
57530
57532
|
}
|
|
57531
57533
|
|
|
57532
57534
|
|
|
@@ -58527,6 +58529,67 @@ HQData.APIIndex_TITLE=function(data, callback)
|
|
|
58527
58529
|
callback(apiData);
|
|
58528
58530
|
}
|
|
58529
58531
|
|
|
58532
|
+
HQData.APIIndex_SCATTER_PLOT_V2=function(data, callback)
|
|
58533
|
+
{
|
|
58534
|
+
data.PreventDefault=true;
|
|
58535
|
+
var hqchart=data.HQChart;
|
|
58536
|
+
var kData=hqchart.GetKData();
|
|
58537
|
+
|
|
58538
|
+
var pointData=
|
|
58539
|
+
{
|
|
58540
|
+
name:"SCATTER_PLOT_V2", type:1,
|
|
58541
|
+
Draw:
|
|
58542
|
+
{
|
|
58543
|
+
Name:"SCATTER_PLOT_V2",
|
|
58544
|
+
DrawType:"SCATTER_PLOT_V2",
|
|
58545
|
+
DrawData:[],
|
|
58546
|
+
Config:{ Color:"rgb(100,100,0)", Radius:5 },
|
|
58547
|
+
},
|
|
58548
|
+
};
|
|
58549
|
+
|
|
58550
|
+
for(var i=0;i<kData.Data.length;++i)
|
|
58551
|
+
{
|
|
58552
|
+
var kItem=kData.Data[i];
|
|
58553
|
+
|
|
58554
|
+
var item={ Date:kItem.Date, Time:kItem.Time, Value:kItem.High, Color:"rgb(0,0,0)", IsEmpty:true };
|
|
58555
|
+
if (kItem.Close>kItem.Open)
|
|
58556
|
+
{
|
|
58557
|
+
item.ColorBorder="rgb(0,250,0)";
|
|
58558
|
+
item.Text={ Text:`${kItem.High.toFixed(2)}`, Color:"rgb(250,250,250)", BaseLine:1, YOffset:8, Align:2, BG:{ Color:"rgb(255,140,0)", MarginLeft:5, MarginRight:5, YOffset:5, MarginTop:8, MarginBottom:1 }};
|
|
58559
|
+
}
|
|
58560
|
+
else
|
|
58561
|
+
{
|
|
58562
|
+
item.ColorBorder="rgb(250,0,0)";
|
|
58563
|
+
item.Text=
|
|
58564
|
+
{
|
|
58565
|
+
Text:`${kItem.High.toFixed(2)}`, Color:"rgb(178,34,34)", BaseLine:2, YOffset:10, Align:2,
|
|
58566
|
+
//BG:{ Color:"rgb(255,255,0)" }
|
|
58567
|
+
};
|
|
58568
|
+
}
|
|
58569
|
+
|
|
58570
|
+
|
|
58571
|
+
item.Tooltip=
|
|
58572
|
+
[
|
|
58573
|
+
{Title:"日期", Text:`${kItem.Date}`},
|
|
58574
|
+
{Title:"最高", Text:`${kItem.High.toFixed(2)}`, TextColor:"rgb(250,0,0)"},
|
|
58575
|
+
{Title:"最低", Text:`${kItem.Low.toFixed(2)}`,TextColor:"rgb(0,255,0)" },
|
|
58576
|
+
]
|
|
58577
|
+
pointData.Draw.DrawData.push(item);
|
|
58578
|
+
}
|
|
58579
|
+
|
|
58580
|
+
var apiData=
|
|
58581
|
+
{
|
|
58582
|
+
code:0,
|
|
58583
|
+
stock:{ name:hqchart.Name, symbol:hqchart.Symbol },
|
|
58584
|
+
outdata: { date:kData.GetDate(), time:kData.GetTime(), outvar:[ pointData] },
|
|
58585
|
+
|
|
58586
|
+
//error: { message:"无权限查看指标“测试指标1”" }
|
|
58587
|
+
};
|
|
58588
|
+
|
|
58589
|
+
console.log('[HQData.APIIndex_SCATTER_PLOT_V2] apiData ', apiData);
|
|
58590
|
+
callback(apiData);
|
|
58591
|
+
}
|
|
58592
|
+
|
|
58530
58593
|
|
|
58531
58594
|
HQData.RequestVolumeProfileData=function(data, callback)
|
|
58532
58595
|
{
|
|
@@ -20256,7 +20256,9 @@ var SCRIPT_CHART_NAME=
|
|
|
20256
20256
|
{
|
|
20257
20257
|
OVERLAY_BARS:"OVERLAY_BARS", //叠加柱子图
|
|
20258
20258
|
KLINE_TABLE:"KLINE_TABLE",
|
|
20259
|
-
SCATTER_PLOT:"SCATTER_PLOT",
|
|
20259
|
+
SCATTER_PLOT:"SCATTER_PLOT", //散点图
|
|
20260
|
+
SCATTER_PLOT_V2:"SCATTER_PLOT_V2", //散点图V2
|
|
20261
|
+
|
|
20260
20262
|
|
|
20261
20263
|
CLIP_COLOR_STICK:"CLIP_COLOR_STICK", //上下柱子 裁剪
|
|
20262
20264
|
|
|
@@ -22263,6 +22265,34 @@ function ScriptIndex(name,script,args,option)
|
|
|
22263
22265
|
hqChart.ChartPaint.push(chart);
|
|
22264
22266
|
}
|
|
22265
22267
|
|
|
22268
|
+
this.CreateScatterPlotV2=function(hqChart,windowIndex,varItem,i)
|
|
22269
|
+
{
|
|
22270
|
+
var chart=new ChartScatterPlotV2();
|
|
22271
|
+
chart.Canvas=hqChart.Canvas;
|
|
22272
|
+
chart.Name=varItem.Name;
|
|
22273
|
+
chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;
|
|
22274
|
+
chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;
|
|
22275
|
+
chart.HQChart=hqChart;
|
|
22276
|
+
chart.Identify=this.Guid;
|
|
22277
|
+
|
|
22278
|
+
chart.Data=hqChart.GetKData(); //绑定K线
|
|
22279
|
+
chart.AryPoint=varItem.Draw.DrawData;
|
|
22280
|
+
|
|
22281
|
+
var config=varItem.Draw.Config;
|
|
22282
|
+
if (config)
|
|
22283
|
+
{
|
|
22284
|
+
if (config.Color) chart.Color=config.Color;
|
|
22285
|
+
if (IFrameSplitOperator.IsNumber(config.Radius)) chart.Radius=config.Radius;
|
|
22286
|
+
if (config.TextColor) chart.TextColor=config.TextColor;
|
|
22287
|
+
if (config.Font) chart.Font=config.Font;
|
|
22288
|
+
}
|
|
22289
|
+
|
|
22290
|
+
chart.BuildCacheData();
|
|
22291
|
+
|
|
22292
|
+
hqChart.ChartPaint.push(chart);
|
|
22293
|
+
}
|
|
22294
|
+
|
|
22295
|
+
|
|
22266
22296
|
this.CreateClipColorStick=function(hqChart,windowIndex,varItem,id)
|
|
22267
22297
|
{
|
|
22268
22298
|
var chart=new ChartClipColorStick();
|
|
@@ -22625,6 +22655,9 @@ function ScriptIndex(name,script,args,option)
|
|
|
22625
22655
|
case SCRIPT_CHART_NAME.SCATTER_PLOT:
|
|
22626
22656
|
this.CreateScatterPlot(hqChart,windowIndex,item,i);
|
|
22627
22657
|
break;
|
|
22658
|
+
case SCRIPT_CHART_NAME.SCATTER_PLOT_V2:
|
|
22659
|
+
this.CreateScatterPlotV2(hqChart,windowIndex,item,i);
|
|
22660
|
+
break;
|
|
22628
22661
|
case SCRIPT_CHART_NAME.CLIP_COLOR_STICK:
|
|
22629
22662
|
this.CreateClipColorStick(hqChart,windowIndex,item,i);
|
|
22630
22663
|
break;
|
|
@@ -25186,6 +25219,16 @@ function APIScriptIndex(name,script,args,option, isOverlay)
|
|
|
25186
25219
|
|
|
25187
25220
|
result.push(outVarItem);
|
|
25188
25221
|
}
|
|
25222
|
+
else if (draw.DrawType==SCRIPT_CHART_NAME.SCATTER_PLOT_V2)
|
|
25223
|
+
{
|
|
25224
|
+
drawItem.Name=draw.Name;
|
|
25225
|
+
drawItem.Type=draw.Type;
|
|
25226
|
+
drawItem.DrawType=draw.DrawType;
|
|
25227
|
+
drawItem.DrawData=draw.DrawData;
|
|
25228
|
+
drawItem.Config=draw.Config;
|
|
25229
|
+
outVarItem.Draw=drawItem;
|
|
25230
|
+
result.push(outVarItem);
|
|
25231
|
+
}
|
|
25189
25232
|
else if (draw.DrawType==SCRIPT_CHART_NAME.KLINE_TABLE)
|
|
25190
25233
|
{
|
|
25191
25234
|
drawItem.Name=draw.Name;
|
package/src/jscommon/umychart.js
CHANGED
|
@@ -8954,7 +8954,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
8954
8954
|
this.ReloadChartDrawPictureResource(option.Resource);
|
|
8955
8955
|
|
|
8956
8956
|
if (option.Update && this.Update) this.Update( {UpdateCursorIndexType:2} ); //是否立即更新并重绘
|
|
8957
|
-
else if (option.Draw==true) this.Draw(); //是否立即重绘
|
|
8957
|
+
else if (option.Draw==true || option.Redraw==true) this.Draw(); //是否立即重绘
|
|
8958
8958
|
|
|
8959
8959
|
if (this.PopMinuteChart) this.PopMinuteChart.ReloadResource(option);
|
|
8960
8960
|
if (this.DialogTooltip) this.DialogTooltip.ReloadResource(option);
|
|
@@ -11515,6 +11515,14 @@ function ToFixed(number, precision)
|
|
|
11515
11515
|
return s;
|
|
11516
11516
|
}
|
|
11517
11517
|
|
|
11518
|
+
function IsRectOverlap(rt, rt2)
|
|
11519
|
+
{
|
|
11520
|
+
if (Math.max(rt.Left,rt2.Left)<Math.min(rt.Right,rt2.Right) && Math.max(rt.Top,rt2.Top)<Math.min(rt.Bottom, rt2.Bottom))
|
|
11521
|
+
return true;
|
|
11522
|
+
|
|
11523
|
+
return false;
|
|
11524
|
+
}
|
|
11525
|
+
|
|
11518
11526
|
Number.prototype.toFixed2=Number.prototype.toFixed; //备份下老的
|
|
11519
11527
|
Number.prototype.toFixed = function( precision )
|
|
11520
11528
|
{
|
|
@@ -34808,6 +34816,326 @@ function ChartScatterPlot()
|
|
|
34808
34816
|
|
|
34809
34817
|
}
|
|
34810
34818
|
|
|
34819
|
+
//散点图
|
|
34820
|
+
function ChartScatterPlotV2()
|
|
34821
|
+
{
|
|
34822
|
+
this.newMethod=IChartPainting; //派生
|
|
34823
|
+
this.newMethod();
|
|
34824
|
+
delete this.newMethod;
|
|
34825
|
+
|
|
34826
|
+
this.ClassName='ChartScatterPlotV2'; //类名
|
|
34827
|
+
|
|
34828
|
+
//默认点配置
|
|
34829
|
+
this.Color=g_JSChartResource.ChartScatterPlotV2.Color; //点颜色
|
|
34830
|
+
this.TextColor=g_JSChartResource.ChartScatterPlotV2.TextColor;
|
|
34831
|
+
this.Radius=g_JSChartResource.ChartScatterPlotV2.Radius;
|
|
34832
|
+
this.Font=g_JSChartResource.ChartScatterPlotV2.Font; //半径
|
|
34833
|
+
|
|
34834
|
+
this.TooltipData=[];
|
|
34835
|
+
this.MapCache=null; //key=date/date-time value={ Data:[] }
|
|
34836
|
+
this.AryPoint=[ ]; //[{ Value:, Radius:半径(可选), Color:颜色(可选),ColorBorder:边框颜色(可选),
|
|
34837
|
+
// Text:{ Text:显示文字, Color:"rgb(0,30,100)", BaseLine:1, YOffset:5, Align:2 }; }]
|
|
34838
|
+
// BaseLine: 0=圆点上面 1=圆点下面 Align: 2=居中 1=左 3=右
|
|
34839
|
+
|
|
34840
|
+
this.GetKValue=ChartData.GetKValue;
|
|
34841
|
+
this.TextHeight=10;
|
|
34842
|
+
this.AryDrawRect=[];
|
|
34843
|
+
|
|
34844
|
+
this.ReloadResource=function(resource)
|
|
34845
|
+
{
|
|
34846
|
+
this.Color=g_JSChartResource.ChartScatterPlotV2.Color; //点颜色
|
|
34847
|
+
this.TextColor=g_JSChartResource.ChartScatterPlotV2.TextColor;
|
|
34848
|
+
this.Radius=g_JSChartResource.ChartScatterPlotV2.Radius;
|
|
34849
|
+
this.Font=g_JSChartResource.ChartScatterPlotV2.Font;
|
|
34850
|
+
}
|
|
34851
|
+
|
|
34852
|
+
this.BuildCacheData=function()
|
|
34853
|
+
{
|
|
34854
|
+
var mapData=new Map();
|
|
34855
|
+
this.MapCache=mapData;
|
|
34856
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.AryPoint)) return;
|
|
34857
|
+
|
|
34858
|
+
for(var i=0;i<this.AryPoint.length;++i)
|
|
34859
|
+
{
|
|
34860
|
+
var item=this.AryPoint[i];
|
|
34861
|
+
var key=this.BuildKey(item);
|
|
34862
|
+
if (mapData.has(key))
|
|
34863
|
+
{
|
|
34864
|
+
var mapItem=mapData.get(key);
|
|
34865
|
+
mapItem.Data.push(item);
|
|
34866
|
+
}
|
|
34867
|
+
else
|
|
34868
|
+
{
|
|
34869
|
+
mapData.set(key,{ Data:[item] });
|
|
34870
|
+
}
|
|
34871
|
+
}
|
|
34872
|
+
}
|
|
34873
|
+
|
|
34874
|
+
this.Draw=function()
|
|
34875
|
+
{
|
|
34876
|
+
this.TooltipData=[];
|
|
34877
|
+
this.AryDrawRect=[];
|
|
34878
|
+
if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
34879
|
+
if (this.IsShowIndexTitleOnly()) return;
|
|
34880
|
+
if (this.IsHideScriptIndex()) return;
|
|
34881
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.AryPoint)) return;
|
|
34882
|
+
if (!this.MapCache || this.MapCache.size<=0) return;
|
|
34883
|
+
if(!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return;
|
|
34884
|
+
|
|
34885
|
+
this.DrawScatterPlot();
|
|
34886
|
+
this.AryDrawRect=[];
|
|
34887
|
+
}
|
|
34888
|
+
|
|
34889
|
+
this.DrawScatterPlot=function()
|
|
34890
|
+
{
|
|
34891
|
+
var bHScreen=(this.ChartFrame.IsHScreen===true);
|
|
34892
|
+
var isMinute=this.IsMinuteFrame();
|
|
34893
|
+
var dataWidth=this.ChartFrame.DataWidth;
|
|
34894
|
+
var distanceWidth=this.ChartFrame.DistanceWidth;
|
|
34895
|
+
var xPointCount=this.ChartFrame.XPointCount;
|
|
34896
|
+
|
|
34897
|
+
if (bHScreen)
|
|
34898
|
+
{
|
|
34899
|
+
var border=this.ChartBorder.GetHScreenBorder();
|
|
34900
|
+
var chartright=border.BottomEx;
|
|
34901
|
+
var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
34902
|
+
}
|
|
34903
|
+
else
|
|
34904
|
+
{
|
|
34905
|
+
var border=this.ChartBorder.GetBorder();
|
|
34906
|
+
var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
34907
|
+
var chartright=border.RightEx;
|
|
34908
|
+
}
|
|
34909
|
+
|
|
34910
|
+
var lockRect=this.GetLockRect();
|
|
34911
|
+
if (lockRect)
|
|
34912
|
+
{
|
|
34913
|
+
if (bHScreen) chartright=lockRect.Top;
|
|
34914
|
+
else chartright=lockRect.Left;
|
|
34915
|
+
}
|
|
34916
|
+
|
|
34917
|
+
this.Canvas.save();
|
|
34918
|
+
this.ClipClient(bHScreen);
|
|
34919
|
+
|
|
34920
|
+
this.Canvas.font=this.Font;
|
|
34921
|
+
this.Canvas.textAlign = "left";
|
|
34922
|
+
this.Canvas.textBaseline = "bottom";
|
|
34923
|
+
this.TextHeight=this.GetFontHeight();
|
|
34924
|
+
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
|
|
34925
|
+
{
|
|
34926
|
+
var kItem=this.Data.Data[i];
|
|
34927
|
+
if (!kItem) continue;
|
|
34928
|
+
|
|
34929
|
+
var key=this.BuildKey(kItem);
|
|
34930
|
+
if (!this.MapCache.has(key)) continue;
|
|
34931
|
+
var mapItem=this.MapCache.get(key);
|
|
34932
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(mapItem.Data)) continue;
|
|
34933
|
+
|
|
34934
|
+
if (isMinute)
|
|
34935
|
+
{
|
|
34936
|
+
var x=this.ChartFrame.GetXFromIndex(j);
|
|
34937
|
+
}
|
|
34938
|
+
else
|
|
34939
|
+
{
|
|
34940
|
+
var left=xOffset;
|
|
34941
|
+
var right=xOffset+dataWidth;
|
|
34942
|
+
if (right>chartright) break;
|
|
34943
|
+
var x=left+(right-left)/2;
|
|
34944
|
+
}
|
|
34945
|
+
|
|
34946
|
+
if (x>chartright) break;
|
|
34947
|
+
|
|
34948
|
+
for(var k=0;k<mapItem.Data.length;++k)
|
|
34949
|
+
{
|
|
34950
|
+
var item=mapItem.Data[k];
|
|
34951
|
+
this.DrawItem(kItem, item, x);
|
|
34952
|
+
}
|
|
34953
|
+
}
|
|
34954
|
+
|
|
34955
|
+
this.Canvas.restore();
|
|
34956
|
+
}
|
|
34957
|
+
|
|
34958
|
+
this.DrawItem=function(kItem, item, x)
|
|
34959
|
+
{
|
|
34960
|
+
var dataWidth=this.ChartFrame.DataWidth;
|
|
34961
|
+
var maxRadius=dataWidth/2;
|
|
34962
|
+
if (!item) return;
|
|
34963
|
+
var price=item.Value;
|
|
34964
|
+
if (IFrameSplitOperator.IsString(item.Value)) price=this.GetKValue(kItem,item.Value);
|
|
34965
|
+
if (!IFrameSplitOperator.IsNumber(price)) return;
|
|
34966
|
+
|
|
34967
|
+
var y=this.GetYFromData(price,false);
|
|
34968
|
+
|
|
34969
|
+
var radius=this.Radius;
|
|
34970
|
+
if (item.Radius) radius=item.Radius;
|
|
34971
|
+
if (!IFrameSplitOperator.IsNumber(radius)) return;
|
|
34972
|
+
if (radius>maxRadius) radius=maxRadius;
|
|
34973
|
+
|
|
34974
|
+
this.Canvas.beginPath();
|
|
34975
|
+
this.Canvas.arc(x, y, radius, 0, 2 * Math.PI);
|
|
34976
|
+
|
|
34977
|
+
var color=this.Color;
|
|
34978
|
+
if (item.Color) color=item.Color;
|
|
34979
|
+
if (color)
|
|
34980
|
+
{
|
|
34981
|
+
this.Canvas.fillStyle=color;
|
|
34982
|
+
this.Canvas.fill();
|
|
34983
|
+
}
|
|
34984
|
+
|
|
34985
|
+
if (item.ColorBorder)
|
|
34986
|
+
{
|
|
34987
|
+
this.Canvas.strokeStyle=item.ColorBorder;
|
|
34988
|
+
this.Canvas.stroke()
|
|
34989
|
+
}
|
|
34990
|
+
|
|
34991
|
+
if (dataWidth>this.TextHeight)
|
|
34992
|
+
{
|
|
34993
|
+
this.DrawText(item.Text,x,y,radius);
|
|
34994
|
+
}
|
|
34995
|
+
|
|
34996
|
+
var itemTooltip={ X:x, Y:y, Radius:radius, Data:item };
|
|
34997
|
+
this.TooltipData.push(itemTooltip);
|
|
34998
|
+
}
|
|
34999
|
+
|
|
35000
|
+
this.DrawText=function(item, x, y, radius)
|
|
35001
|
+
{
|
|
35002
|
+
if (!item || !item.Text) return;
|
|
35003
|
+
|
|
35004
|
+
var bHScreen=(this.ChartFrame.IsHScreen===true);
|
|
35005
|
+
if (bHScreen) return;
|
|
35006
|
+
|
|
35007
|
+
var text=item.Text;
|
|
35008
|
+
var textWidth=this.Canvas.measureText(text).width;
|
|
35009
|
+
|
|
35010
|
+
var baseLine=1; //1=上 2=下
|
|
35011
|
+
var align=2;
|
|
35012
|
+
var yOffset=2;
|
|
35013
|
+
var xText=x;
|
|
35014
|
+
if (IFrameSplitOperator.IsNumber(item.YOffset)) yOffset=item.YOffset; //Y偏移
|
|
35015
|
+
if (IFrameSplitOperator.IsNumber(item.BaseLine)) baseLine=item.BaseLine;
|
|
35016
|
+
var yText=y-radius-yOffset;
|
|
35017
|
+
if (baseLine==2) yText=y+radius+this.TextHeight+yOffset; //下
|
|
35018
|
+
|
|
35019
|
+
if (IFrameSplitOperator.IsNumber(item.Align)) align=item.Align; //左中右
|
|
35020
|
+
if (align==1) xText=x-textWidth;
|
|
35021
|
+
else if (align==2) xText=x-textWidth/2;
|
|
35022
|
+
|
|
35023
|
+
var rtText=null;
|
|
35024
|
+
if (item.BG && item.BG.Color)
|
|
35025
|
+
{
|
|
35026
|
+
var bgItem=item.BG;
|
|
35027
|
+
var marginLeft=2, marginRight=2, yBGOffset=1, marginBottom=0, marginTop=0;
|
|
35028
|
+
if (IFrameSplitOperator.IsNumber(bgItem.MarginLeft)) marginLeft=bgItem.MarginLeft;
|
|
35029
|
+
if (IFrameSplitOperator.IsNumber(bgItem.MarginRight)) marginRight=bgItem.MarginRight;
|
|
35030
|
+
if (IFrameSplitOperator.IsNumber(bgItem.MarginBottom)) marginBottom=bgItem.MarginBottom;
|
|
35031
|
+
if (IFrameSplitOperator.IsNumber(bgItem.MarginTop)) marginTop=bgItem.MarginTop;
|
|
35032
|
+
if (IFrameSplitOperator.IsNumber(bgItem.YOffset)) yBGOffset=bgItem.YOffset;
|
|
35033
|
+
|
|
35034
|
+
var rtBG={ Left:xText-marginLeft, Bottom:yText+yBGOffset+marginBottom, Width:textWidth+marginLeft+marginRight, Height:this.TextHeight+marginBottom+marginTop };
|
|
35035
|
+
rtBG.Right=rtBG.Left+rtBG.Width;
|
|
35036
|
+
rtBG.Top=rtBG.Bottom-rtBG.Height;
|
|
35037
|
+
|
|
35038
|
+
if (this.IsTextOverlap(rtBG)) return;
|
|
35039
|
+
|
|
35040
|
+
this.Canvas.fillStyle=bgItem.Color;
|
|
35041
|
+
this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
|
|
35042
|
+
|
|
35043
|
+
rtText=rtBG;
|
|
35044
|
+
}
|
|
35045
|
+
else
|
|
35046
|
+
{
|
|
35047
|
+
rtText={ Left:xText, Bottom:yText, Width:textWidth, Height:this.TextHeight };
|
|
35048
|
+
rtText.Right=rtText.Left+rtText.Width;
|
|
35049
|
+
rtText.Top=rtText.Bottom-rtText.Height;
|
|
35050
|
+
|
|
35051
|
+
if (this.IsTextOverlap(rtText)) return;
|
|
35052
|
+
}
|
|
35053
|
+
|
|
35054
|
+
if (item.Color) this.Canvas.fillStyle=item.Color;
|
|
35055
|
+
else this.Canvas.fillStyle=this.TextColor;
|
|
35056
|
+
this.Canvas.fillText(text, xText, yText);
|
|
35057
|
+
|
|
35058
|
+
this.AryDrawRect.push(rtText);
|
|
35059
|
+
}
|
|
35060
|
+
|
|
35061
|
+
this.IsTextOverlap=function(rtText)
|
|
35062
|
+
{
|
|
35063
|
+
for(var i=0; i<this.AryDrawRect.length; ++i)
|
|
35064
|
+
{
|
|
35065
|
+
var item=this.AryDrawRect[i];
|
|
35066
|
+
if (IsRectOverlap(rtText,item)) return true;
|
|
35067
|
+
}
|
|
35068
|
+
|
|
35069
|
+
return false;
|
|
35070
|
+
}
|
|
35071
|
+
|
|
35072
|
+
this.GetMaxMin=function()
|
|
35073
|
+
{
|
|
35074
|
+
var range={Min:null, Max:null };
|
|
35075
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.AryPoint)) return range;
|
|
35076
|
+
if (!this.MapCache || this.MapCache.size<=0) return range;
|
|
35077
|
+
if(!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return range;
|
|
35078
|
+
|
|
35079
|
+
var xPointCount=this.ChartFrame.XPointCount;
|
|
35080
|
+
var start=this.Data.DataOffset;
|
|
35081
|
+
if (this.ChartFrame.GlobalOption && this.ChartFrame.GlobalOption.IsValueFullRange)
|
|
35082
|
+
{
|
|
35083
|
+
start=0;
|
|
35084
|
+
xPointCount=this.Data.Data.length;
|
|
35085
|
+
}
|
|
35086
|
+
|
|
35087
|
+
for(var i=start,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
|
|
35088
|
+
{
|
|
35089
|
+
var kItem=this.Data.Data[i];
|
|
35090
|
+
if (!kItem) continue;
|
|
35091
|
+
|
|
35092
|
+
var key=this.BuildKey(kItem);
|
|
35093
|
+
if (!this.MapCache.has(key)) continue;
|
|
35094
|
+
var mapItem=this.MapCache.get(key);
|
|
35095
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(mapItem.Data)) continue;
|
|
35096
|
+
|
|
35097
|
+
for(k=0;k<mapItem.Data.length;++k)
|
|
35098
|
+
{
|
|
35099
|
+
var item=mapItem.Data[k];
|
|
35100
|
+
var value=item.Value;
|
|
35101
|
+
if (IFrameSplitOperator.IsString(item.Value)) value=this.GetKValue(kItem,item.Value);
|
|
35102
|
+
if (!IFrameSplitOperator.IsNumber(value)) continue;
|
|
35103
|
+
|
|
35104
|
+
if (range.Max==null) range.Max=value;
|
|
35105
|
+
else if (range.Max<value) range.Max=value;
|
|
35106
|
+
if (range.Min==null) range.Min=value;
|
|
35107
|
+
else if (range.Min>value) range.Min=value;
|
|
35108
|
+
}
|
|
35109
|
+
}
|
|
35110
|
+
|
|
35111
|
+
return range;
|
|
35112
|
+
}
|
|
35113
|
+
|
|
35114
|
+
this.GetTooltipData=function(x,y,tooltip)
|
|
35115
|
+
{
|
|
35116
|
+
if (!this.IsShow) return false;
|
|
35117
|
+
|
|
35118
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipData)) return false;
|
|
35119
|
+
|
|
35120
|
+
for(var i=this.TooltipData.length-1; i>=0; --i)
|
|
35121
|
+
{
|
|
35122
|
+
var item=this.TooltipData[i];
|
|
35123
|
+
|
|
35124
|
+
this.Canvas.beginPath();
|
|
35125
|
+
this.Canvas.arc(item.X, item.Y, item.Radius, 0, 2 * Math.PI);
|
|
35126
|
+
if (this.Canvas.isPointInPath(x,y))
|
|
35127
|
+
{
|
|
35128
|
+
JSConsole.Chart.Log('[ChartScatterPlotV2::GetTooltipData] point', item);
|
|
35129
|
+
tooltip.Data=item;
|
|
35130
|
+
tooltip.ChartPaint=this;
|
|
35131
|
+
tooltip.Type=6; //散点图
|
|
35132
|
+
return true;
|
|
35133
|
+
}
|
|
35134
|
+
}
|
|
35135
|
+
}
|
|
35136
|
+
|
|
35137
|
+
}
|
|
35138
|
+
|
|
34811
35139
|
//子线段
|
|
34812
35140
|
function ChartSubLine()
|
|
34813
35141
|
{
|
|
@@ -73548,6 +73876,14 @@ function JSChartResource()
|
|
|
73548
73876
|
DiffValueBGColor:"rgb(251,140,1)"
|
|
73549
73877
|
}
|
|
73550
73878
|
|
|
73879
|
+
this.ChartScatterPlotV2=
|
|
73880
|
+
{
|
|
73881
|
+
Color:"rgb(0,0,255)",
|
|
73882
|
+
TextColor:"rgb(0,0,0)",
|
|
73883
|
+
Radius:3,
|
|
73884
|
+
Font:`${10*GetDevicePixelRatio()}px 微软雅黑`
|
|
73885
|
+
}
|
|
73886
|
+
|
|
73551
73887
|
//筹码分布图
|
|
73552
73888
|
this.StockChip=
|
|
73553
73889
|
{
|
|
@@ -74948,6 +75284,7 @@ function JSChartResource()
|
|
|
74948
75284
|
if (style.KLineToolbar) this.SetKLineToolbar(style.KLineToolbar);
|
|
74949
75285
|
|
|
74950
75286
|
if (style.IndexLock) this.SetIndexLock(style.IndexLock);
|
|
75287
|
+
if (style.ChartScatterPlotV2) this.SetChartScatterPlotV2(style.ChartScatterPlotV2);
|
|
74951
75288
|
}
|
|
74952
75289
|
|
|
74953
75290
|
|
|
@@ -75646,6 +75983,17 @@ function JSChartResource()
|
|
|
75646
75983
|
if (item.Title) dest.Title=item.Title;
|
|
75647
75984
|
}
|
|
75648
75985
|
|
|
75986
|
+
this.SetChartScatterPlotV2=function(style)
|
|
75987
|
+
{
|
|
75988
|
+
var item=style;
|
|
75989
|
+
var dest=this.ChartScatterPlotV2;
|
|
75990
|
+
|
|
75991
|
+
if (item.Color) dest.Color=item.Color;
|
|
75992
|
+
if (item.TextColor) dest.TextColor=item.TextColor;
|
|
75993
|
+
if (item.Font) dest.Font=item.Font;
|
|
75994
|
+
if (IFrameSplitOperator.IsNumber(item.Radius)) dest.Radius=item.Radius
|
|
75995
|
+
}
|
|
75996
|
+
|
|
75649
75997
|
}
|
|
75650
75998
|
|
|
75651
75999
|
var g_JSChartResource=new JSChartResource();
|
|
@@ -192,6 +192,14 @@ function JSReportChart(divElement)
|
|
|
192
192
|
if (IFrameSplitOperator.IsBool(option.EnableDragHeader)) chart.EnableDragHeader=option.EnableDragHeader;
|
|
193
193
|
if (IFrameSplitOperator.IsNumber(option.WheelPageType)) chart.WheelPageType=option.WheelPageType;
|
|
194
194
|
if (IFrameSplitOperator.IsBool(option.PageUpDownCycle)) chart.PageUpDownCycle=option.PageUpDownCycle;
|
|
195
|
+
|
|
196
|
+
//数据下载提示信息
|
|
197
|
+
if (IFrameSplitOperator.IsObject(option.SplashTitle))
|
|
198
|
+
{
|
|
199
|
+
var item=option.SplashTitle;
|
|
200
|
+
if (item) chart.SplashTitle.StockList=item.StockList;
|
|
201
|
+
if (item) chart.SplashTitle.MemberList=item.MemberList;
|
|
202
|
+
}
|
|
195
203
|
|
|
196
204
|
|
|
197
205
|
if (option.VScrollbar) chart.SetVScrollbar(option.VScrollbar);
|
|
@@ -3505,13 +3513,14 @@ function JSReportChartContainer(uielement)
|
|
|
3505
3513
|
if (item.ReloadResource) item.ReloadResource(option);
|
|
3506
3514
|
}
|
|
3507
3515
|
|
|
3508
|
-
if (option && option.Redraw)
|
|
3516
|
+
if (option && (option.Redraw || option.Draw))
|
|
3509
3517
|
{
|
|
3510
3518
|
this.SetSizeChange(true);
|
|
3511
3519
|
this.Draw();
|
|
3512
3520
|
}
|
|
3513
3521
|
|
|
3514
|
-
if (this.
|
|
3522
|
+
if (this.TooltipMinuteChart) this.TooltipMinuteChart.ReloadResource(option); //分时图
|
|
3523
|
+
if (this.TooltipKLineChart) this.TooltipKLineChart.ReloadResource(option);
|
|
3515
3524
|
}
|
|
3516
3525
|
|
|
3517
3526
|
//列排序
|
|
@@ -2013,6 +2013,8 @@ HQData.Report_APIIndex=function(data, callback)
|
|
|
2013
2013
|
HQData.APIIndex_DRAWKLINE(data, callback);
|
|
2014
2014
|
else if (request.Data.indexname=="API_TITLE")
|
|
2015
2015
|
HQData.APIIndex_TITLE(data, callback);
|
|
2016
|
+
else if (request.Data.indexname=="API_SCATTER_PLOT_V2")
|
|
2017
|
+
HQData.APIIndex_SCATTER_PLOT_V2(data, callback);
|
|
2016
2018
|
}
|
|
2017
2019
|
|
|
2018
2020
|
|
|
@@ -3013,6 +3015,67 @@ HQData.APIIndex_TITLE=function(data, callback)
|
|
|
3013
3015
|
callback(apiData);
|
|
3014
3016
|
}
|
|
3015
3017
|
|
|
3018
|
+
HQData.APIIndex_SCATTER_PLOT_V2=function(data, callback)
|
|
3019
|
+
{
|
|
3020
|
+
data.PreventDefault=true;
|
|
3021
|
+
var hqchart=data.HQChart;
|
|
3022
|
+
var kData=hqchart.GetKData();
|
|
3023
|
+
|
|
3024
|
+
var pointData=
|
|
3025
|
+
{
|
|
3026
|
+
name:"SCATTER_PLOT_V2", type:1,
|
|
3027
|
+
Draw:
|
|
3028
|
+
{
|
|
3029
|
+
Name:"SCATTER_PLOT_V2",
|
|
3030
|
+
DrawType:"SCATTER_PLOT_V2",
|
|
3031
|
+
DrawData:[],
|
|
3032
|
+
Config:{ Color:"rgb(100,100,0)", Radius:5 },
|
|
3033
|
+
},
|
|
3034
|
+
};
|
|
3035
|
+
|
|
3036
|
+
for(var i=0;i<kData.Data.length;++i)
|
|
3037
|
+
{
|
|
3038
|
+
var kItem=kData.Data[i];
|
|
3039
|
+
|
|
3040
|
+
var item={ Date:kItem.Date, Time:kItem.Time, Value:kItem.High, Color:"rgb(0,0,0)", IsEmpty:true };
|
|
3041
|
+
if (kItem.Close>kItem.Open)
|
|
3042
|
+
{
|
|
3043
|
+
item.ColorBorder="rgb(0,250,0)";
|
|
3044
|
+
item.Text={ Text:`${kItem.High.toFixed(2)}`, Color:"rgb(250,250,250)", BaseLine:1, YOffset:8, Align:2, BG:{ Color:"rgb(255,140,0)", MarginLeft:5, MarginRight:5, YOffset:5, MarginTop:8, MarginBottom:1 }};
|
|
3045
|
+
}
|
|
3046
|
+
else
|
|
3047
|
+
{
|
|
3048
|
+
item.ColorBorder="rgb(250,0,0)";
|
|
3049
|
+
item.Text=
|
|
3050
|
+
{
|
|
3051
|
+
Text:`${kItem.High.toFixed(2)}`, Color:"rgb(178,34,34)", BaseLine:2, YOffset:10, Align:2,
|
|
3052
|
+
//BG:{ Color:"rgb(255,255,0)" }
|
|
3053
|
+
};
|
|
3054
|
+
}
|
|
3055
|
+
|
|
3056
|
+
|
|
3057
|
+
item.Tooltip=
|
|
3058
|
+
[
|
|
3059
|
+
{Title:"日期", Text:`${kItem.Date}`},
|
|
3060
|
+
{Title:"最高", Text:`${kItem.High.toFixed(2)}`, TextColor:"rgb(250,0,0)"},
|
|
3061
|
+
{Title:"最低", Text:`${kItem.Low.toFixed(2)}`,TextColor:"rgb(0,255,0)" },
|
|
3062
|
+
]
|
|
3063
|
+
pointData.Draw.DrawData.push(item);
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
var apiData=
|
|
3067
|
+
{
|
|
3068
|
+
code:0,
|
|
3069
|
+
stock:{ name:hqchart.Name, symbol:hqchart.Symbol },
|
|
3070
|
+
outdata: { date:kData.GetDate(), time:kData.GetTime(), outvar:[ pointData] },
|
|
3071
|
+
|
|
3072
|
+
//error: { message:"无权限查看指标“测试指标1”" }
|
|
3073
|
+
};
|
|
3074
|
+
|
|
3075
|
+
console.log('[HQData.APIIndex_SCATTER_PLOT_V2] apiData ', apiData);
|
|
3076
|
+
callback(apiData);
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3016
3079
|
|
|
3017
3080
|
HQData.RequestVolumeProfileData=function(data, callback)
|
|
3018
3081
|
{
|