hqchart 1.1.13346 → 1.1.13350
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 -11
- package/package.json +1 -1
- package/src/jscommon/umychart.DialogDrawTool.js +2 -1
- package/src/jscommon/umychart.js +184 -68
- package/src/jscommon/umychart.resource/font/drawtool/demo_index.html +26 -3
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.css +7 -3
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.js +1 -1
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.json +7 -0
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.ttf +0 -0
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.woff +0 -0
- package/src/jscommon/umychart.resource/font/drawtool/iconfont.woff2 +0 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +185 -69
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +187 -70
|
@@ -4226,13 +4226,22 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
4226
4226
|
if (IFrameSplitOperator.IsBool(item.IsShowKLineDivTooltip)) chart.IsShowKLineDivTooltip=item.IsShowKLineDivTooltip;
|
|
4227
4227
|
if (option.KLine.MaxRequestMinuteDayCount>0) chart.MaxRequestMinuteDayCount=option.KLine.MaxRequestMinuteDayCount;
|
|
4228
4228
|
if (option.KLine.DrawType) chart.KLineDrawType=option.KLine.DrawType;
|
|
4229
|
-
if (option.KLine.FirstShowDate>19910101) chart.CustomShow={ Date:option.KLine.FirstShowDate, PageSize:option.KLine.PageSize };
|
|
4229
|
+
if (option.KLine.FirstShowDate>19910101) chart.CustomShow={ Date:option.KLine.FirstShowDate, PageSize:option.KLine.PageSize }; //!!已弃用 新的格式"CustomShow"
|
|
4230
4230
|
if (option.KLine.RightSpaceCount>0) chart.RightSpaceCount=option.KLine.RightSpaceCount;
|
|
4231
4231
|
if (option.KLine.ZoomType>0) chart.ZoomType=option.KLine.ZoomType;
|
|
4232
4232
|
if (option.KLine.DataWidth>=1) chart.KLineSize={ DataWidth:option.KLine.DataWidth };
|
|
4233
4233
|
if (IFrameSplitOperator.IsNumber(option.KLine.RightFormula)) chart.RightFormula=option.KLine.RightFormula;
|
|
4234
4234
|
}
|
|
4235
4235
|
|
|
4236
|
+
//自定义显示位置
|
|
4237
|
+
if (option.CustomShow && IFrameSplitOperator.IsPlusNumber(option.CustomShow.Date))
|
|
4238
|
+
{
|
|
4239
|
+
var item=option.CustomShow;
|
|
4240
|
+
chart.CustomShow={ Date:item.Date };
|
|
4241
|
+
if (IFrameSplitOperator.IsNumber(item.Time)) chart.CustomShow.Time=item.Time;
|
|
4242
|
+
if (IFrameSplitOperator.IsPlusNumber(item.PageSize)) chart.CustomShow.PageSize=item.PageSize;
|
|
4243
|
+
}
|
|
4244
|
+
|
|
4236
4245
|
if (option.EnableFlowCapital)
|
|
4237
4246
|
{
|
|
4238
4247
|
var item=option.EnableFlowCapital;
|
|
@@ -59638,6 +59647,7 @@ IChartDrawPicture.ArrayDrawPricture=
|
|
|
59638
59647
|
{ Name:"PriceRange", ClassName:"ChartPriceRange", Create:function() { return new ChartPriceRange(); }},
|
|
59639
59648
|
{ Name:"DateRange", ClassName:"ChartDateRange", Create:function() { return new ChartDateRange(); }},
|
|
59640
59649
|
{ Name:"InfoLine", ClassName:"ChartInfoLine", Create:function() { return new ChartInfoLine(); }},
|
|
59650
|
+
{ Name:"TrendAngle", ClassName:"ChartTrendAngle", Create:function() { return new ChartTrendAngle(); }}
|
|
59641
59651
|
];
|
|
59642
59652
|
|
|
59643
59653
|
IChartDrawPicture.MapIonFont=new Map(
|
|
@@ -59802,6 +59812,103 @@ function ChartDrawPictureLine()
|
|
|
59802
59812
|
}
|
|
59803
59813
|
}
|
|
59804
59814
|
|
|
59815
|
+
//趋势线角度
|
|
59816
|
+
function ChartTrendAngle()
|
|
59817
|
+
{
|
|
59818
|
+
this.newMethod=ChartDrawPictureLine; //派生
|
|
59819
|
+
this.newMethod();
|
|
59820
|
+
delete this.newMethod;
|
|
59821
|
+
|
|
59822
|
+
this.ClassName='ChartTrendAngle';
|
|
59823
|
+
this.AngleLineLength=100;
|
|
59824
|
+
this.AngleLineDash=[3,3];
|
|
59825
|
+
this.Font=12*GetDevicePixelRatio() +"px 微软雅黑";
|
|
59826
|
+
this.Super_SetOption=this.SetOption; //父类函数
|
|
59827
|
+
|
|
59828
|
+
this.SetOption=function(option)
|
|
59829
|
+
{
|
|
59830
|
+
if (this.Super_SetOption) this.Super_SetOption(option);
|
|
59831
|
+
if (option)
|
|
59832
|
+
{
|
|
59833
|
+
if (IFrameSplitOperator.IsNumber(option.AngleLineLength)) this.AngleLineLength=option.AngleLineLength;
|
|
59834
|
+
if (option.Font) this.Font=option.Font;
|
|
59835
|
+
if (option.AngleLineDash) this.AngleLineDash=option.AngleLineDash;
|
|
59836
|
+
}
|
|
59837
|
+
}
|
|
59838
|
+
|
|
59839
|
+
this.Draw=function()
|
|
59840
|
+
{
|
|
59841
|
+
this.LinePoint=[];
|
|
59842
|
+
if (this.IsFrameMinSize()) return;
|
|
59843
|
+
if (!this.IsShow) return;
|
|
59844
|
+
|
|
59845
|
+
var drawPoint=this.CalculateDrawPoint( {IsCheckX:true, IsCheckY:false} );
|
|
59846
|
+
if (!drawPoint) return;
|
|
59847
|
+
if (drawPoint.length!=2) return;
|
|
59848
|
+
|
|
59849
|
+
this.ClipFrame();
|
|
59850
|
+
|
|
59851
|
+
var ptStart=drawPoint[0];
|
|
59852
|
+
var ptEnd=drawPoint[1];
|
|
59853
|
+
|
|
59854
|
+
this.SetLineWidth();
|
|
59855
|
+
this.Canvas.strokeStyle=this.LineColor;
|
|
59856
|
+
this.Canvas.beginPath();
|
|
59857
|
+
this.Canvas.moveTo(ptStart.X,ptStart.Y);
|
|
59858
|
+
this.Canvas.lineTo(ptEnd.X,ptEnd.Y);
|
|
59859
|
+
this.Canvas.stroke();
|
|
59860
|
+
this.RestoreLineWidth();
|
|
59861
|
+
|
|
59862
|
+
this.DrawAngle(ptStart, ptEnd);
|
|
59863
|
+
|
|
59864
|
+
var line={Start:ptStart, End:ptEnd};
|
|
59865
|
+
this.LinePoint.push(line);
|
|
59866
|
+
|
|
59867
|
+
this.DrawPoint(drawPoint); //画点
|
|
59868
|
+
this.Canvas.restore();
|
|
59869
|
+
}
|
|
59870
|
+
|
|
59871
|
+
this.DrawAngle=function(ptStart, ptEnd)
|
|
59872
|
+
{
|
|
59873
|
+
var pixelRatio=GetDevicePixelRatio();
|
|
59874
|
+
var angle=this.CalculateAngle(ptStart.X, ptStart.Y, ptEnd.X, ptEnd.Y); //角度
|
|
59875
|
+
var lineLength=this.AngleLineLength*pixelRatio; //角度线长度
|
|
59876
|
+
var ptRight={ X:ptStart.X+lineLength, Y:ptStart.Y };
|
|
59877
|
+
|
|
59878
|
+
if (this.AngleLineDash) this.Canvas.setLineDash(this.AngleLineDash); //画虚线
|
|
59879
|
+
|
|
59880
|
+
this.Canvas.lineWidth=1*GetDevicePixelRatio();
|
|
59881
|
+
this.Canvas.beginPath();
|
|
59882
|
+
this.Canvas.moveTo(ToFixedPoint(ptStart.X),ToFixedPoint(ptStart.Y));
|
|
59883
|
+
this.Canvas.lineTo(ToFixedPoint(ptRight.X),ToFixedPoint(ptRight.Y));
|
|
59884
|
+
this.Canvas.stroke();
|
|
59885
|
+
|
|
59886
|
+
this.Canvas.beginPath();
|
|
59887
|
+
if (angle<=180)
|
|
59888
|
+
{
|
|
59889
|
+
this.Canvas.arc(ptStart.X,ToFixedPoint(ptStart.Y),lineLength,0,(Math.PI / 180)*(360-angle), true);
|
|
59890
|
+
var text=`${angle.toFixed(0)}°`;
|
|
59891
|
+
}
|
|
59892
|
+
else
|
|
59893
|
+
{
|
|
59894
|
+
this.Canvas.arc(ptStart.X,ToFixedPoint(ptStart.Y),lineLength,0,(Math.PI / 180)*(360-angle), false);
|
|
59895
|
+
var text=`${(angle-360).toFixed(0)}°`;
|
|
59896
|
+
}
|
|
59897
|
+
|
|
59898
|
+
this.Canvas.stroke();
|
|
59899
|
+
|
|
59900
|
+
this.Canvas.textAlign="left";
|
|
59901
|
+
this.Canvas.textBaseline="middle";
|
|
59902
|
+
this.Canvas.font=this.Font;
|
|
59903
|
+
this.Canvas.fillStyle=this.LineColor;
|
|
59904
|
+
|
|
59905
|
+
if (this.AngleLineDash) this.Canvas.setLineDash([]);
|
|
59906
|
+
|
|
59907
|
+
|
|
59908
|
+
this.Canvas.fillText(text,ptRight.X+5,ptRight.Y);
|
|
59909
|
+
}
|
|
59910
|
+
}
|
|
59911
|
+
|
|
59805
59912
|
//画图工具-涂鸦线段 Y轴关联数值, X轴不关联
|
|
59806
59913
|
function ChartDrawGraffitiLine()
|
|
59807
59914
|
{
|
|
@@ -72081,7 +72188,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
72081
72188
|
this.SourceDataLimit=new Map(); //每个周期缓存数据最大个数 key=周期 value=最大个数
|
|
72082
72189
|
this.CtrlMoveStep=5; //Ctrl+(Left/Right) 移动数据个数
|
|
72083
72190
|
|
|
72084
|
-
this.CustomShow=null; //首先显示的K线的起始日期 { Date
|
|
72191
|
+
this.CustomShow=null; //首先显示的K线的起始日期 { Date:日期, Time:时间, PageSize:}
|
|
72085
72192
|
this.ZoomType=0; //缩放模式 0=最右边固定缩放, 1=十字光标两边缩放
|
|
72086
72193
|
this.IsZoomLockRight=false;
|
|
72087
72194
|
this.KLineSize=null; //{ DataWidth:, }
|
|
@@ -72667,47 +72774,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
72667
72774
|
var hisData=this.ChartOperator_Temp_GetHistroyData();
|
|
72668
72775
|
if (!hisData) return; //数据还没有到达
|
|
72669
72776
|
|
|
72670
|
-
var index=
|
|
72671
|
-
if (ChartData.IsDayPeriod(this.Period,true))
|
|
72672
|
-
{
|
|
72673
|
-
for(var i=0;i<hisData.Data.length;++i)
|
|
72674
|
-
{
|
|
72675
|
-
var item=hisData.Data[i];
|
|
72676
|
-
if (item.Date>=obj.Date)
|
|
72677
|
-
{
|
|
72678
|
-
index=i;
|
|
72679
|
-
break;
|
|
72680
|
-
}
|
|
72681
|
-
}
|
|
72682
|
-
}
|
|
72683
|
-
else if (ChartData.IsMinutePeriod(this.Period,true))
|
|
72684
|
-
{
|
|
72685
|
-
let findTime=obj.Time;
|
|
72686
|
-
if (IFrameSplitOperator.IsPlusNumber(findTime))
|
|
72687
|
-
{
|
|
72688
|
-
for(var i=0;i<hisData.Data.length;++i)
|
|
72689
|
-
{
|
|
72690
|
-
var item=hisData.Data[i];
|
|
72691
|
-
if (item.Date>obj.Date || (item.Date==obj.Date && item.Time>=findTime))
|
|
72692
|
-
{
|
|
72693
|
-
index=i;
|
|
72694
|
-
break;
|
|
72695
|
-
}
|
|
72696
|
-
}
|
|
72697
|
-
}
|
|
72698
|
-
else //只有日期
|
|
72699
|
-
{
|
|
72700
|
-
for(var i=0;i<hisData.Data.length;++i)
|
|
72701
|
-
{
|
|
72702
|
-
var item=hisData.Data[i];
|
|
72703
|
-
if (item.Date>=obj.Date)
|
|
72704
|
-
{
|
|
72705
|
-
index=i;
|
|
72706
|
-
break;
|
|
72707
|
-
}
|
|
72708
|
-
}
|
|
72709
|
-
}
|
|
72710
|
-
}
|
|
72777
|
+
var index=this.ChartOperator_GetIndex_ByDateTime(hisData, obj, this.Period, 0);
|
|
72711
72778
|
|
|
72712
72779
|
if (index===null)
|
|
72713
72780
|
{
|
|
@@ -72827,6 +72894,63 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
72827
72894
|
this.UpdatePointByCursorIndex(); //更新十字光标位子
|
|
72828
72895
|
}
|
|
72829
72896
|
|
|
72897
|
+
//定位K线的索引
|
|
72898
|
+
//searchType 0模糊匹配 1=精确匹配
|
|
72899
|
+
this.ChartOperator_GetIndex_ByDateTime=function(hisData, dateTime, period, searchType)
|
|
72900
|
+
{
|
|
72901
|
+
if (!hisData) return null; //数据还没有到达
|
|
72902
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(hisData.Data)) return null;
|
|
72903
|
+
if (!IFrameSplitOperator.IsPlusNumber(dateTime.Date) || dateTime.Date<19810101) return null;
|
|
72904
|
+
|
|
72905
|
+
if (ChartData.IsDayPeriod(period, true))
|
|
72906
|
+
{
|
|
72907
|
+
for(var i=0;i<hisData.Data.length;++i)
|
|
72908
|
+
{
|
|
72909
|
+
var item=hisData.Data[i];
|
|
72910
|
+
if (searchType==1)
|
|
72911
|
+
{
|
|
72912
|
+
if (item.Date==dateTime.Date) return i;
|
|
72913
|
+
}
|
|
72914
|
+
else
|
|
72915
|
+
{
|
|
72916
|
+
if (item.Date>=dateTime.Date) return i;
|
|
72917
|
+
}
|
|
72918
|
+
}
|
|
72919
|
+
|
|
72920
|
+
return null;
|
|
72921
|
+
}
|
|
72922
|
+
|
|
72923
|
+
if (ChartData.IsMinutePeriod(period,true) || ChartData.IsMilliSecondPeriod(period))
|
|
72924
|
+
{
|
|
72925
|
+
var findTime=null;
|
|
72926
|
+
if (IFrameSplitOperator.IsNumber(dateTime.Time)) findTime=dateTime.Time;
|
|
72927
|
+
for(var i=0;i<hisData.Data.length;++i)
|
|
72928
|
+
{
|
|
72929
|
+
var item=hisData.Data[i];
|
|
72930
|
+
if (searchType==1) //精确匹配
|
|
72931
|
+
{
|
|
72932
|
+
if (findTime==null) return null;
|
|
72933
|
+
if (item.Date==dateTime.Date && item.Time==findTime) return i;
|
|
72934
|
+
}
|
|
72935
|
+
else
|
|
72936
|
+
{
|
|
72937
|
+
if (findTime==null) //只有日期
|
|
72938
|
+
{
|
|
72939
|
+
if (item.Date>=dateTime.Date) return i;
|
|
72940
|
+
}
|
|
72941
|
+
else
|
|
72942
|
+
{
|
|
72943
|
+
if (item.Date>dateTime.Date || (item.Date==dateTime.Date && item.Time>=findTime)) return i;
|
|
72944
|
+
}
|
|
72945
|
+
}
|
|
72946
|
+
}
|
|
72947
|
+
|
|
72948
|
+
return null;
|
|
72949
|
+
}
|
|
72950
|
+
|
|
72951
|
+
return null;
|
|
72952
|
+
}
|
|
72953
|
+
|
|
72830
72954
|
this.OnWheel=function(e)
|
|
72831
72955
|
{
|
|
72832
72956
|
JSConsole.Chart.Log('[KLineChartContainer::OnWheel]',e);
|
|
@@ -73445,37 +73569,21 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
73445
73569
|
|
|
73446
73570
|
this.SetCustomShow=function(customShow,hisData)
|
|
73447
73571
|
{
|
|
73448
|
-
|
|
73449
|
-
|
|
73450
|
-
var firstDate=customShow.Date;
|
|
73451
|
-
var index=null;
|
|
73452
|
-
for(var i =0;i<hisData.Data.length;++i)
|
|
73453
|
-
{
|
|
73454
|
-
var item=hisData.Data[i];
|
|
73455
|
-
if (item.Date>=firstDate)
|
|
73456
|
-
{
|
|
73457
|
-
index=i;
|
|
73458
|
-
break;
|
|
73459
|
-
}
|
|
73460
|
-
}
|
|
73572
|
+
var index=this.ChartOperator_GetIndex_ByDateTime(hisData,customShow, this.Period, 0);
|
|
73461
73573
|
if (index===null)
|
|
73462
73574
|
{
|
|
73463
|
-
JSConsole.Chart.Log(
|
|
73575
|
+
JSConsole.Chart.Log("[KLineChartContainer::SetCustomShow] Can't find index by customShow=",customShow);
|
|
73464
73576
|
return;
|
|
73465
73577
|
}
|
|
73466
73578
|
|
|
73467
|
-
|
|
73468
|
-
if (customShow.PageSize>0) count=customShow.PageSize;
|
|
73469
|
-
|
|
73470
|
-
var customShowCount=count;
|
|
73471
|
-
var pageSize=this.GetMaxMinPageSize();
|
|
73472
|
-
if (count>pageSize.Max) customShowCount=pageSize.Max;
|
|
73473
|
-
else if (count<pageSize.Min) customShowCount=pageSize.Min;
|
|
73474
|
-
|
|
73475
|
-
for(var i in this.Frame.SubFrame)
|
|
73579
|
+
if (IFrameSplitOperator.IsPlusNumber(customShow.PageSize)) //调整一屏显示个数 否则使用默认的
|
|
73476
73580
|
{
|
|
73477
|
-
var
|
|
73478
|
-
|
|
73581
|
+
var showCount=customShow.PageSize;
|
|
73582
|
+
for(var i=0;i<this.Frame.SubFrame.length; ++i)
|
|
73583
|
+
{
|
|
73584
|
+
var item =this.Frame.SubFrame[i].Frame;
|
|
73585
|
+
item.XPointCount=showCount;
|
|
73586
|
+
}
|
|
73479
73587
|
}
|
|
73480
73588
|
|
|
73481
73589
|
this.ChartPaint[0].Data.DataOffset=index;
|
|
@@ -76763,6 +76871,14 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
76763
76871
|
}
|
|
76764
76872
|
}
|
|
76765
76873
|
}
|
|
76874
|
+
|
|
76875
|
+
if (option.CustomShow && IFrameSplitOperator.IsPlusNumber(option.CustomShow.Date))
|
|
76876
|
+
{
|
|
76877
|
+
var item=option.CustomShow;
|
|
76878
|
+
this.CustomShow={ Date:item.Date };
|
|
76879
|
+
if (IFrameSplitOperator.IsNumber(item.Time)) this.CustomShow.Time=item.Time;
|
|
76880
|
+
if (IFrameSplitOperator.IsPlusNumber(item.PageSize)) this.CustomShow.PageSize=item.PageSize;
|
|
76881
|
+
}
|
|
76766
76882
|
}
|
|
76767
76883
|
|
|
76768
76884
|
this.ReloadChartDrawPicture();
|
|
@@ -133118,7 +133234,7 @@ function ScrollBarBGChart()
|
|
|
133118
133234
|
|
|
133119
133235
|
|
|
133120
133236
|
|
|
133121
|
-
var HQCHART_VERSION="1.1.
|
|
133237
|
+
var HQCHART_VERSION="1.1.13349";
|
|
133122
133238
|
|
|
133123
133239
|
function PrintHQChartVersion()
|
|
133124
133240
|
{
|
|
@@ -4270,13 +4270,22 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
4270
4270
|
if (IFrameSplitOperator.IsBool(item.IsShowKLineDivTooltip)) chart.IsShowKLineDivTooltip=item.IsShowKLineDivTooltip;
|
|
4271
4271
|
if (option.KLine.MaxRequestMinuteDayCount>0) chart.MaxRequestMinuteDayCount=option.KLine.MaxRequestMinuteDayCount;
|
|
4272
4272
|
if (option.KLine.DrawType) chart.KLineDrawType=option.KLine.DrawType;
|
|
4273
|
-
if (option.KLine.FirstShowDate>19910101) chart.CustomShow={ Date:option.KLine.FirstShowDate, PageSize:option.KLine.PageSize };
|
|
4273
|
+
if (option.KLine.FirstShowDate>19910101) chart.CustomShow={ Date:option.KLine.FirstShowDate, PageSize:option.KLine.PageSize }; //!!已弃用 新的格式"CustomShow"
|
|
4274
4274
|
if (option.KLine.RightSpaceCount>0) chart.RightSpaceCount=option.KLine.RightSpaceCount;
|
|
4275
4275
|
if (option.KLine.ZoomType>0) chart.ZoomType=option.KLine.ZoomType;
|
|
4276
4276
|
if (option.KLine.DataWidth>=1) chart.KLineSize={ DataWidth:option.KLine.DataWidth };
|
|
4277
4277
|
if (IFrameSplitOperator.IsNumber(option.KLine.RightFormula)) chart.RightFormula=option.KLine.RightFormula;
|
|
4278
4278
|
}
|
|
4279
4279
|
|
|
4280
|
+
//自定义显示位置
|
|
4281
|
+
if (option.CustomShow && IFrameSplitOperator.IsPlusNumber(option.CustomShow.Date))
|
|
4282
|
+
{
|
|
4283
|
+
var item=option.CustomShow;
|
|
4284
|
+
chart.CustomShow={ Date:item.Date };
|
|
4285
|
+
if (IFrameSplitOperator.IsNumber(item.Time)) chart.CustomShow.Time=item.Time;
|
|
4286
|
+
if (IFrameSplitOperator.IsPlusNumber(item.PageSize)) chart.CustomShow.PageSize=item.PageSize;
|
|
4287
|
+
}
|
|
4288
|
+
|
|
4280
4289
|
if (option.EnableFlowCapital)
|
|
4281
4290
|
{
|
|
4282
4291
|
var item=option.EnableFlowCapital;
|
|
@@ -59682,6 +59691,7 @@ IChartDrawPicture.ArrayDrawPricture=
|
|
|
59682
59691
|
{ Name:"PriceRange", ClassName:"ChartPriceRange", Create:function() { return new ChartPriceRange(); }},
|
|
59683
59692
|
{ Name:"DateRange", ClassName:"ChartDateRange", Create:function() { return new ChartDateRange(); }},
|
|
59684
59693
|
{ Name:"InfoLine", ClassName:"ChartInfoLine", Create:function() { return new ChartInfoLine(); }},
|
|
59694
|
+
{ Name:"TrendAngle", ClassName:"ChartTrendAngle", Create:function() { return new ChartTrendAngle(); }}
|
|
59685
59695
|
];
|
|
59686
59696
|
|
|
59687
59697
|
IChartDrawPicture.MapIonFont=new Map(
|
|
@@ -59846,6 +59856,103 @@ function ChartDrawPictureLine()
|
|
|
59846
59856
|
}
|
|
59847
59857
|
}
|
|
59848
59858
|
|
|
59859
|
+
//趋势线角度
|
|
59860
|
+
function ChartTrendAngle()
|
|
59861
|
+
{
|
|
59862
|
+
this.newMethod=ChartDrawPictureLine; //派生
|
|
59863
|
+
this.newMethod();
|
|
59864
|
+
delete this.newMethod;
|
|
59865
|
+
|
|
59866
|
+
this.ClassName='ChartTrendAngle';
|
|
59867
|
+
this.AngleLineLength=100;
|
|
59868
|
+
this.AngleLineDash=[3,3];
|
|
59869
|
+
this.Font=12*GetDevicePixelRatio() +"px 微软雅黑";
|
|
59870
|
+
this.Super_SetOption=this.SetOption; //父类函数
|
|
59871
|
+
|
|
59872
|
+
this.SetOption=function(option)
|
|
59873
|
+
{
|
|
59874
|
+
if (this.Super_SetOption) this.Super_SetOption(option);
|
|
59875
|
+
if (option)
|
|
59876
|
+
{
|
|
59877
|
+
if (IFrameSplitOperator.IsNumber(option.AngleLineLength)) this.AngleLineLength=option.AngleLineLength;
|
|
59878
|
+
if (option.Font) this.Font=option.Font;
|
|
59879
|
+
if (option.AngleLineDash) this.AngleLineDash=option.AngleLineDash;
|
|
59880
|
+
}
|
|
59881
|
+
}
|
|
59882
|
+
|
|
59883
|
+
this.Draw=function()
|
|
59884
|
+
{
|
|
59885
|
+
this.LinePoint=[];
|
|
59886
|
+
if (this.IsFrameMinSize()) return;
|
|
59887
|
+
if (!this.IsShow) return;
|
|
59888
|
+
|
|
59889
|
+
var drawPoint=this.CalculateDrawPoint( {IsCheckX:true, IsCheckY:false} );
|
|
59890
|
+
if (!drawPoint) return;
|
|
59891
|
+
if (drawPoint.length!=2) return;
|
|
59892
|
+
|
|
59893
|
+
this.ClipFrame();
|
|
59894
|
+
|
|
59895
|
+
var ptStart=drawPoint[0];
|
|
59896
|
+
var ptEnd=drawPoint[1];
|
|
59897
|
+
|
|
59898
|
+
this.SetLineWidth();
|
|
59899
|
+
this.Canvas.strokeStyle=this.LineColor;
|
|
59900
|
+
this.Canvas.beginPath();
|
|
59901
|
+
this.Canvas.moveTo(ptStart.X,ptStart.Y);
|
|
59902
|
+
this.Canvas.lineTo(ptEnd.X,ptEnd.Y);
|
|
59903
|
+
this.Canvas.stroke();
|
|
59904
|
+
this.RestoreLineWidth();
|
|
59905
|
+
|
|
59906
|
+
this.DrawAngle(ptStart, ptEnd);
|
|
59907
|
+
|
|
59908
|
+
var line={Start:ptStart, End:ptEnd};
|
|
59909
|
+
this.LinePoint.push(line);
|
|
59910
|
+
|
|
59911
|
+
this.DrawPoint(drawPoint); //画点
|
|
59912
|
+
this.Canvas.restore();
|
|
59913
|
+
}
|
|
59914
|
+
|
|
59915
|
+
this.DrawAngle=function(ptStart, ptEnd)
|
|
59916
|
+
{
|
|
59917
|
+
var pixelRatio=GetDevicePixelRatio();
|
|
59918
|
+
var angle=this.CalculateAngle(ptStart.X, ptStart.Y, ptEnd.X, ptEnd.Y); //角度
|
|
59919
|
+
var lineLength=this.AngleLineLength*pixelRatio; //角度线长度
|
|
59920
|
+
var ptRight={ X:ptStart.X+lineLength, Y:ptStart.Y };
|
|
59921
|
+
|
|
59922
|
+
if (this.AngleLineDash) this.Canvas.setLineDash(this.AngleLineDash); //画虚线
|
|
59923
|
+
|
|
59924
|
+
this.Canvas.lineWidth=1*GetDevicePixelRatio();
|
|
59925
|
+
this.Canvas.beginPath();
|
|
59926
|
+
this.Canvas.moveTo(ToFixedPoint(ptStart.X),ToFixedPoint(ptStart.Y));
|
|
59927
|
+
this.Canvas.lineTo(ToFixedPoint(ptRight.X),ToFixedPoint(ptRight.Y));
|
|
59928
|
+
this.Canvas.stroke();
|
|
59929
|
+
|
|
59930
|
+
this.Canvas.beginPath();
|
|
59931
|
+
if (angle<=180)
|
|
59932
|
+
{
|
|
59933
|
+
this.Canvas.arc(ptStart.X,ToFixedPoint(ptStart.Y),lineLength,0,(Math.PI / 180)*(360-angle), true);
|
|
59934
|
+
var text=`${angle.toFixed(0)}°`;
|
|
59935
|
+
}
|
|
59936
|
+
else
|
|
59937
|
+
{
|
|
59938
|
+
this.Canvas.arc(ptStart.X,ToFixedPoint(ptStart.Y),lineLength,0,(Math.PI / 180)*(360-angle), false);
|
|
59939
|
+
var text=`${(angle-360).toFixed(0)}°`;
|
|
59940
|
+
}
|
|
59941
|
+
|
|
59942
|
+
this.Canvas.stroke();
|
|
59943
|
+
|
|
59944
|
+
this.Canvas.textAlign="left";
|
|
59945
|
+
this.Canvas.textBaseline="middle";
|
|
59946
|
+
this.Canvas.font=this.Font;
|
|
59947
|
+
this.Canvas.fillStyle=this.LineColor;
|
|
59948
|
+
|
|
59949
|
+
if (this.AngleLineDash) this.Canvas.setLineDash([]);
|
|
59950
|
+
|
|
59951
|
+
|
|
59952
|
+
this.Canvas.fillText(text,ptRight.X+5,ptRight.Y);
|
|
59953
|
+
}
|
|
59954
|
+
}
|
|
59955
|
+
|
|
59849
59956
|
//画图工具-涂鸦线段 Y轴关联数值, X轴不关联
|
|
59850
59957
|
function ChartDrawGraffitiLine()
|
|
59851
59958
|
{
|
|
@@ -72125,7 +72232,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
72125
72232
|
this.SourceDataLimit=new Map(); //每个周期缓存数据最大个数 key=周期 value=最大个数
|
|
72126
72233
|
this.CtrlMoveStep=5; //Ctrl+(Left/Right) 移动数据个数
|
|
72127
72234
|
|
|
72128
|
-
this.CustomShow=null; //首先显示的K线的起始日期 { Date
|
|
72235
|
+
this.CustomShow=null; //首先显示的K线的起始日期 { Date:日期, Time:时间, PageSize:}
|
|
72129
72236
|
this.ZoomType=0; //缩放模式 0=最右边固定缩放, 1=十字光标两边缩放
|
|
72130
72237
|
this.IsZoomLockRight=false;
|
|
72131
72238
|
this.KLineSize=null; //{ DataWidth:, }
|
|
@@ -72711,47 +72818,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
72711
72818
|
var hisData=this.ChartOperator_Temp_GetHistroyData();
|
|
72712
72819
|
if (!hisData) return; //数据还没有到达
|
|
72713
72820
|
|
|
72714
|
-
var index=
|
|
72715
|
-
if (ChartData.IsDayPeriod(this.Period,true))
|
|
72716
|
-
{
|
|
72717
|
-
for(var i=0;i<hisData.Data.length;++i)
|
|
72718
|
-
{
|
|
72719
|
-
var item=hisData.Data[i];
|
|
72720
|
-
if (item.Date>=obj.Date)
|
|
72721
|
-
{
|
|
72722
|
-
index=i;
|
|
72723
|
-
break;
|
|
72724
|
-
}
|
|
72725
|
-
}
|
|
72726
|
-
}
|
|
72727
|
-
else if (ChartData.IsMinutePeriod(this.Period,true))
|
|
72728
|
-
{
|
|
72729
|
-
let findTime=obj.Time;
|
|
72730
|
-
if (IFrameSplitOperator.IsPlusNumber(findTime))
|
|
72731
|
-
{
|
|
72732
|
-
for(var i=0;i<hisData.Data.length;++i)
|
|
72733
|
-
{
|
|
72734
|
-
var item=hisData.Data[i];
|
|
72735
|
-
if (item.Date>obj.Date || (item.Date==obj.Date && item.Time>=findTime))
|
|
72736
|
-
{
|
|
72737
|
-
index=i;
|
|
72738
|
-
break;
|
|
72739
|
-
}
|
|
72740
|
-
}
|
|
72741
|
-
}
|
|
72742
|
-
else //只有日期
|
|
72743
|
-
{
|
|
72744
|
-
for(var i=0;i<hisData.Data.length;++i)
|
|
72745
|
-
{
|
|
72746
|
-
var item=hisData.Data[i];
|
|
72747
|
-
if (item.Date>=obj.Date)
|
|
72748
|
-
{
|
|
72749
|
-
index=i;
|
|
72750
|
-
break;
|
|
72751
|
-
}
|
|
72752
|
-
}
|
|
72753
|
-
}
|
|
72754
|
-
}
|
|
72821
|
+
var index=this.ChartOperator_GetIndex_ByDateTime(hisData, obj, this.Period, 0);
|
|
72755
72822
|
|
|
72756
72823
|
if (index===null)
|
|
72757
72824
|
{
|
|
@@ -72871,6 +72938,63 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
72871
72938
|
this.UpdatePointByCursorIndex(); //更新十字光标位子
|
|
72872
72939
|
}
|
|
72873
72940
|
|
|
72941
|
+
//定位K线的索引
|
|
72942
|
+
//searchType 0模糊匹配 1=精确匹配
|
|
72943
|
+
this.ChartOperator_GetIndex_ByDateTime=function(hisData, dateTime, period, searchType)
|
|
72944
|
+
{
|
|
72945
|
+
if (!hisData) return null; //数据还没有到达
|
|
72946
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(hisData.Data)) return null;
|
|
72947
|
+
if (!IFrameSplitOperator.IsPlusNumber(dateTime.Date) || dateTime.Date<19810101) return null;
|
|
72948
|
+
|
|
72949
|
+
if (ChartData.IsDayPeriod(period, true))
|
|
72950
|
+
{
|
|
72951
|
+
for(var i=0;i<hisData.Data.length;++i)
|
|
72952
|
+
{
|
|
72953
|
+
var item=hisData.Data[i];
|
|
72954
|
+
if (searchType==1)
|
|
72955
|
+
{
|
|
72956
|
+
if (item.Date==dateTime.Date) return i;
|
|
72957
|
+
}
|
|
72958
|
+
else
|
|
72959
|
+
{
|
|
72960
|
+
if (item.Date>=dateTime.Date) return i;
|
|
72961
|
+
}
|
|
72962
|
+
}
|
|
72963
|
+
|
|
72964
|
+
return null;
|
|
72965
|
+
}
|
|
72966
|
+
|
|
72967
|
+
if (ChartData.IsMinutePeriod(period,true) || ChartData.IsMilliSecondPeriod(period))
|
|
72968
|
+
{
|
|
72969
|
+
var findTime=null;
|
|
72970
|
+
if (IFrameSplitOperator.IsNumber(dateTime.Time)) findTime=dateTime.Time;
|
|
72971
|
+
for(var i=0;i<hisData.Data.length;++i)
|
|
72972
|
+
{
|
|
72973
|
+
var item=hisData.Data[i];
|
|
72974
|
+
if (searchType==1) //精确匹配
|
|
72975
|
+
{
|
|
72976
|
+
if (findTime==null) return null;
|
|
72977
|
+
if (item.Date==dateTime.Date && item.Time==findTime) return i;
|
|
72978
|
+
}
|
|
72979
|
+
else
|
|
72980
|
+
{
|
|
72981
|
+
if (findTime==null) //只有日期
|
|
72982
|
+
{
|
|
72983
|
+
if (item.Date>=dateTime.Date) return i;
|
|
72984
|
+
}
|
|
72985
|
+
else
|
|
72986
|
+
{
|
|
72987
|
+
if (item.Date>dateTime.Date || (item.Date==dateTime.Date && item.Time>=findTime)) return i;
|
|
72988
|
+
}
|
|
72989
|
+
}
|
|
72990
|
+
}
|
|
72991
|
+
|
|
72992
|
+
return null;
|
|
72993
|
+
}
|
|
72994
|
+
|
|
72995
|
+
return null;
|
|
72996
|
+
}
|
|
72997
|
+
|
|
72874
72998
|
this.OnWheel=function(e)
|
|
72875
72999
|
{
|
|
72876
73000
|
JSConsole.Chart.Log('[KLineChartContainer::OnWheel]',e);
|
|
@@ -73489,37 +73613,21 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
73489
73613
|
|
|
73490
73614
|
this.SetCustomShow=function(customShow,hisData)
|
|
73491
73615
|
{
|
|
73492
|
-
|
|
73493
|
-
|
|
73494
|
-
var firstDate=customShow.Date;
|
|
73495
|
-
var index=null;
|
|
73496
|
-
for(var i =0;i<hisData.Data.length;++i)
|
|
73497
|
-
{
|
|
73498
|
-
var item=hisData.Data[i];
|
|
73499
|
-
if (item.Date>=firstDate)
|
|
73500
|
-
{
|
|
73501
|
-
index=i;
|
|
73502
|
-
break;
|
|
73503
|
-
}
|
|
73504
|
-
}
|
|
73616
|
+
var index=this.ChartOperator_GetIndex_ByDateTime(hisData,customShow, this.Period, 0);
|
|
73505
73617
|
if (index===null)
|
|
73506
73618
|
{
|
|
73507
|
-
JSConsole.Chart.Log(
|
|
73619
|
+
JSConsole.Chart.Log("[KLineChartContainer::SetCustomShow] Can't find index by customShow=",customShow);
|
|
73508
73620
|
return;
|
|
73509
73621
|
}
|
|
73510
73622
|
|
|
73511
|
-
|
|
73512
|
-
if (customShow.PageSize>0) count=customShow.PageSize;
|
|
73513
|
-
|
|
73514
|
-
var customShowCount=count;
|
|
73515
|
-
var pageSize=this.GetMaxMinPageSize();
|
|
73516
|
-
if (count>pageSize.Max) customShowCount=pageSize.Max;
|
|
73517
|
-
else if (count<pageSize.Min) customShowCount=pageSize.Min;
|
|
73518
|
-
|
|
73519
|
-
for(var i in this.Frame.SubFrame)
|
|
73623
|
+
if (IFrameSplitOperator.IsPlusNumber(customShow.PageSize)) //调整一屏显示个数 否则使用默认的
|
|
73520
73624
|
{
|
|
73521
|
-
var
|
|
73522
|
-
|
|
73625
|
+
var showCount=customShow.PageSize;
|
|
73626
|
+
for(var i=0;i<this.Frame.SubFrame.length; ++i)
|
|
73627
|
+
{
|
|
73628
|
+
var item =this.Frame.SubFrame[i].Frame;
|
|
73629
|
+
item.XPointCount=showCount;
|
|
73630
|
+
}
|
|
73523
73631
|
}
|
|
73524
73632
|
|
|
73525
73633
|
this.ChartPaint[0].Data.DataOffset=index;
|
|
@@ -76807,6 +76915,14 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
76807
76915
|
}
|
|
76808
76916
|
}
|
|
76809
76917
|
}
|
|
76918
|
+
|
|
76919
|
+
if (option.CustomShow && IFrameSplitOperator.IsPlusNumber(option.CustomShow.Date))
|
|
76920
|
+
{
|
|
76921
|
+
var item=option.CustomShow;
|
|
76922
|
+
this.CustomShow={ Date:item.Date };
|
|
76923
|
+
if (IFrameSplitOperator.IsNumber(item.Time)) this.CustomShow.Time=item.Time;
|
|
76924
|
+
if (IFrameSplitOperator.IsPlusNumber(item.PageSize)) this.CustomShow.PageSize=item.PageSize;
|
|
76925
|
+
}
|
|
76810
76926
|
}
|
|
76811
76927
|
|
|
76812
76928
|
this.ReloadChartDrawPicture();
|
|
@@ -135965,6 +136081,7 @@ function JSDialogDrawTool()
|
|
|
135965
136081
|
{ Title: '线段', ClassName: 'hqchart_drawtool icon-draw_line', Type:0, Data:{ ID:"线段" } },
|
|
135966
136082
|
{ Title: '线段信息', ClassName: 'hqchart_drawtool icon-infoline', Type:0, Data:{ ID:"InfoLine" } },
|
|
135967
136083
|
{ Title: '射线', ClassName: 'hqchart_drawtool icon-draw_rays', Type:0, Data:{ ID:"射线" } },
|
|
136084
|
+
{ Title: "趋势线角度", ClassName:"hqchart_drawtool icon-qushixianjiaodu", Type:0, Data:{ ID:"TrendAngle" }},
|
|
135968
136085
|
{ Title: '标价线', ClassName: 'hqchart_drawtool icon-price_line', Type:0, Data:{ ID:"标价线" } },
|
|
135969
136086
|
{ Title: '垂直线', ClassName: 'hqchart_drawtool icon-vertical_line', Type:0, Data:{ ID:"垂直线" } },
|
|
135970
136087
|
{ Title: '十字线', ClassName: 'hqchart_drawtool icon-tubiao_shizixian', Type:0, Data:{ ID:"十字线" } },
|
|
@@ -136080,7 +136197,7 @@ function JSDialogDrawTool()
|
|
|
136080
136197
|
this.LineColorIndex=0;
|
|
136081
136198
|
this.RandomLineColor=["rgb(255,69,0)", "rgb(0,191,255)", "rgb(255,0,255)", "rgb(255,105,180)"];
|
|
136082
136199
|
this.LineWidth=1*GetDevicePixelRatio();
|
|
136083
|
-
this.ColumnCount=
|
|
136200
|
+
this.ColumnCount=5
|
|
136084
136201
|
|
|
136085
136202
|
this.DragTitle=null;
|
|
136086
136203
|
|
|
@@ -136985,7 +137102,7 @@ function HQChartScriptWorker()
|
|
|
136985
137102
|
|
|
136986
137103
|
|
|
136987
137104
|
|
|
136988
|
-
var HQCHART_VERSION="1.1.
|
|
137105
|
+
var HQCHART_VERSION="1.1.13349";
|
|
136989
137106
|
|
|
136990
137107
|
function PrintHQChartVersion()
|
|
136991
137108
|
{
|