Skip to content

Commit

Permalink
ver 13718
Browse files Browse the repository at this point in the history
13715 键盘精灵增加支持功能键
  • Loading branch information
jones2000 committed Aug 19, 2024
1 parent 11b2126 commit 80e8df0
Show file tree
Hide file tree
Showing 21 changed files with 613 additions and 75 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ React 例子:[demo-react.md](/教程/demo-react.md) <br>
88. [HQChart使用教程98-右键菜单2.0使用介绍](https://blog.csdn.net/jones2000/article/details/138841350)
89. [HQChart使用教程99-K线窗口设置上下间距](https://jones2000.blog.csdn.net/article/details/139273770)
90. [HQChart使用教程100-自定义Y轴分段背景色](https://jones2000.blog.csdn.net/article/details/139498872)
91. [HQChart使用教程101-创建内置键盘精灵](https://jones2000.blog.csdn.net/article/details/141336689)

## 微信小程序教程
1. [HQChart小程序教程1-如何快速的创建一个K线图](https://developers.weixin.qq.com/community/develop/article/doc/0006c451ac81589915b89d1c55bc13)
Expand Down
109 changes: 98 additions & 11 deletions umychart_uniapp_h5/umychart.uniapp.h5.js
Original file line number Diff line number Diff line change
Expand Up @@ -135137,7 +135137,8 @@ function JSKeyboardChartContainer(uielement)
this.NetworkFilter; //数据回调接口
this.Data={ XOffset:0, YOffset:0, Data:[] }; //股票列表
this.MapSymbol=new Map();
this.SourceData={ Data:[] } //码表数据 Data:[ { Symbol:, Spell, Name:, Color:}]
this.SourceData={ Data:[] } //码表数据 Data:[ { Symbol:, Spell, Name:, Color: TypeName:, TypeID } ]
this.FunctionKeyData=[]; //功能键 { Priority:, Data:[ { Symbol:, Spell, Name:, Color:, TypeName:, TypeID } ]

//事件回调
this.mapEvent=new Map(); //通知外部调用 key:JSCHART_EVENT_ID value:{Callback:回调,}
Expand All @@ -135164,10 +135165,44 @@ function JSKeyboardChartContainer(uielement)
if (option && option.Redraw==true) this.Draw();
}

this.SearchFunctionKeyData=function(strSearch)
{
if (strSearch.length<=0) return null;
if (!IFrameSplitOperator.IsNonEmptyArray(this.FunctionKeyData)) return null;

var aryData=[];
for(var i=0; i<this.FunctionKeyData.length; ++i)
{
var groupData=this.FunctionKeyData[i];
if (!groupData) continue;
if (!IFrameSplitOperator.IsNonEmptyArray(groupData.Data)) continue;

var aryExactQuery=[]; //精确查询
var aryFuzzyQuery=[]; //模糊查询
var aryEqualQuery=[]; //相等

for(var j=0;j<groupData.Data.length;++j)
{
var item=groupData.Data[j];
if (this.SearchSymbol(item, strSearch, aryExactQuery, aryFuzzyQuery,aryEqualQuery)) continue;
}

if (IFrameSplitOperator.IsNonEmptyArray(aryEqualQuery)) aryData.push(...aryEqualQuery);
if (IFrameSplitOperator.IsNonEmptyArray(aryExactQuery)) aryData.push(...aryExactQuery);
if (IFrameSplitOperator.IsNonEmptyArray(aryFuzzyQuery)) aryData.push(...aryFuzzyQuery);
}

if (aryData.length>0) return aryData;

return null;
}

this.Search=function(strText)
{
var aryExactQuery=[]; //精确查询
var aryFuzzyQuery=[]; //模糊查询
var aryEqualQuery=[]; //相等
var aryFuncKeyQuery=null;
this.MapSymbol.clear();
this.Data.Data=[];
this.Data.XOffset=0;
Expand All @@ -135176,17 +135211,21 @@ function JSKeyboardChartContainer(uielement)
var strSearch=strText.trim();
if (strSearch.length>0)
{
aryFuncKeyQuery=this.SearchFunctionKeyData(strSearch);

for(var i=0;i<this.SourceData.Data.length;++i)
{
var item=this.SourceData.Data[i];
if (this.SearchSymbol(item, strSearch, aryExactQuery, aryFuzzyQuery)) continue;
if (this.SearchSymbol(item, strSearch, aryExactQuery, aryFuzzyQuery, aryEqualQuery)) continue;
else if (this.SearchSpell(item, strSearch, aryExactQuery, aryFuzzyQuery)) continue;
}
}

if (IFrameSplitOperator.IsNonEmptyArray(aryExactQuery) || IFrameSplitOperator.IsNonEmptyArray(aryFuzzyQuery))
this.Data.Data=aryExactQuery.concat(aryFuzzyQuery);

if (IFrameSplitOperator.IsNonEmptyArray(aryFuncKeyQuery)) this.Data.Data.push(...aryFuncKeyQuery);
if (IFrameSplitOperator.IsNonEmptyArray(aryEqualQuery)) this.Data.Data.push(...aryEqualQuery);
if (IFrameSplitOperator.IsNonEmptyArray(aryExactQuery)) this.Data.Data.push(...aryExactQuery);
if (IFrameSplitOperator.IsNonEmptyArray(aryFuzzyQuery)) this.Data.Data.push(...aryFuzzyQuery);

this.ChartPaint[0].SelectedRow=0;
this.ChartPaint[0].SizeChange=true;

Expand All @@ -135195,12 +135234,13 @@ function JSKeyboardChartContainer(uielement)
this.Draw();
}

this.SearchSymbol=function(item, strText, aryExactQuery, aryFuzzyQuery)
this.SearchSymbol=function(item, strText, aryExactQuery, aryFuzzyQuery, aryEqualQuery)
{
var find=item.Symbol.indexOf(strText);
if (find<0) return false;

if (find==0) aryExactQuery.push(item.Symbol);
if (item.Symbol==strText) aryEqualQuery.push(item.Symbol);
else if (find==0) aryExactQuery.push(item.Symbol);
else aryFuzzyQuery.push(item.Symbol);

this.MapSymbol.set(item.Symbol, item);
Expand All @@ -135225,8 +135265,21 @@ function JSKeyboardChartContainer(uielement)

this.SetSymbolData=function(arySymbol)
{
this.SourceData.Data=arySymbol;

this.SourceData.Data=[];
for(var i=0;i<arySymbol.length;++i)
{
var item=arySymbol[i];
if (IFrameSplitOperator.IsNumber(item.Priority))
{
if (!this.FunctionKeyData[item.Priority]) this.FunctionKeyData[item.Priority]={ Priority:item.Priority, Data:[] };
this.FunctionKeyData[item.Priority].Data.push(item);
}
else
{
this.SourceData.Data.push(item);
}
}

/*
//测试
this.MapSymbol.clear();
Expand Down Expand Up @@ -135499,11 +135552,13 @@ function JSKeyboardChartContainer(uielement)
if (!chart) return false;

var data=chart.GetSelectedSymbol();
var selItem=this.MapSymbol.get(data.Symbol);
if (!selItem) return false;

var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYBOARD_SELECTED)
if (event && event.Callback)
{
event.Callback(event, { Data:data }, this);
event.Callback(event, { Data:data, RowData:selItem }, this);
}
}

Expand Down Expand Up @@ -136113,6 +136168,38 @@ function ChartSymbolList()
this.SetColumn=function(aryColumn)
{
if (!IFrameSplitOperator.IsNonEmptyArray(aryColumn)) return;

this.Column=[];
for(var i=0;i<aryColumn.length;++i)
{
var item=aryColumn[i];
var colItem=this.GetDefaultColunm(item.Type);
if (!colItem) continue;

if (item.Title) colItem.Title=item.Title;
if (item.TextAlign) colItem.TextAlign=item.TextAlign;
if (item.MaxText) colItem.MaxText=item.MaxText;

this.Column.push(colItem);
}
}

this.GetDefaultColunm=function(id)
{
var DEFAULT_COLUMN=
[
{ Type:KEYBOARD_COLUMN_ID.SHORT_SYMBOL_ID, Title:"代码", TextAlign:"left", Width:null, MaxText:"888888" },
{ Type:KEYBOARD_COLUMN_ID.NAME_ID, Title:"名称", TextAlign:"left", Width:null, MaxText:"擎擎擎擎擎擎" },
{ Type:KEYBOARD_COLUMN_ID.TYPE_NAME_ID, Title:"类型", TextAlign:"right", Width:null, MaxText:"擎擎擎擎" },
];

for(var i=0;i<DEFAULT_COLUMN.length;++i)
{
var item=DEFAULT_COLUMN[i];
if (item.Type==id) return item;
}

return null;
}

this.Draw=function()
Expand Down Expand Up @@ -138138,7 +138225,7 @@ function ScrollBarBGChart()



var HQCHART_VERSION="1.1.13710";
var HQCHART_VERSION="1.1.13716";

function PrintHQChartVersion()
{
Expand Down
11 changes: 10 additions & 1 deletion vuehqchart/src/jscommon/umychart.NetworkFilterTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -49702,7 +49702,7 @@ HQData.Keyboard_RequestSymbolList=function(data, callback)
var shortSymbol=item[0];
shortSymbol=shortSymbol.replace(".sh", "");
shortSymbol=shortSymbol.replace(".sz", "");
var symbolItem={ Symbol:item[0], Name:item[1], ShortSymbol:shortSymbol, Spell:item[3], Type:item[2] };
var symbolItem={ Symbol:item[0], Name:item[1], ShortSymbol:shortSymbol, Spell:item[3], Type:item[2], Data:{ Symbol:item[0], Type:0 } };
if (symbolItem.Type=="EQA")
{
symbolItem.TypeName="股票";
Expand All @@ -49716,6 +49716,15 @@ HQData.Keyboard_RequestSymbolList=function(data, callback)
arySymbol.push(symbolItem);
}

arySymbol.push( { Symbol:"01", Name:"分时成交明细", TypeName:"功能键", Priority:1, Color:"rgb(220,20,60)" , Data:{ PageName:"分时成交明细", Type:2 }} );
arySymbol.push( { Symbol:"02", Name:"分价表", TypeName:"功能键", Priority:1, Color:"rgb(220,20,60)" ,Data:{ PageName:"分价表", Type:2 }} );
arySymbol.push( { Symbol:"06", Name:"自选股", TypeName:"功能键", Priority:1 , Color:"rgb(220,20,60)", Data:{ PageName:"自选股", Type:2 }} );

arySymbol.push( { Symbol:"MACD", Name:"平滑异同平均线", TypeName:"指标", Priority:2 , Color:"rgb(0,0,255)", Data:{ Index:"MACD", Type:1 }} );
arySymbol.push( { Symbol:"RSI", Name:"相对强弱指标", TypeName:"指标", Priority:2, Color:"rgb(0,0,255)",Data:{ Index:"RSI", Type:1 }} );
arySymbol.push( { Symbol:"MA", Name:"均线", TypeName:"指标", Priority:2, Color:"rgb(0,0,255)" ,Data:{ Index:"MA", Type:1 } } );
arySymbol.push( { Symbol:"BOLL", Name:"布林线", TypeName:"指标", Priority:2, Color:"rgb(0,0,255)" ,Data:{ Index:"BOLL", Type:1 } } );

callback(arySymbol);
}

Expand Down
10 changes: 9 additions & 1 deletion vuehqchart/src/jscommon/umychart.PopKeyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,15 @@ JSPopKeyboard.GetOption=function()
},

BorderLine:1|2|4|8,
EnableResize:true
EnableResize:true,

//{ Type:列id, Title:标题, TextAlign:文字对齐方式, MaxText:文字最大宽度 , TextColor:文字颜色, Sort:0=不支持排序 1=本地排序 0=远程排序 }
Column:
[
{ Type:KEYBOARD_COLUMN_ID.SHORT_SYMBOL_ID, Title:"代码", TextAlign:"left", Width:null, MaxText:"888888" },
{ Type:KEYBOARD_COLUMN_ID.NAME_ID, Title:"名称", TextAlign:"left", Width:null, MaxText:"擎擎擎擎擎擎擎擎" },
{ Type:KEYBOARD_COLUMN_ID.TYPE_NAME_ID, Title:"类型", TextAlign:"right", Width:null, MaxText:"擎擎擎擎擎" },
]
};

return option;
Expand Down
Loading

0 comments on commit 80e8df0

Please sign in to comment.