Skip to content

Commit

Permalink
ver 13485
Browse files Browse the repository at this point in the history
13484 增加分钟K线叠加示例
13483 小程序增加中期所后缀'.CFFEX'
13482 增加中期所后缀 .CFFEX
13481 增加叠加K线更新数据示例
13480 DrawInsideHorizontal()调整顶部坐标文字输出位置
13479 小程序DrawInsideHorizontal,调整底部坐标文字输出位置
  • Loading branch information
jones2000 committed Jun 26, 2024
1 parent 9b22d7f commit 4511449
Show file tree
Hide file tree
Showing 18 changed files with 653 additions and 135 deletions.
15 changes: 10 additions & 5 deletions umychart_uniapp_h5/umychart.uniapp.h5.js
Original file line number Diff line number Diff line change
Expand Up @@ -15497,12 +15497,13 @@ function AverageWidthFrame()
if (item.Font != null) this.Canvas.font = item.Font;
this.Canvas.fillStyle = item.TextColor;
this.Canvas.textAlign = "left";
var textHeight=this.Canvas.measureText("擎").width;
var yText=y;
if (y >= bottom - 2)
{
this.Canvas.textBaseline = 'bottom';
}
else if (y <= top + 2)
else if ((y-textHeight/2)<=top)
{
this.Canvas.textBaseline = 'top';
yText+=this.YTextTopOffset;
Expand Down Expand Up @@ -15531,12 +15532,13 @@ function AverageWidthFrame()
if (item.Font != null) this.Canvas.font = item.Font;
this.Canvas.fillStyle = item.TextColor;
this.Canvas.textAlign = "right";
var textHeight=this.Canvas.measureText("擎").width;
var yText=y;
if (y >= bottom - 2)
{
this.Canvas.textBaseline = 'bottom';
}
else if (y <= top + 2)
else if (y-textHeight/2 <= top)
{
this.Canvas.textBaseline = 'top';
yText+=this.YTextTopOffset;
Expand Down Expand Up @@ -75859,7 +75861,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)

//绑定数据
this.UpdateMainData(bindData,lastDataCount);
this.BindInstructionIndexData(bindData); //执行指示脚本
this.UpdateOverlayMinuteRealtimeData(data); //更新叠加股票数据
this.BindInstructionIndexData(bindData); //执行指示脚本

for(var i=0; i<this.Frame.SubFrame.length; ++i)
{
Expand Down Expand Up @@ -80630,7 +80633,7 @@ KLineChartContainer.JsonDataToMinuteRealtimeDataV2=function(data,symbol)
var date = 0, yclose = 1, open = 2, high = 3, low = 4, close = 5, vol = 6, amount = 7, time = 8, position=9;
var orderFlow=JSCHART_DATA_FIELD_ID.KLINE_ORDERFLOW;
var yClose=null;

var aryMinuteData=[];
for (var i = 0; i < overlayData.data.length; ++i)
{
var item = new HistoryData();
Expand Down Expand Up @@ -92878,6 +92881,7 @@ var MARKET_SUFFIX_NAME=
SHFE: '.SHF', //上期所 (Shanghai Futures Exchange) | 上期所-能源
SHFE2:'.SHFE', //上期所 (Shanghai Futures Exchange) | 上期所-能源
CFFEX: '.CFE', //中期所 (China Financial Futures Exchange)
CFFEX2:'.CFFEX', //中期所 (China Financial Futures Exchange)
DCE: '.DCE', //大连商品交易所(Dalian Commodity Exchange)
CZCE: '.CZC', //郑州期货交易所
GZFE:".GZFE", //广州期货交易所
Expand Down Expand Up @@ -93089,6 +93093,7 @@ var MARKET_SUFFIX_NAME=
{
if (!upperSymbol) return false;
if (upperSymbol.indexOf(this.CFFEX) > 0) return true;
if (upperSymbol.indexOf(this.CFFEX2) > 0) return true;

return false;
},
Expand Down Expand Up @@ -134347,7 +134352,7 @@ function ScrollBarBGChart()



var HQCHART_VERSION="1.1.13477";
var HQCHART_VERSION="1.1.13484";

function PrintHQChartVersion()
{
Expand Down
127 changes: 106 additions & 21 deletions vuehqchart/src/jscommon/umychart.NetworkFilterTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -48874,17 +48874,55 @@ HQData.RequestFlowCapitalData=function(data,callback)
callback(hqchartData);
}

HQData.RequestRealtimeData=function(data,callback)
HQData.RequestRealtimeData=function(data, callback)
{
data.PreventDefault=true;
var symbol=data.Request.Data.symbol[0]; //请求的股票代码

console.log(`[HQData::RequestRealtimeData] Symbol=${symbol}`);
if (data.Request.Data.symbol.length>1) //叠加股票
{
var hqchartData={ stock:[], code:0 };
var arySymbol=data.Request.Data.symbol;
for(var i=0;i<arySymbol.length;++i)
{
var symbol=arySymbol[i];
if (i==0)
{
var stock=KLINE_1DAY_DATA.stock[0];
stock.name=symbol;
stock.symbol=symbol;
hqchartData.stock.push(stock);
}
else
{
if (symbol=="399001.sz")
{
var stock=KLINE_1DAY_OVERLAY_DATA2.stock[0];
stock.name=symbol;
stock.symbol=symbol;
hqchartData.stock.push(stock);
}
else
{
var stock=KLINE_1DAY_OVERLAY_DATA.stock[0];
stock.name=symbol;
stock.symbol=symbol;
hqchartData.stock.push(stock);
}

}
}

var hqchartData=KLINE_1DAY_DATA;
hqchartData.stock[0].name=symbol;
hqchartData.stock[0].symbol=symbol;
callback(hqchartData);
callback(hqchartData);
}
else
{
console.log(`[HQData::RequestRealtimeData] Symbol=${symbol}`);
var hqchartData=KLINE_1DAY_DATA;
hqchartData.stock[0].name=symbol;
hqchartData.stock[0].symbol=symbol;
callback(hqchartData);
}
}


Expand All @@ -48908,24 +48946,71 @@ HQData.RequestMinuteRealtimeData=function(data,callback)
data.PreventDefault=true;
var symbol=data.Request.Data.symbol[0]; //请求的股票代码

console.log(`[HQData::RequestMinuteRealtimeData] Symbol=${symbol}`);
if (data.Request.Data.symbol.length>1) //叠加股票
{
var hqchartData=JSON.parse(JSON.stringify(KLINE_1MINUTE_DATA));
hqchartData.overlay=[]; //叠加数据
var arySymbol=data.Request.Data.symbol;
for(var i=0;i<arySymbol.length;++i)
{
var symbol=arySymbol[i];
if (i==0)
{
var kItem=hqchartData.data[0];
var price=kItem[5];
var value=Math.ceil(Math.random()*10)/1000*price;
var bUp=Math.ceil(Math.random()*10)>=5;

if (bUp) price+=value;
else price-=value;
kItem[5]=price;
kItem[3]=Math.max(price, kItem[3]);
kItem[4]=Math.min(price, kItem[4]);

var hqchartData=JSON.parse(JSON.stringify(KLINE_1MINUTE_DATA));
hqchartData.name=symbol;
hqchartData.symbol=symbol;
}
else
{
var testData=JSON.parse(JSON.stringify(KLINE_1MINUTE_DATA2));
var kItem=testData.data[0];
var price=kItem[5];
var value=Math.ceil(Math.random()*10)/1000*price;
var bUp=Math.ceil(Math.random()*10)>=5;

if (bUp) price+=value;
else price-=value;
kItem[5]=price;
kItem[3]=Math.max(price, kItem[3]);
kItem[4]=Math.min(price, kItem[4]);
var stock={ data:testData.data, symbol:symbol, name:symbol };
hqchartData.overlay.push(stock);
}
}

var kItem=hqchartData.data[0];
var price=kItem[5];
var value=Math.ceil(Math.random()*10)/1000*price;
var bUp=Math.ceil(Math.random()*10)>=5;

if (bUp) price+=value;
else price-=value;
kItem[5]=price;
kItem[3]=Math.max(price, kItem[3]);
kItem[4]=Math.min(price, kItem[4]);
callback(hqchartData);
}
else
{
console.log(`[HQData::RequestMinuteRealtimeData] Symbol=${symbol}`);

var hqchartData=JSON.parse(JSON.stringify(KLINE_1MINUTE_DATA));

hqchartData.name=symbol;
hqchartData.symbol=symbol;
callback(hqchartData);
var kItem=hqchartData.data[0];
var price=kItem[5];
var value=Math.ceil(Math.random()*10)/1000*price;
var bUp=Math.ceil(Math.random()*10)>=5;

if (bUp) price+=value;
else price-=value;
kItem[5]=price;
kItem[3]=Math.max(price, kItem[3]);
kItem[4]=Math.min(price, kItem[4]);

hqchartData.name=symbol;
hqchartData.symbol=symbol;
callback(hqchartData);
}
}


Expand Down
13 changes: 9 additions & 4 deletions vuehqchart/src/jscommon/umychart.js
Original file line number Diff line number Diff line change
Expand Up @@ -11572,12 +11572,13 @@ function AverageWidthFrame()
if (item.Font != null) this.Canvas.font = item.Font;
this.Canvas.fillStyle = item.TextColor;
this.Canvas.textAlign = "left";
var textHeight=this.Canvas.measureText("擎").width;
var yText=y;
if (y >= bottom - 2)
{
this.Canvas.textBaseline = 'bottom';
}
else if (y <= top + 2)
else if ((y-textHeight/2)<=top)
{
this.Canvas.textBaseline = 'top';
yText+=this.YTextTopOffset;
Expand Down Expand Up @@ -11606,12 +11607,13 @@ function AverageWidthFrame()
if (item.Font != null) this.Canvas.font = item.Font;
this.Canvas.fillStyle = item.TextColor;
this.Canvas.textAlign = "right";
var textHeight=this.Canvas.measureText("擎").width;
var yText=y;
if (y >= bottom - 2)
{
this.Canvas.textBaseline = 'bottom';
}
else if (y <= top + 2)
else if (y-textHeight/2 <= top)
{
this.Canvas.textBaseline = 'top';
yText+=this.YTextTopOffset;
Expand Down Expand Up @@ -71934,7 +71936,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)

//绑定数据
this.UpdateMainData(bindData,lastDataCount);
this.BindInstructionIndexData(bindData); //执行指示脚本
this.UpdateOverlayMinuteRealtimeData(data); //更新叠加股票数据
this.BindInstructionIndexData(bindData); //执行指示脚本

for(var i=0; i<this.Frame.SubFrame.length; ++i)
{
Expand Down Expand Up @@ -76705,7 +76708,7 @@ KLineChartContainer.JsonDataToMinuteRealtimeDataV2=function(data,symbol)
var date = 0, yclose = 1, open = 2, high = 3, low = 4, close = 5, vol = 6, amount = 7, time = 8, position=9;
var orderFlow=JSCHART_DATA_FIELD_ID.KLINE_ORDERFLOW;
var yClose=null;

var aryMinuteData=[];
for (var i = 0; i < overlayData.data.length; ++i)
{
var item = new HistoryData();
Expand Down Expand Up @@ -88953,6 +88956,7 @@ var MARKET_SUFFIX_NAME=
SHFE: '.SHF', //上期所 (Shanghai Futures Exchange) | 上期所-能源
SHFE2:'.SHFE', //上期所 (Shanghai Futures Exchange) | 上期所-能源
CFFEX: '.CFE', //中期所 (China Financial Futures Exchange)
CFFEX2:'.CFFEX', //中期所 (China Financial Futures Exchange)
DCE: '.DCE', //大连商品交易所(Dalian Commodity Exchange)
CZCE: '.CZC', //郑州期货交易所
GZFE:".GZFE", //广州期货交易所
Expand Down Expand Up @@ -89164,6 +89168,7 @@ var MARKET_SUFFIX_NAME=
{
if (!upperSymbol) return false;
if (upperSymbol.indexOf(this.CFFEX) > 0) return true;
if (upperSymbol.indexOf(this.CFFEX2) > 0) return true;

return false;
},
Expand Down
2 changes: 1 addition & 1 deletion vuehqchart/src/jscommon/umychart.version.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@



var HQCHART_VERSION="1.1.13477";
var HQCHART_VERSION="1.1.13484";

function PrintHQChartVersion()
{
Expand Down
15 changes: 10 additions & 5 deletions vuehqchart/src/jscommon/umychart.vue/umychart.vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -15541,12 +15541,13 @@ function AverageWidthFrame()
if (item.Font != null) this.Canvas.font = item.Font;
this.Canvas.fillStyle = item.TextColor;
this.Canvas.textAlign = "left";
var textHeight=this.Canvas.measureText("擎").width;
var yText=y;
if (y >= bottom - 2)
{
this.Canvas.textBaseline = 'bottom';
}
else if (y <= top + 2)
else if ((y-textHeight/2)<=top)
{
this.Canvas.textBaseline = 'top';
yText+=this.YTextTopOffset;
Expand Down Expand Up @@ -15575,12 +15576,13 @@ function AverageWidthFrame()
if (item.Font != null) this.Canvas.font = item.Font;
this.Canvas.fillStyle = item.TextColor;
this.Canvas.textAlign = "right";
var textHeight=this.Canvas.measureText("擎").width;
var yText=y;
if (y >= bottom - 2)
{
this.Canvas.textBaseline = 'bottom';
}
else if (y <= top + 2)
else if (y-textHeight/2 <= top)
{
this.Canvas.textBaseline = 'top';
yText+=this.YTextTopOffset;
Expand Down Expand Up @@ -75903,7 +75905,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)

//绑定数据
this.UpdateMainData(bindData,lastDataCount);
this.BindInstructionIndexData(bindData); //执行指示脚本
this.UpdateOverlayMinuteRealtimeData(data); //更新叠加股票数据
this.BindInstructionIndexData(bindData); //执行指示脚本

for(var i=0; i<this.Frame.SubFrame.length; ++i)
{
Expand Down Expand Up @@ -80674,7 +80677,7 @@ KLineChartContainer.JsonDataToMinuteRealtimeDataV2=function(data,symbol)
var date = 0, yclose = 1, open = 2, high = 3, low = 4, close = 5, vol = 6, amount = 7, time = 8, position=9;
var orderFlow=JSCHART_DATA_FIELD_ID.KLINE_ORDERFLOW;
var yClose=null;

var aryMinuteData=[];
for (var i = 0; i < overlayData.data.length; ++i)
{
var item = new HistoryData();
Expand Down Expand Up @@ -92922,6 +92925,7 @@ var MARKET_SUFFIX_NAME=
SHFE: '.SHF', //上期所 (Shanghai Futures Exchange) | 上期所-能源
SHFE2:'.SHFE', //上期所 (Shanghai Futures Exchange) | 上期所-能源
CFFEX: '.CFE', //中期所 (China Financial Futures Exchange)
CFFEX2:'.CFFEX', //中期所 (China Financial Futures Exchange)
DCE: '.DCE', //大连商品交易所(Dalian Commodity Exchange)
CZCE: '.CZC', //郑州期货交易所
GZFE:".GZFE", //广州期货交易所
Expand Down Expand Up @@ -93133,6 +93137,7 @@ var MARKET_SUFFIX_NAME=
{
if (!upperSymbol) return false;
if (upperSymbol.indexOf(this.CFFEX) > 0) return true;
if (upperSymbol.indexOf(this.CFFEX2) > 0) return true;

return false;
},
Expand Down Expand Up @@ -138288,7 +138293,7 @@ function HQChartScriptWorker()



var HQCHART_VERSION="1.1.13477";
var HQCHART_VERSION="1.1.13484";

function PrintHQChartVersion()
{
Expand Down
Loading

0 comments on commit 4511449

Please sign in to comment.