hqchart 1.1.13709 → 1.1.13711
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 +15 -7
- package/package.json +1 -1
- package/src/jscommon/umychart.complier.js +57 -0
- package/src/jscommon/umychart.js +297 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +355 -1
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +355 -1
|
@@ -39895,6 +39895,303 @@ function ChartMACD()
|
|
|
39895
39895
|
}
|
|
39896
39896
|
}
|
|
39897
39897
|
|
|
39898
|
+
function ChartClipColorStick()
|
|
39899
|
+
{
|
|
39900
|
+
this.newMethod=IChartPainting; //派生
|
|
39901
|
+
this.newMethod();
|
|
39902
|
+
delete this.newMethod;
|
|
39903
|
+
|
|
39904
|
+
this.ClassName="ChartClipColorStick";
|
|
39905
|
+
this.UpColor=g_JSChartResource.UpBarColor;
|
|
39906
|
+
this.DownColor=g_JSChartResource.DownBarColor;
|
|
39907
|
+
this.LineWidth=1;
|
|
39908
|
+
//差值线
|
|
39909
|
+
this.DownDiffColor=g_JSChartResource.DownBarColor;
|
|
39910
|
+
this.UpDiffColor=g_JSChartResource.UpBarColor;
|
|
39911
|
+
|
|
39912
|
+
this.BaseLineColor; //基准线
|
|
39913
|
+
|
|
39914
|
+
this.BaseValue=0;
|
|
39915
|
+
this.Super_GetMaxMin=this.GetMaxMin; //父类的方法
|
|
39916
|
+
|
|
39917
|
+
this.SetOption=function(option)
|
|
39918
|
+
{
|
|
39919
|
+
if (!option) return;
|
|
39920
|
+
|
|
39921
|
+
if (option.UpColor) this.UpColor=option.UpColor;
|
|
39922
|
+
if (option.DownColor) this.DownColor=option.DownColor;
|
|
39923
|
+
if (option.DownDiffColor) this.DownDiffColor=option.DownDiffColor;
|
|
39924
|
+
if (option.UpDiffColor) this.UpDiffColor=option.UpDiffColor;
|
|
39925
|
+
if (option.BaseLineColor) this.BaseLineColor=option.BaseLineColor;
|
|
39926
|
+
if (IFrameSplitOperator.IsNumber(option.BaseValue)) this.BaseValue=option.BaseValue;
|
|
39927
|
+
}
|
|
39928
|
+
|
|
39929
|
+
this.Draw=function()
|
|
39930
|
+
{
|
|
39931
|
+
if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
39932
|
+
if (this.IsShowIndexTitleOnly()) return;
|
|
39933
|
+
if (this.IsHideScriptIndex()) return;
|
|
39934
|
+
|
|
39935
|
+
if (this.NotSupportMessage)
|
|
39936
|
+
{
|
|
39937
|
+
this.DrawNotSupportmessage();
|
|
39938
|
+
return;
|
|
39939
|
+
}
|
|
39940
|
+
|
|
39941
|
+
this.Canvas.save();
|
|
39942
|
+
var dataWidth=this.ChartFrame.DataWidth;
|
|
39943
|
+
var lineWidth=this.LineWidth*GetDevicePixelRatio();
|
|
39944
|
+
if (this.LineWidth==50) lineWidth=dataWidth;
|
|
39945
|
+
else if (lineWidth>dataWidth) lineWidth=dataWidth;
|
|
39946
|
+
|
|
39947
|
+
if (IFrameSplitOperator.IsNumber(this.BaseValue) && this.BaseValue!=0)
|
|
39948
|
+
{
|
|
39949
|
+
this.DrawBaseLine();
|
|
39950
|
+
|
|
39951
|
+
if (this.BaseValue>0) this.DrawBars(lineWidth, true);
|
|
39952
|
+
else this.DrawBars(lineWidth, false);
|
|
39953
|
+
}
|
|
39954
|
+
else
|
|
39955
|
+
{
|
|
39956
|
+
//上下分开画
|
|
39957
|
+
this.DrawBars(lineWidth, true);
|
|
39958
|
+
this.DrawBars(lineWidth, false);
|
|
39959
|
+
}
|
|
39960
|
+
|
|
39961
|
+
|
|
39962
|
+
this.Canvas.restore();
|
|
39963
|
+
}
|
|
39964
|
+
|
|
39965
|
+
this.DrawBars=function(lineWidth, bUpBar)
|
|
39966
|
+
{
|
|
39967
|
+
var isMinute=this.IsMinuteFrame();
|
|
39968
|
+
var dataWidth=this.ChartFrame.DataWidth;
|
|
39969
|
+
var distanceWidth=this.ChartFrame.DistanceWidth;
|
|
39970
|
+
var xPointCount=this.ChartFrame.XPointCount;
|
|
39971
|
+
var isHSCreen=this.ChartFrame.IsHScreen===true;
|
|
39972
|
+
|
|
39973
|
+
if (isHSCreen)
|
|
39974
|
+
{
|
|
39975
|
+
var border=this.ChartBorder.GetHScreenBorder();
|
|
39976
|
+
var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
39977
|
+
var chartright=border.BottomEx;
|
|
39978
|
+
var lockRect=this.GetLockRect();
|
|
39979
|
+
if (lockRect) chartright=lockRect.Top;
|
|
39980
|
+
}
|
|
39981
|
+
else
|
|
39982
|
+
{
|
|
39983
|
+
var border=this.ChartBorder.GetBorder();
|
|
39984
|
+
var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
39985
|
+
|
|
39986
|
+
var chartright=border.RightEx;
|
|
39987
|
+
var lockRect=this.GetLockRect();
|
|
39988
|
+
if (lockRect) chartright=lockRect.Left;
|
|
39989
|
+
}
|
|
39990
|
+
|
|
39991
|
+
var yBottom=this.ChartFrame.GetYFromData(this.BaseValue);
|
|
39992
|
+
var aryBar=[], aryDiffBar=[];
|
|
39993
|
+
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
|
|
39994
|
+
{
|
|
39995
|
+
var value=this.Data.Data[i];
|
|
39996
|
+
if (value==null) continue;
|
|
39997
|
+
if (bUpBar)
|
|
39998
|
+
{
|
|
39999
|
+
if (value<0) continue;
|
|
40000
|
+
}
|
|
40001
|
+
else
|
|
40002
|
+
{
|
|
40003
|
+
if (value>=0) continue;
|
|
40004
|
+
}
|
|
40005
|
+
|
|
40006
|
+
if (isMinute)
|
|
40007
|
+
{
|
|
40008
|
+
var x=this.ChartFrame.GetXFromIndex(j);
|
|
40009
|
+
}
|
|
40010
|
+
else
|
|
40011
|
+
{
|
|
40012
|
+
var left=xOffset;
|
|
40013
|
+
var right=xOffset+dataWidth;
|
|
40014
|
+
if (right>chartright) break;
|
|
40015
|
+
var x=left+(right-left)/2;
|
|
40016
|
+
}
|
|
40017
|
+
|
|
40018
|
+
if (x>chartright) break;
|
|
40019
|
+
|
|
40020
|
+
var bDiffBar=false;
|
|
40021
|
+
var diffValue=null;
|
|
40022
|
+
if (this.BaseValue>0)
|
|
40023
|
+
{
|
|
40024
|
+
if (value<this.BaseValue)
|
|
40025
|
+
{
|
|
40026
|
+
bDiffBar=true;
|
|
40027
|
+
diffValue=this.BaseValue-(this.BaseValue-value);
|
|
40028
|
+
}
|
|
40029
|
+
}
|
|
40030
|
+
else if (this.BaseValue<0)
|
|
40031
|
+
{
|
|
40032
|
+
if (value>this.BaseValue)
|
|
40033
|
+
{
|
|
40034
|
+
bDiffBar=true;
|
|
40035
|
+
diffValue=this.BaseValue+(value-this.BaseValue)
|
|
40036
|
+
}
|
|
40037
|
+
}
|
|
40038
|
+
|
|
40039
|
+
if (!bDiffBar)
|
|
40040
|
+
{
|
|
40041
|
+
var y=this.ChartFrame.GetYFromData(value);
|
|
40042
|
+
aryBar.push({X:x, Y:y});
|
|
40043
|
+
}
|
|
40044
|
+
else
|
|
40045
|
+
{
|
|
40046
|
+
var y=this.ChartFrame.GetYFromData(diffValue);
|
|
40047
|
+
aryDiffBar.push({X:x, Y:y});
|
|
40048
|
+
}
|
|
40049
|
+
}
|
|
40050
|
+
|
|
40051
|
+
this.Canvas.lineWidth=lineWidth;
|
|
40052
|
+
if (bUpBar) this.Canvas.strokeStyle=this.UpColor;
|
|
40053
|
+
else this.Canvas.strokeStyle=this.DownColor;
|
|
40054
|
+
|
|
40055
|
+
this.DrawStick(aryBar,lineWidth,yBottom);
|
|
40056
|
+
|
|
40057
|
+
if (this.BaseValue>0)
|
|
40058
|
+
{
|
|
40059
|
+
this.Canvas.strokeStyle=this.UpDiffColor;
|
|
40060
|
+
this.DrawStick(aryDiffBar,lineWidth,yBottom);
|
|
40061
|
+
}
|
|
40062
|
+
else if (this.BaseValue<0)
|
|
40063
|
+
{
|
|
40064
|
+
this.Canvas.strokeStyle=this.DownDiffColor;
|
|
40065
|
+
this.DrawStick(aryDiffBar,lineWidth,yBottom);
|
|
40066
|
+
}
|
|
40067
|
+
|
|
40068
|
+
}
|
|
40069
|
+
|
|
40070
|
+
this.DrawStick=function(aryData, lineWidth, yBottom)
|
|
40071
|
+
{
|
|
40072
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryData)) return;
|
|
40073
|
+
|
|
40074
|
+
var isHSCreen=this.ChartFrame.IsHScreen===true;
|
|
40075
|
+
var drawCount=0;
|
|
40076
|
+
this.Canvas.beginPath();
|
|
40077
|
+
for(var i=0; i<aryData.length; ++i)
|
|
40078
|
+
{
|
|
40079
|
+
var item=aryData[i];
|
|
40080
|
+
var y=item.Y;
|
|
40081
|
+
var xFix=ToFixedPoint2(lineWidth, item.X); //毛边修正
|
|
40082
|
+
|
|
40083
|
+
if (isHSCreen)
|
|
40084
|
+
{
|
|
40085
|
+
this.Canvas.moveTo(yBottom,ToFixedPoint(x));
|
|
40086
|
+
this.Canvas.lineTo(y,ToFixedPoint(x));
|
|
40087
|
+
}
|
|
40088
|
+
else
|
|
40089
|
+
{
|
|
40090
|
+
this.Canvas.moveTo(xFix,yBottom);
|
|
40091
|
+
this.Canvas.lineTo(xFix,y);
|
|
40092
|
+
}
|
|
40093
|
+
|
|
40094
|
+
++drawCount;
|
|
40095
|
+
}
|
|
40096
|
+
|
|
40097
|
+
if (drawCount>0) this.Canvas.stroke();
|
|
40098
|
+
}
|
|
40099
|
+
|
|
40100
|
+
this.DrawBaseLine=function()
|
|
40101
|
+
{
|
|
40102
|
+
if (!IFrameSplitOperator.IsNumber(this.BaseValue) || this.BaseValue==0) return;
|
|
40103
|
+
if (!this.BaseLineColor) return;
|
|
40104
|
+
|
|
40105
|
+
var isHSCreen=this.ChartFrame.IsHScreen===true;
|
|
40106
|
+
var border=this.ChartFrame.GetBorder();
|
|
40107
|
+
var y=this.ChartFrame.GetYFromData(this.BaseValue);
|
|
40108
|
+
|
|
40109
|
+
this.Canvas.strokeStyle=this.BaseLineColor;
|
|
40110
|
+
this.Canvas.lineWidth=1*GetDevicePixelRatio();
|
|
40111
|
+
|
|
40112
|
+
if (isHSCreen)
|
|
40113
|
+
{
|
|
40114
|
+
|
|
40115
|
+
}
|
|
40116
|
+
else
|
|
40117
|
+
{
|
|
40118
|
+
var yFix=ToFixedPoint(y);
|
|
40119
|
+
this.Canvas.beginPath();
|
|
40120
|
+
this.Canvas.moveTo(border.Left,yFix);
|
|
40121
|
+
this.Canvas.lineTo(border.Right,yFix);
|
|
40122
|
+
this.Canvas.stroke();
|
|
40123
|
+
}
|
|
40124
|
+
}
|
|
40125
|
+
|
|
40126
|
+
this.GetMaxMin=function()
|
|
40127
|
+
{
|
|
40128
|
+
if (!IFrameSplitOperator.IsNumber(this.BaseValue) || this.BaseValue==0)
|
|
40129
|
+
return this.Super_GetMaxMin();
|
|
40130
|
+
|
|
40131
|
+
var xPointCount=this.ChartFrame.XPointCount;
|
|
40132
|
+
var start=this.Data.DataOffset;
|
|
40133
|
+
if (this.ChartFrame.GlobalOption && this.ChartFrame.GlobalOption.IsValueFullRange)
|
|
40134
|
+
{
|
|
40135
|
+
start=0;
|
|
40136
|
+
xPointCount=this.Data.Data.length;
|
|
40137
|
+
}
|
|
40138
|
+
|
|
40139
|
+
var range={ Min:null, Max:null }, maxDiffValue=null; //基准值的差值
|
|
40140
|
+
if(!this.Data || !this.Data.Data) return range;
|
|
40141
|
+
|
|
40142
|
+
if (this.BaseValue>0) range.Min=this.BaseValue;
|
|
40143
|
+
else range.Max=this.BaseValue;
|
|
40144
|
+
|
|
40145
|
+
for(var i=start,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
|
|
40146
|
+
{
|
|
40147
|
+
var value=this.Data.Data[i];
|
|
40148
|
+
if (value==null || isNaN(value)) continue;
|
|
40149
|
+
|
|
40150
|
+
if (this.BaseValue>0)
|
|
40151
|
+
{
|
|
40152
|
+
if (value<0) continue;
|
|
40153
|
+
|
|
40154
|
+
if (value<this.BaseValue)
|
|
40155
|
+
{
|
|
40156
|
+
var diffValue=this.BaseValue-value;
|
|
40157
|
+
if (maxDiffValue==null || maxDiffValue<diffValue) maxDiffValue=diffValue;
|
|
40158
|
+
continue;
|
|
40159
|
+
}
|
|
40160
|
+
}
|
|
40161
|
+
else
|
|
40162
|
+
{
|
|
40163
|
+
if (value>0) continue;
|
|
40164
|
+
|
|
40165
|
+
if (value>this.BaseValue)
|
|
40166
|
+
{
|
|
40167
|
+
var diffValue=value-this.BaseValue;
|
|
40168
|
+
if (maxDiffValue==null || maxDiffValue<diffValue) maxDiffValue=diffValue;
|
|
40169
|
+
continue;
|
|
40170
|
+
}
|
|
40171
|
+
}
|
|
40172
|
+
|
|
40173
|
+
if (range.Max==null) range.Max=value;
|
|
40174
|
+
if (range.Min==null) range.Min=value;
|
|
40175
|
+
|
|
40176
|
+
if (range.Max<value) range.Max=value;
|
|
40177
|
+
if (range.Min>value) range.Min=value;
|
|
40178
|
+
}
|
|
40179
|
+
|
|
40180
|
+
if (this.BaseValue>0)
|
|
40181
|
+
{
|
|
40182
|
+
if (IFrameSplitOperator.IsNumber(maxDiffValue) && IFrameSplitOperator.IsNumber(range.Min))
|
|
40183
|
+
range.Min-=maxDiffValue;
|
|
40184
|
+
}
|
|
40185
|
+
else
|
|
40186
|
+
{
|
|
40187
|
+
if (IFrameSplitOperator.IsNumber(maxDiffValue) && IFrameSplitOperator.IsNumber(range.Max))
|
|
40188
|
+
range.Max+=maxDiffValue;
|
|
40189
|
+
}
|
|
40190
|
+
|
|
40191
|
+
return range;
|
|
40192
|
+
}
|
|
40193
|
+
}
|
|
40194
|
+
|
|
39898
40195
|
//柱子
|
|
39899
40196
|
function ChartBar()
|
|
39900
40197
|
{
|
|
@@ -118024,6 +118321,8 @@ var SCRIPT_CHART_NAME=
|
|
|
118024
118321
|
OVERLAY_BARS:"OVERLAY_BARS", //叠加柱子图
|
|
118025
118322
|
KLINE_TABLE:"KLINE_TABLE",
|
|
118026
118323
|
SCATTER_PLOT:"SCATTER_PLOT", //散点图
|
|
118324
|
+
|
|
118325
|
+
CLIP_COLOR_STICK:"CLIP_COLOR_STICK", //上下柱子 裁剪
|
|
118027
118326
|
}
|
|
118028
118327
|
|
|
118029
118328
|
|
|
@@ -119782,6 +120081,33 @@ function ScriptIndex(name,script,args,option)
|
|
|
119782
120081
|
hqChart.ChartPaint.push(chart);
|
|
119783
120082
|
}
|
|
119784
120083
|
|
|
120084
|
+
this.CreateClipColorStick=function(hqChart,windowIndex,varItem,id)
|
|
120085
|
+
{
|
|
120086
|
+
var chart=new ChartClipColorStick();
|
|
120087
|
+
chart.Canvas=hqChart.Canvas;
|
|
120088
|
+
chart.Name=varItem.Name;
|
|
120089
|
+
chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;
|
|
120090
|
+
chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;
|
|
120091
|
+
chart.HQChart=hqChart;
|
|
120092
|
+
chart.Identify=this.Guid;
|
|
120093
|
+
|
|
120094
|
+
chart.Data.Data=varItem.Draw.DrawData;
|
|
120095
|
+
if (varItem.Option && chart.SetOption) chart.SetOption(varItem.Option);
|
|
120096
|
+
hqChart.ChartPaint.push(chart);
|
|
120097
|
+
|
|
120098
|
+
var titleIndex=windowIndex+1;
|
|
120099
|
+
if (varItem.IsShowTitle===false)
|
|
120100
|
+
{
|
|
120101
|
+
|
|
120102
|
+
}
|
|
120103
|
+
else
|
|
120104
|
+
{
|
|
120105
|
+
var clrTitle=this.GetDefaultColor(id);
|
|
120106
|
+
if (varItem.Option && varItem.Option.TitleColor) clrTitle=this.GetColor(varItem.Option.TitleColor);
|
|
120107
|
+
hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(chart.Data,varItem.Name,clrTitle);
|
|
120108
|
+
}
|
|
120109
|
+
}
|
|
120110
|
+
|
|
119785
120111
|
this.CreateColorKLine=function(hqChart,windowIndex,varItem,i)
|
|
119786
120112
|
{
|
|
119787
120113
|
let chart=new ChartColorKline();
|
|
@@ -120099,6 +120425,9 @@ function ScriptIndex(name,script,args,option)
|
|
|
120099
120425
|
case SCRIPT_CHART_NAME.SCATTER_PLOT:
|
|
120100
120426
|
this.CreateScatterPlot(hqChart,windowIndex,item,i);
|
|
120101
120427
|
break;
|
|
120428
|
+
case SCRIPT_CHART_NAME.CLIP_COLOR_STICK:
|
|
120429
|
+
this.CreateClipColorStick(hqChart,windowIndex,item,i);
|
|
120430
|
+
break;
|
|
120102
120431
|
default:
|
|
120103
120432
|
{
|
|
120104
120433
|
var find=g_ScriptIndexChartFactory.Get(item.Draw.DrawType); //外部挂接
|
|
@@ -122534,6 +122863,20 @@ function APIScriptIndex(name,script,args,option, isOverlay)
|
|
|
122534
122863
|
|
|
122535
122864
|
result.push(outVarItem);
|
|
122536
122865
|
}
|
|
122866
|
+
else if (draw.DrawType==SCRIPT_CHART_NAME.CLIP_COLOR_STICK)
|
|
122867
|
+
{
|
|
122868
|
+
drawItem.Name=draw.Name;
|
|
122869
|
+
drawItem.Type=draw.Type;
|
|
122870
|
+
drawItem.DrawType=draw.DrawType;
|
|
122871
|
+
drawItem.DrawData=this.FittingArray(draw.Data,date,time,hqChart);
|
|
122872
|
+
|
|
122873
|
+
outVarItem.Draw=drawItem;
|
|
122874
|
+
if (draw.LineWidth) outVarItem.LineWidth=draw.LineWidth;
|
|
122875
|
+
if (draw.UpColor) outVarItem.UpColor=draw.UpColor;
|
|
122876
|
+
if (draw.DownColor) outVarItem.DownColor=draw.DownColor;
|
|
122877
|
+
|
|
122878
|
+
result.push(outVarItem);
|
|
122879
|
+
}
|
|
122537
122880
|
else
|
|
122538
122881
|
{
|
|
122539
122882
|
var find=g_ScriptIndexChartFactory.Get(draw.DrawType); //外部挂接
|
|
@@ -122799,6 +123142,17 @@ function APIScriptIndex(name,script,args,option, isOverlay)
|
|
|
122799
123142
|
|
|
122800
123143
|
result.push(outVarItem);
|
|
122801
123144
|
}
|
|
123145
|
+
else if (draw.DrawType==SCRIPT_CHART_NAME.CLIP_COLOR_STICK)
|
|
123146
|
+
{
|
|
123147
|
+
drawItem.Name=draw.Name;
|
|
123148
|
+
drawItem.Type=draw.Type;
|
|
123149
|
+
drawItem.DrawType=draw.DrawType;
|
|
123150
|
+
drawItem.DrawData=this.FittingMinuteArray(draw.Data,date,time,hqChart);
|
|
123151
|
+
|
|
123152
|
+
outVarItem.Draw=drawItem;
|
|
123153
|
+
if (draw.Option) outVarItem.Option=draw.Option;
|
|
123154
|
+
result.push(outVarItem);
|
|
123155
|
+
}
|
|
122802
123156
|
else if (draw.DrawType=='MULTI_LINE')
|
|
122803
123157
|
{
|
|
122804
123158
|
drawItem.Text=draw.Text;
|
|
@@ -137784,7 +138138,7 @@ function ScrollBarBGChart()
|
|
|
137784
138138
|
|
|
137785
138139
|
|
|
137786
138140
|
|
|
137787
|
-
var HQCHART_VERSION="1.1.
|
|
138141
|
+
var HQCHART_VERSION="1.1.13710";
|
|
137788
138142
|
|
|
137789
138143
|
function PrintHQChartVersion()
|
|
137790
138144
|
{
|