Skip to content

Commit

Permalink
ver 11135
Browse files Browse the repository at this point in the history
11134 增加支持钉钉小程序
11133 小程序指标计算引擎网络请求使用统一函数
11132 小程序网络通讯封装
11130 分时图标题栏显示最有一条数据,新增加格式
11126 成交量分布图-可视范围 增加指标标题数据显示
  • Loading branch information
jones2000 committed Jun 10, 2022
1 parent 9a6d8ad commit fac720e
Show file tree
Hide file tree
Showing 12 changed files with 687 additions and 59 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,9 @@ React 例子:[demo-react.md](/教程/demo-react.md) <br>
6. [HQChart实战教程16-K线图风格配色篇-仿火币网H5配色](https://blog.csdn.net/jones2000/article/details/106226272)<br>
7. [HQChart实战教程47-火币网ws数据对接深度图](https://jones2000.blog.csdn.net/article/details/120950486)<br>

## 欧易对接完整教程(付费文章)
1. [HQChart实战教程54-欧易网http+ws数据对接(vue)](https://blog.csdn.net/jones2000/article/details/125213143)<br>

## 源码收费
1. [HQChart实战教程36-数字货币币安对接-uniapp版本](https://blog.csdn.net/jones2000/article/details/114468807)<br>
2. [HQChart实战教程41-新浪+腾讯A股数据源对接-uniapp版本](https://blog.csdn.net/jones2000/article/details/117139756)<br>
Expand Down
111 changes: 107 additions & 4 deletions umychart_uniapp_h5/umychart.uniapp.h5.js
Original file line number Diff line number Diff line change
Expand Up @@ -4880,6 +4880,9 @@ function JSChart(divElement, bOffscreen)
if(IFrameSplitOperator.IsBool(item.IsShowTime)) chart.TitlePaint[0].IsShowTime=item.IsShowTime;
if(IFrameSplitOperator.IsBool(item.IsTitleShowLatestData)) chart.IsTitleShowLatestData=item.IsTitleShowLatestData;
if(IFrameSplitOperator.IsBool(item.IsAlwaysShowLastData)) chart.TitlePaint[0].IsAlwaysShowLastData=item.IsAlwaysShowLastData;
if(IFrameSplitOperator.IsNumber(item.ShowLastDataFormat)) chart.TitlePaint[0].ShowLastDataFormat=item.ShowLastDataFormat;


//if(option.KLineTitle.IsShow == false) chart.TitlePaint[0].IsShow = false;
}

Expand Down Expand Up @@ -8050,7 +8053,8 @@ function JSChartContainer(uielement, OffscreenElement)
if (!item.IsDynamic) continue;

item.CursorIndex=this.CursorIndex;
if (item.ClassName=='DynamicChartTitlePainting') item.OnDrawEvent=eventIndexTitleDraw
item.LastPoint=this.LastPoint;
if (item.ClassName=='DynamicChartTitlePainting') item.OnDrawEvent=eventIndexTitleDraw
else item.OnDrawEvent=eventTitleDraw;

if (item.OnDrawEvent)
Expand Down Expand Up @@ -8214,6 +8218,7 @@ function JSChartContainer(uielement, OffscreenElement)
if (!item.IsDynamic) continue;

item.CursorIndex=this.CursorIndex;
item.LastPoint=this.LastPoint;
if (item.OnDrawEvent)
{
item.OnDrawEvent.FunctionName='DrawDynamicInfo';
Expand Down Expand Up @@ -41519,6 +41524,7 @@ function IChartTitlePainting()
this.IsDynamic=false; //是否是动态标题
this.Position=0; //标题显示位置 0 框架里的标题 1 框架上面
this.CursorIndex; //数据索引
this.LastPoint; //鼠标位置
this.Font=g_JSChartResource.TitleFont;
this.Title; //固定标题(可以为空)
this.TitleColor=g_JSChartResource.DefaultTextColor;
Expand Down Expand Up @@ -41874,6 +41880,7 @@ function DynamicMinuteTitlePainting()
this.OnDrawEvent;
this.PointInfo=null;
this.IsAlwaysShowLastData=false; //始终显示最后一个数据
this.ShowLastDataFormat=0; //0=默认 1=更新时间替换时间

this.MultiDayBeforeOpenData; //多日分时图 盘前数据
this.MultiDayAfterCloseData; //多日分时图 收盘数据
Expand Down Expand Up @@ -41994,8 +42001,22 @@ function DynamicMinuteTitlePainting()

if (this.IsShowDate || this.IsShowTime)
{
var text=IFrameSplitOperator.FormatDateTimeString(item.DateTime,this.IsShowDate, this.IsShowTime);
if (!this.DrawText(text,this.DateTimeColor,position)) return;
var bShowUpdateTime=false; //是否显示了更新时间
if (isLastOne && this.ShowLastDataFormat==1)
{
if (this.Data && this.Data.UpdateTime && IFrameSplitOperator.IsNumber(this.Data.UpdateTime.Date) && IFrameSplitOperator.IsNumber(this.Data.UpdateTime.Time))
{
var text=IFrameSplitOperator.FormatTimeString(this.Data.UpdateTime.Time, "HH:MM:SS");
if (!this.DrawText(text,this.DateTimeColor,position)) return;
bShowUpdateTime=true;
}
}

if (!bShowUpdateTime)
{
var text=IFrameSplitOperator.FormatDateTimeString(item.DateTime,this.IsShowDate, this.IsShowTime);
if (!this.DrawText(text,this.DateTimeColor,position)) return;
}
}

var close=item.Close;
Expand Down Expand Up @@ -42051,7 +42072,7 @@ function DynamicMinuteTitlePainting()
if (!this.DrawText(text,this.VolColor,position)) return;
}

if (isLastOne) //显示数据最后的更新时间
if (isLastOne && this.ShowLastDataFormat==0) //显示数据最后的更新时间
{
if (this.Data && this.Data.UpdateTime && IFrameSplitOperator.IsNumber(this.Data.UpdateTime.Date) && IFrameSplitOperator.IsNumber(this.Data.UpdateTime.Time))
{
Expand Down Expand Up @@ -42792,6 +42813,78 @@ function DynamicChartTitlePainting()
return aryText;
}

this.FormatVPVRTitle=function(pt, dataInfo)
{
var chart=dataInfo.Chart;
var aryText=[];

if (chart.VolType==0)
{
var item={ Text:" Up/Down ", Color:this.TitleColor };
aryText.push(item);
}
else
{
var item={ Text:" Total ",Color:this.TitleColor };
aryText.push(item);
}

if (!IFrameSplitOperator.IsNumber(pt.Y)) return aryText;
var top=this.Frame.ChartBorder.GetTopEx();
var bottom=this.Frame.ChartBorder.GetBottomEx();
if (pt.Y<top || pt.Y>bottom) return aryText;
var yPrice=this.Frame.GetYData(pt.Y);

var find=null;
for(var i=0; i<dataInfo.Data.Data.length; ++i)
{
var item=dataInfo.Data.Data[i];
if (yPrice>=item.Price-dataInfo.Data.PriceOffset/2 && yPrice<item.Price+dataInfo.Data.PriceOffset/2)
{
find=item;
break;
}
}

if (!find) return null;

if (chart.VolType==0)
{
var total=0;
for(var i=0;i<find.Vol.length;++i)
{
var volItem=find.Vol[i];
if (!IFrameSplitOperator.IsNumber(volItem.Value)) continue;

var item={ Text:IFrameSplitOperator.FormatVolString(volItem.Value,this.LanguageID) };

total+=volItem.Value;

if (IFrameSplitOperator.IsNumber(volItem.ColorID)) item.Color=chart.BarColor[volItem.ColorID];
else if (volItem.Color) item.Color=volItem.Color;

aryText.push(item);
}

var item={Text:IFrameSplitOperator.FormatVolString(total,this.LanguageID),Color:this.TitleColor};
aryText.push(item);
}
else
{
if (find.TotalVol && IFrameSplitOperator.IsNumber(find.TotalVol.Value))
{
var item={Text:IFrameSplitOperator.FormatVolString(find.TotalVol.Value,this.LanguageID) };
if (IFrameSplitOperator.IsNumber(find.TotalVol.ColorID)) item.Color=chart.BarColor[find.TotalVol.ColorID];
else if (find.TotalVol.Color) item.Color=find.TotalVol.Color;

aryText.push(item);
}
}


return aryText;
}

this.IsShowLastData=function()
{
var isShowLastData=false;
Expand Down Expand Up @@ -43005,6 +43098,12 @@ function DynamicChartTitlePainting()
value=item.Data.Data[0];
valueText=this.FormatValue(value,item);
}
else if (item.ChartClassName=="ChartVolProfileVisibleRange")
{
aryText=this.FormatVPVRTitle(this.LastPoint, item);
if (!aryText) return null;
return { Text:null, ArrayText:aryText };
}
else
{
if (isShowLastData)
Expand Down Expand Up @@ -64960,6 +65059,10 @@ function VolProfileVisibleRangeIndex()
var titleIndex=this.WindowIndex+1;
this.HQChart.TitlePaint[titleIndex].Title ="VPVR";
this.HQChart.TitlePaint[titleIndex].Identify=this.Guid; //指标ID
var titleData=new DynamicTitleData(chart.Data, "VPVR", chart.Data);
titleData.ChartClassName="ChartVolProfileVisibleRange";
titleData.Chart=chart;
this.HQChart.TitlePaint[titleIndex].Data[0]=titleData;
}
}

Expand Down
111 changes: 107 additions & 4 deletions vuehqchart/src/jscommon/umychart.js
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,9 @@ function JSChart(divElement, bOffscreen)
if(IFrameSplitOperator.IsBool(item.IsShowTime)) chart.TitlePaint[0].IsShowTime=item.IsShowTime;
if(IFrameSplitOperator.IsBool(item.IsTitleShowLatestData)) chart.IsTitleShowLatestData=item.IsTitleShowLatestData;
if(IFrameSplitOperator.IsBool(item.IsAlwaysShowLastData)) chart.TitlePaint[0].IsAlwaysShowLastData=item.IsAlwaysShowLastData;
if(IFrameSplitOperator.IsNumber(item.ShowLastDataFormat)) chart.TitlePaint[0].ShowLastDataFormat=item.ShowLastDataFormat;


//if(option.KLineTitle.IsShow == false) chart.TitlePaint[0].IsShow = false;
}

Expand Down Expand Up @@ -3988,7 +3991,8 @@ function JSChartContainer(uielement, OffscreenElement)
if (!item.IsDynamic) continue;

item.CursorIndex=this.CursorIndex;
if (item.ClassName=='DynamicChartTitlePainting') item.OnDrawEvent=eventIndexTitleDraw
item.LastPoint=this.LastPoint;
if (item.ClassName=='DynamicChartTitlePainting') item.OnDrawEvent=eventIndexTitleDraw
else item.OnDrawEvent=eventTitleDraw;

if (item.OnDrawEvent)
Expand Down Expand Up @@ -4152,6 +4156,7 @@ function JSChartContainer(uielement, OffscreenElement)
if (!item.IsDynamic) continue;

item.CursorIndex=this.CursorIndex;
item.LastPoint=this.LastPoint;
if (item.OnDrawEvent)
{
item.OnDrawEvent.FunctionName='DrawDynamicInfo';
Expand Down Expand Up @@ -37457,6 +37462,7 @@ function IChartTitlePainting()
this.IsDynamic=false; //是否是动态标题
this.Position=0; //标题显示位置 0 框架里的标题 1 框架上面
this.CursorIndex; //数据索引
this.LastPoint; //鼠标位置
this.Font=g_JSChartResource.TitleFont;
this.Title; //固定标题(可以为空)
this.TitleColor=g_JSChartResource.DefaultTextColor;
Expand Down Expand Up @@ -37812,6 +37818,7 @@ function DynamicMinuteTitlePainting()
this.OnDrawEvent;
this.PointInfo=null;
this.IsAlwaysShowLastData=false; //始终显示最后一个数据
this.ShowLastDataFormat=0; //0=默认 1=更新时间替换时间

this.MultiDayBeforeOpenData; //多日分时图 盘前数据
this.MultiDayAfterCloseData; //多日分时图 收盘数据
Expand Down Expand Up @@ -37932,8 +37939,22 @@ function DynamicMinuteTitlePainting()

if (this.IsShowDate || this.IsShowTime)
{
var text=IFrameSplitOperator.FormatDateTimeString(item.DateTime,this.IsShowDate, this.IsShowTime);
if (!this.DrawText(text,this.DateTimeColor,position)) return;
var bShowUpdateTime=false; //是否显示了更新时间
if (isLastOne && this.ShowLastDataFormat==1)
{
if (this.Data && this.Data.UpdateTime && IFrameSplitOperator.IsNumber(this.Data.UpdateTime.Date) && IFrameSplitOperator.IsNumber(this.Data.UpdateTime.Time))
{
var text=IFrameSplitOperator.FormatTimeString(this.Data.UpdateTime.Time, "HH:MM:SS");
if (!this.DrawText(text,this.DateTimeColor,position)) return;
bShowUpdateTime=true;
}
}

if (!bShowUpdateTime)
{
var text=IFrameSplitOperator.FormatDateTimeString(item.DateTime,this.IsShowDate, this.IsShowTime);
if (!this.DrawText(text,this.DateTimeColor,position)) return;
}
}

var close=item.Close;
Expand Down Expand Up @@ -37989,7 +38010,7 @@ function DynamicMinuteTitlePainting()
if (!this.DrawText(text,this.VolColor,position)) return;
}

if (isLastOne) //显示数据最后的更新时间
if (isLastOne && this.ShowLastDataFormat==0) //显示数据最后的更新时间
{
if (this.Data && this.Data.UpdateTime && IFrameSplitOperator.IsNumber(this.Data.UpdateTime.Date) && IFrameSplitOperator.IsNumber(this.Data.UpdateTime.Time))
{
Expand Down Expand Up @@ -38730,6 +38751,78 @@ function DynamicChartTitlePainting()
return aryText;
}

this.FormatVPVRTitle=function(pt, dataInfo)
{
var chart=dataInfo.Chart;
var aryText=[];

if (chart.VolType==0)
{
var item={ Text:" Up/Down ", Color:this.TitleColor };
aryText.push(item);
}
else
{
var item={ Text:" Total ",Color:this.TitleColor };
aryText.push(item);
}

if (!IFrameSplitOperator.IsNumber(pt.Y)) return aryText;
var top=this.Frame.ChartBorder.GetTopEx();
var bottom=this.Frame.ChartBorder.GetBottomEx();
if (pt.Y<top || pt.Y>bottom) return aryText;
var yPrice=this.Frame.GetYData(pt.Y);

var find=null;
for(var i=0; i<dataInfo.Data.Data.length; ++i)
{
var item=dataInfo.Data.Data[i];
if (yPrice>=item.Price-dataInfo.Data.PriceOffset/2 && yPrice<item.Price+dataInfo.Data.PriceOffset/2)
{
find=item;
break;
}
}

if (!find) return null;

if (chart.VolType==0)
{
var total=0;
for(var i=0;i<find.Vol.length;++i)
{
var volItem=find.Vol[i];
if (!IFrameSplitOperator.IsNumber(volItem.Value)) continue;

var item={ Text:IFrameSplitOperator.FormatVolString(volItem.Value,this.LanguageID) };

total+=volItem.Value;

if (IFrameSplitOperator.IsNumber(volItem.ColorID)) item.Color=chart.BarColor[volItem.ColorID];
else if (volItem.Color) item.Color=volItem.Color;

aryText.push(item);
}

var item={Text:IFrameSplitOperator.FormatVolString(total,this.LanguageID),Color:this.TitleColor};
aryText.push(item);
}
else
{
if (find.TotalVol && IFrameSplitOperator.IsNumber(find.TotalVol.Value))
{
var item={Text:IFrameSplitOperator.FormatVolString(find.TotalVol.Value,this.LanguageID) };
if (IFrameSplitOperator.IsNumber(find.TotalVol.ColorID)) item.Color=chart.BarColor[find.TotalVol.ColorID];
else if (find.TotalVol.Color) item.Color=find.TotalVol.Color;

aryText.push(item);
}
}


return aryText;
}

this.IsShowLastData=function()
{
var isShowLastData=false;
Expand Down Expand Up @@ -38943,6 +39036,12 @@ function DynamicChartTitlePainting()
value=item.Data.Data[0];
valueText=this.FormatValue(value,item);
}
else if (item.ChartClassName=="ChartVolProfileVisibleRange")
{
aryText=this.FormatVPVRTitle(this.LastPoint, item);
if (!aryText) return null;
return { Text:null, ArrayText:aryText };
}
else
{
if (isShowLastData)
Expand Down Expand Up @@ -60898,6 +60997,10 @@ function VolProfileVisibleRangeIndex()
var titleIndex=this.WindowIndex+1;
this.HQChart.TitlePaint[titleIndex].Title ="VPVR";
this.HQChart.TitlePaint[titleIndex].Identify=this.Guid; //指标ID
var titleData=new DynamicTitleData(chart.Data, "VPVR", chart.Data);
titleData.ChartClassName="ChartVolProfileVisibleRange";
titleData.Chart=chart;
this.HQChart.TitlePaint[titleIndex].Data[0]=titleData;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default {
JSKLineInfoMap:JSKLineInfoMap,
JSCHART_EVENT_ID:JSCHART_EVENT_ID, //可以订阅的事件类型
JSCHART_OPERATOR_ID:JSCHART_OPERATOR_ID, //图形控制类型
JSCHART_DATA_FIELD_ID:JSCHART_DATA_FIELD_ID,//图形字段
JSAlgorithm:JSAlgorithm, //算法类
JSComplier:JSComplier, //指标编译器
JSIndexScript:JSIndexScript, //系统指标库
Expand Down
Loading

0 comments on commit fac720e

Please sign in to comment.