hqchart 1.1.13981 → 1.1.13989

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.
@@ -6418,7 +6418,7 @@ JSChart.GetScrollPosition=function()
6418
6418
 
6419
6419
  var JSCHART_EVENT_ID=
6420
6420
  {
6421
- RECV_KLINE_MATCH:1, //接收到形态匹配
6421
+ //RECV_KLINE_MATCH:1, //接收到形态匹配
6422
6422
  RECV_INDEX_DATA:2, //接收指标数据
6423
6423
  RECV_HISTROY_DATA:3,//接收到历史数据
6424
6424
  RECV_TRAIN_MOVE_STEP:4, //接收K线训练,移动一次K线
@@ -73179,13 +73179,19 @@ function JSChartResource()
73179
73179
  this.DialogTooltip=
73180
73180
  {
73181
73181
  BGColor:'rgb(250,250,250)', //背景色
73182
- BorderColor:'rgb(20,20,20)', //边框颜色
73183
- TitleColor:'rgb(0,0,0)', //标题颜色
73182
+ BorderColor:'rgb(20,20,20)', //边框颜色
73183
+ TitleColor:'rgb(250,250,250)', //标题颜色
73184
+ TitleBGColor:"rgb(200, 66, 69)", //标题背景颜色
73184
73185
  VolColor:"rgb(255, 185, 15)", //标题成交量
73185
73186
  AmountColor:"rgb(79, 79, 79)", //成交金额
73186
73187
  DateTimeColor:'rgb(60,60,60)',
73187
73188
  TurnoverRateColor:'rgb(43,54,69)', //换手率
73188
- PositionColor:"rgb(255,0,255)" //持仓
73189
+ PositionColor:"rgb(255,0,255)", //持仓
73190
+
73191
+ TextColor:"rgb(0,0,0)", //数值名称
73192
+ ValueColor:"rgb(0,0,0)", //数值
73193
+
73194
+
73189
73195
  },
73190
73196
 
73191
73197
  //区间统计
@@ -74201,6 +74207,7 @@ function JSChartResource()
74201
74207
  if (item.BGColor) this.DialogTooltip.BGColor=item.BGColor;
74202
74208
  if (item.BorderColor) this.DialogTooltip.BorderColor=item.BorderColor;
74203
74209
  if (item.TitleColor) this.DialogTooltip.TitleColor=item.TitleColor;
74210
+ if (item.TitleBGColor) this.DialogTooltip.TitleBGColor=item.TitleBGColor;
74204
74211
  if (item.DateTimeColor) this.DialogTooltip.DateTimeColor=item.DateTimeColor;
74205
74212
 
74206
74213
  if (item.VolColor) this.DialogTooltip.VolColor=item.VolColor;
@@ -74208,6 +74215,8 @@ function JSChartResource()
74208
74215
  if (item.TurnoverRateColor) this.DialogTooltip.TurnoverRateColor=item.TurnoverRateColor;
74209
74216
  if (item.PositionColor) this.DialogTooltip.PositionColor=item.PositionColor;
74210
74217
 
74218
+ if (item.TextColor) this.DialogTooltip.TextColor=item.TextColor;
74219
+ if (item.ValueColor) this.DialogTooltip.ValueColor=item.ValueColor;
74211
74220
  }
74212
74221
 
74213
74222
  if (style.DialogSelectRect)
@@ -82059,101 +82068,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
82059
82068
  this.ChartDrawStorageCache=null; //清空缓存
82060
82069
  }
82061
82070
 
82062
- //形态匹配
82063
- // scope.Plate 板块范围 scope.Symbol 股票范围
82064
- // sample 样本数据
82065
- this.RequestKLineMatch=function(sample,param)
82066
- {
82067
- var self =this;
82068
- var scope=param.Scope;
82069
- var waitDailog=param.WaitDialog;
82070
- JSConsole.Chart.Log('[KLineChartContainer::RequestKLineMatch',sample,scope)
82071
-
82072
- var aryDate=new Array();
82073
- var aryValue=new Array();
82074
-
82075
- for(var i=sample.Start;i<sample.End && i<sample.Data.Data.length;++i)
82076
- {
82077
- var item=sample.Data.Data[i];
82078
- aryDate.push(item.Date);
82079
- aryValue.push(item.Close);
82080
- }
82081
-
82082
- var sampleData=
82083
- {
82084
- Stock:sample.Stock,
82085
- Index:{Start:sample.Start, End:sample.End}, //数据索引
82086
- Date:{Start:aryDate[0], End:aryDate[aryDate.length-1]}, //起始 结束日期
82087
- Minsimilar:scope.Minsimilar, //相似度
82088
- Plate:scope.Plate,
82089
- DayRegion:300
82090
- };
82091
-
82092
- //请求数据
82093
- $.ajax({
82094
- url: this.KLineMatchUrl,
82095
- data:
82096
- {
82097
- "userid": "guest",
82098
- "plate": scope.Plate,
82099
- "period": this.Period,
82100
- "right": this.Right,
82101
- "dayregion": sampleData.DayRegion,
82102
- "minsimilar": scope.Minsimilar,
82103
- "sampledate":aryDate,
82104
- "samplevalue":aryValue
82105
- },
82106
- type:"post",
82107
- dataType: "json",
82108
- async:true,
82109
- success: function (data)
82110
- {
82111
- if (waitDailog) waitDailog.Close();
82112
- self.RecvKLineMatchData(data,sampleData);
82113
- },
82114
- error:function(jqXHR, textStatus, errorThrown)
82115
- {
82116
- console.warn('[KLineChartContainer::RequestKLineMatch] failed',jqXHR,textStatus, errorThrown);
82117
- if (waitDailog) waitDailog.Close();
82118
- }
82119
- });
82120
- }
82121
-
82122
- //接收形态选股结果
82123
- this.RecvKLineMatchData=function(data,sample)
82124
- {
82125
- JSConsole.Chart.Log('[KLineChartContainer::RecvKLineMatchData] recv',data,sample);
82126
- var filterData=[]; //结果数据
82127
- for(var i in data.match)
82128
- {
82129
- var item=data.match[i];
82130
- if (item.symbol==sample.Stock.Symbol) continue;
82131
-
82132
- for(var j in item.data)
82133
- {
82134
- var dataItem=item.data[j];
82135
- var newItem={Symbol:item.symbol, Name:item.name,Similar:dataItem.similar, Start:dataItem.start, End:dataItem.end};
82136
- filterData.push(newItem);
82137
- }
82138
- }
82139
- filterData.sort(function(a,b){return b.Similar-a.Similar;}); //排序
82140
- JSConsole.Chart.Log('[KLineChartContainer::RecvKLineMatchData] filterData',filterData);
82141
-
82142
- if (this.mapEvent.has(JSCHART_EVENT_ID.RECV_KLINE_MATCH))
82143
- {
82144
- var item=this.mapEvent.get(JSCHART_EVENT_ID.RECV_KLINE_MATCH);
82145
- var data={Sample:sample, Match:filterData, Source:data}
82146
- item.Callback(item,data,this);
82147
- }
82148
- else
82149
- {
82150
- var dlg=new KLineMatchDialog(this.Frame.ChartBorder.UIElement.parentNode);
82151
-
82152
- var event={ data:{ Chart:this, MatchData:filterData, Sample:sample, Source:data} };
82153
- dlg.DoModal(event);
82154
- }
82155
- }
82156
-
82157
82071
  //更新信息地雷
82158
82072
  this.UpdataChartInfo=function()
82159
82073
  {
@@ -94682,235 +94596,6 @@ function ChangeIndexDialog(divElement)
94682
94596
  }
94683
94597
  }
94684
94598
 
94685
- //形态选股
94686
- function KLineMatchDialog(divElement)
94687
- {
94688
- this.newMethod=IDivDialog; //派生
94689
- this.newMethod(divElement);
94690
- delete this.newMethod;
94691
-
94692
- this.MatchData; //匹配的股票数据
94693
- this.Sample; //样本数据
94694
- this.Dialog;
94695
- this.HQChart;
94696
-
94697
- this.PageData; //分页数据
94698
-
94699
- //隐藏窗口
94700
- this.Close=function()
94701
- {
94702
- this.DivElement.removeChild(this.Dialog);
94703
- }
94704
-
94705
- //创建
94706
- this.Create=function()
94707
- {
94708
- this.ID=Guid();
94709
- var div=document.createElement('div');
94710
- div.className='jchart-kline-match-box';
94711
- div.id=this.ID;
94712
- div.innerHTML=
94713
- `<div class='parameter jchart-kline-match-box'>
94714
- <div class='parameter-header'>
94715
- <span>形态匹配</span>
94716
- <strong id='close' class='icon iconfont icon-close'></strong>
94717
- </div>
94718
- <div class='parameter-content'>
94719
- <p class='dataCount'></p>
94720
- <table class='matchTable'>
94721
- <thead>
94722
- <tr>
94723
- <td>股票名称</td>
94724
- <td>匹配度</td>
94725
- <td>时间段</td>
94726
- </tr>
94727
- </thead>
94728
- <tbody>
94729
- </tbody>
94730
- </table>
94731
- <div class='pagination' data-current='1'></div>
94732
- </div>
94733
- <div class='parameter-footer'>
94734
- <button id='close' class='submit' >确定</button>
94735
- </div>
94736
- </div>`.trim();
94737
-
94738
- this.DivElement.appendChild(div);
94739
- this.Dialog=div;
94740
-
94741
- //关闭按钮
94742
- $("#"+this.ID+" #close").click(
94743
- {
94744
- divBox:this,
94745
- },
94746
- function(event)
94747
- {
94748
- event.data.divBox.Close();
94749
- });
94750
- }
94751
-
94752
- this.BindData=function()
94753
- {
94754
- JSConsole.Chart.Log(`[KLineMatchDialog::BindData] 形态源: ${this.Sample.Stock.Name} 区间:${this.Sample.Date.Start} - ${this.Sample.Date.End}`);
94755
- var count = this.MatchData.length + 1;
94756
- var pageData = {NewData:{},MetaData:[],PageCount:0,Count:count};
94757
- var pageCount = 0;
94758
- var paginationHtml = '';
94759
-
94760
- $('#'+this.ID+' .dataCount').html('个数:'+count);
94761
-
94762
- for(let i = 0; i < count ; i++){
94763
- var dataObj = {};
94764
- if(i == 0){
94765
- dataObj = {
94766
- Symbol:this.Sample.Stock.Symbol,
94767
- Name:this.Sample.Stock.Name,
94768
- Rate:'形态源',
94769
- Color:'red',
94770
- Date:`${this.Sample.Date.Start}-${this.Sample.Date.End}`
94771
- };
94772
- }else{
94773
- let dataItem = this.MatchData[i - 1];
94774
- dataObj = {
94775
- Symbol:dataItem.Symbol,
94776
- Name:dataItem.Name,
94777
- Rate:Number(dataItem.Similar * 100).toFixed(2),
94778
- Color:'',
94779
- Date:`${dataItem.Start}-${dataItem.End}`
94780
- };
94781
- }
94782
- pageData.MetaData.push(dataObj);
94783
- }
94784
-
94785
- if(pageData.Count % 10 == 0){
94786
- pageCount = pageData.Count / 10;
94787
- }else{
94788
- pageCount = Math.floor(pageData.Count / 10) + 1;
94789
- }
94790
- pageData.PageCount = pageCount;
94791
-
94792
- this.PaginationMetaData(pageData);
94793
- this.PageData = pageData;
94794
- JSConsole.Chart.Log('[KLineMatchDialog::DoModal pageData]',pageData);
94795
-
94796
- this.RenderDom(1);
94797
-
94798
- this.PaginationInit('#'+this.ID,pageData.PageCount,this.paginationCallback);
94799
- // $('#' + this.ID + ' .pagination').html(paginationHtml);
94800
-
94801
-
94802
- }
94803
- this.RenderDom = function(page){
94804
- let currentPageData = this.PageData.NewData[page];
94805
- JSConsole.Chart.Log('[KLineMatchDialog::RenderDom currentPageData]',currentPageData);
94806
- let bodyHtml = '';
94807
- for(let i = 0; i < currentPageData.length; i++){
94808
- bodyHtml += `<tr>
94809
- <td class=${currentPageData[i].Color}>${currentPageData[i].Name}</td>
94810
- <td class=${currentPageData[i].Color}>${currentPageData[i].Rate}</td>
94811
- <td class=${currentPageData[i].Color}>${currentPageData[i].Date}</td>
94812
- </tr>`.trim();
94813
- }
94814
-
94815
- $('#'+this.ID + ' .matchTable tbody').html(bodyHtml)
94816
- }
94817
- var _this = this;
94818
- this.paginationCallback = function(page) {
94819
- _this.RenderDom(page);
94820
- _this.PaginationInit('#'+_this.ID,_this.PageData.PageCount,_this.paginationCallback); //更新UI
94821
- }
94822
- this.PaginationInit = function(id, maxPageNum, callback) { //初始化分页
94823
- var spanStr = "";
94824
- var currentPageNum = $(id + " .pagination").data("current");
94825
- var lastPageNum = 0;
94826
- var showCountPage = 5; //只显示5个数字项
94827
-
94828
- if (currentPageNum < showCountPage) { //当前页小于预显示页数
94829
- if (maxPageNum >= showCountPage) {
94830
- for (var j = 0; j < showCountPage; j++) { //上 1 2 3 4 5 下
94831
- spanStr += (j + 1) != currentPageNum ? "<span>" + (j + 1) + "</span>" : "<span class='active'>" + (j + 1) + "</span>";
94832
- }
94833
- } else {
94834
- for (var j = 0; j < maxPageNum; j++) { //上 1 2 3 4 5 下
94835
- spanStr += (j + 1) != currentPageNum ? "<span>" + (j + 1) + "</span>" : "<span class='active'>" + (j + 1) + "</span>";
94836
- }
94837
- }
94838
- } else { //大于5时,最终页数是当前页数加1
94839
- lastPageNum = (currentPageNum + 1) > maxPageNum ? currentPageNum : (currentPageNum + 1);
94840
-
94841
- for (var i = currentPageNum - 3; i <= lastPageNum; i++) { //含最终项之前的五项
94842
- spanStr += i != currentPageNum ? "<span>" + i + "</span>" : "<span class='active'>" + i + "</span>";
94843
- }
94844
- }
94845
-
94846
- spanStr = "<span class='beforePage'>上一页</span>" + spanStr + "<span class='nextPage'>下一页</span>";
94847
- $(id + " .pagination").html(spanStr);
94848
- $(id + " .pagination span").bind('click', { "maxpage": maxPageNum, "Callback": callback }, this.PaginationCurrentIndex);
94849
- // return spanStr;
94850
- }
94851
-
94852
- this.PaginationCurrentIndex = function(event) { //分页切换
94853
- var text = $(this).text();
94854
- JSConsole.Chart.Log('[::PaginationCurrentIndex text]',text);
94855
- var currentPageNum = Number($(this).parent().data("current"));
94856
- var maxPageNum = event.data.maxpage;
94857
- var callback = event.data.Callback;
94858
- var flag = 1;
94859
- if (text === "上一页") {
94860
- flag = currentPageNum === 1 ? currentPageNum : currentPageNum - 1;
94861
- } else if (text === "下一页") {
94862
- flag = currentPageNum === maxPageNum ? currentPageNum : currentPageNum + 1;
94863
- } else {
94864
- flag = Number(text);
94865
- }
94866
- $(this).parent().data("current", flag); //将当前页存到dom上
94867
- callback(flag);
94868
- }
94869
-
94870
- this.PaginationMetaData = function(data){ //假分页数据,每页10条数据
94871
- // data = {NewData:{},MetaData:[],PageCount:0,Callback:null};
94872
- var newData = {};
94873
- var metaData = data.MetaData;
94874
- var pageCount = data.PageCount;
94875
-
94876
- for(let i = 0; i < pageCount; i++){
94877
- var itemArr = [];
94878
- for(let j = 0; j < 10; j++){
94879
- var itemIndex = 10*i + j;
94880
- if(itemIndex <= metaData.length - 1){
94881
- var item = metaData[itemIndex];
94882
- itemArr.push(item);
94883
- }else {
94884
- break;
94885
- }
94886
- }
94887
- newData[i+1] = itemArr;
94888
- }
94889
- data.NewData = newData;
94890
- }
94891
-
94892
- //显示
94893
- this.DoModal=function(event)
94894
- {
94895
- var chart=event.data.Chart;
94896
- if (this.ID==null) this.Create(); //第1次 需要创建div
94897
- this.MatchData=event.data.MatchData;
94898
- this.Sample=event.data.Sample;
94899
- this.HQChart=chart;
94900
-
94901
- this.BindData();
94902
-
94903
-
94904
- //居中显示
94905
- var border=chart.Frame.ChartBorder;
94906
- var scrollPos=GetScrollPosition();
94907
- var left=border.GetWidth()/2;
94908
- var top=border.GetHeight()/2;
94909
-
94910
- this.Show(left,top,200,200); //显示
94911
- }
94912
- }
94913
-
94914
94599
  //等待动画窗口
94915
94600
  function WaitDialog(divElement)
94916
94601
  {
@@ -125407,12 +125092,17 @@ function GetBlackStyle()
125407
125092
  {
125408
125093
  BGColor:'rgb(20,20,20)', //背景色
125409
125094
  BorderColor:'rgb(170,170,170)', //边框颜色
125410
- TitleColor:'rgb(210,210,210)', //标题颜色
125095
+ TitleColor:'rgb(250,250,250)', //标题颜色
125411
125096
  VolColor:"rgb(255, 185, 15)", //标题成交量
125412
125097
  AmountColor:"rgb(210,210,210)", //成交金额
125413
125098
  DateTimeColor:'rgb(210,210,210)',
125414
125099
  TurnoverRateColor:'rgb(43,54,69)', //换手率
125415
- PositionColor:"rgb(255,0,255)" //持仓
125100
+ PositionColor:"rgb(255,0,255)", //持仓
125101
+
125102
+ TextColor:"rgb(210,210,210)", //数值名称
125103
+ ValueColor:"rgb(210,210,210)", //数值
125104
+
125105
+ TitleBGColor:"rgb(200, 66, 69)",
125416
125106
  },
125417
125107
 
125418
125108
  DialogSelectRect:
@@ -143469,19 +143159,23 @@ function JSPopKeyboard()
143469
143159
  if (this.InputStatus!=0) return;
143470
143160
 
143471
143161
  var code=event.keyCode;
143472
- if ((code>=48 && code<=57) || (code>=65 && code<=90) || (code>=97 && code<=122) || code==8)
143162
+
143163
+ if (code==8) //删除
143473
143164
  {
143474
143165
  var strText=this.InputDOM.value;
143475
- strText=strText.toUpperCase();
143476
- if (strText.length==0)
143166
+ if (strText.length==0)
143477
143167
  {
143478
- this.Hide();
143479
- }
143480
- else
143481
- {
143482
- this.Keyboard.JSChart.Search(strText);
143168
+ this.Hide(); //只有按了删除 才能隐藏
143169
+ return;
143483
143170
  }
143484
143171
  }
143172
+
143173
+ if ((code>=48 && code<=57) || (code>=65 && code<=90) || (code>=97 && code<=122) || code==8)
143174
+ {
143175
+ var strText=this.InputDOM.value;
143176
+ strText=strText.toUpperCase();
143177
+ this.Keyboard.JSChart.Search(strText);
143178
+ }
143485
143179
  }
143486
143180
 
143487
143181
 
@@ -143664,6 +143358,9 @@ function JSDialogTooltip()
143664
143358
  this.BGColor=g_JSChartResource.DialogTooltip.BGColor;
143665
143359
  this.BorderColor=g_JSChartResource.DialogTooltip.BorderColor;
143666
143360
 
143361
+ this.TextColor=g_JSChartResource.DialogTooltip.TextColor;
143362
+ this.ValueColor=g_JSChartResource.DialogTooltip.ValueColor;
143363
+
143667
143364
  this.VolColor=g_JSChartResource.DialogTooltip.VolColor;
143668
143365
  this.AmountColor=g_JSChartResource.DialogTooltip.AmountColor;
143669
143366
  this.TurnoverRateColor=g_JSChartResource.DialogTooltip.TurnoverRateColor;
@@ -143919,7 +143616,7 @@ function JSDialogTooltip()
143919
143616
  var item=this.AryData[index];
143920
143617
 
143921
143618
  item.TitleSpan.innerText=outItem.Title;
143922
- item.TitleSpan.style.color=this.TitleColor;
143619
+ item.TitleSpan.style.color=this.TextColor;
143923
143620
  item.TextSpan.innerText=outItem.Text;
143924
143621
  item.TextSpan.style.color=outItem.Color;
143925
143622
  item.Tr.style.display="";
@@ -144188,6 +143885,9 @@ function JSDialogTooltip()
144188
143885
  this.PositionColor=g_JSChartResource.DialogTooltip.PositionColor;
144189
143886
  this.DateTimeColor=g_JSChartResource.DialogTooltip.DateTimeColor;
144190
143887
 
143888
+ this.TextColor=g_JSChartResource.DialogTooltip.TextColor;
143889
+ this.ValueColor=g_JSChartResource.DialogTooltip.ValueColor;
143890
+
144191
143891
  if (!this.DivDialog) return;
144192
143892
 
144193
143893
  this.UpdateStyle();
@@ -144201,6 +143901,7 @@ function JSDialogTooltip()
144201
143901
  if (this.BorderColor) this.DivDialog.style['border-color']=this.BorderColor;
144202
143902
 
144203
143903
  if (this.TitleBGColor) this.TitleBox.DivTitle.style['background-color']=this.TitleBGColor;
143904
+ if (this.TitleColor) this.TitleBox.DivName.style['color']=this.TitleColor;
144204
143905
 
144205
143906
  this.UpdateTableDOM();
144206
143907
  },
@@ -144214,7 +143915,7 @@ function JSDialogTooltip()
144214
143915
  {
144215
143916
  Title:g_JSChartLocalization.GetText(TitleID, this.LanguageID),
144216
143917
  Text:"--.--",
144217
- Color:this.TitleColor
143918
+ Color:this.ValueColor
144218
143919
  };
144219
143920
 
144220
143921
  if (!IFrameSplitOperator.IsNumber(price)) return item;
@@ -144222,7 +143923,7 @@ function JSDialogTooltip()
144222
143923
  if (format==2)
144223
143924
  {
144224
143925
  item.Text=price.toFixed(defaultfloatPrecision);
144225
- item.Color=this.TitleColor;
143926
+ item.Color=this.ValueColor;
144226
143927
  return item;
144227
143928
  }
144228
143929
 
@@ -144248,7 +143949,7 @@ function JSDialogTooltip()
144248
143949
  {
144249
143950
  Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
144250
143951
  Text:'--',
144251
- Color:this.TitleColor
143952
+ Color:this.ValueColor
144252
143953
  };
144253
143954
 
144254
143955
  if (!IFrameSplitOperator.IsNumber(value)) return item;
@@ -144296,7 +143997,7 @@ function JSDialogTooltip()
144296
143997
  {
144297
143998
  Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
144298
143999
  Text:"--.--",
144299
- Color:this.TitleColor
144000
+ Color:this.ValueColor
144300
144001
  };
144301
144002
 
144302
144003
  if (!IFrameSplitOperator.IsNumber(price) || !IFrameSplitOperator.IsNumber(yClose)) return item;
@@ -144326,7 +144027,7 @@ function JSDialogTooltip()
144326
144027
  {
144327
144028
  Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
144328
144029
  Text:"--.--",
144329
- Color:this.TitleColor
144030
+ Color:this.ValueColor
144330
144031
  };
144331
144032
 
144332
144033
  if (!IFrameSplitOperator.IsNumber(price) || !IFrameSplitOperator.IsNumber(yClose)) return item;
@@ -144345,7 +144046,7 @@ function JSDialogTooltip()
144345
144046
  {
144346
144047
  Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
144347
144048
  Text:"--.--",
144348
- Color:this.TitleColor
144049
+ Color:this.ValueColor
144349
144050
  };
144350
144051
 
144351
144052
 
@@ -145442,7 +145143,7 @@ function HQChartScriptWorker()
145442
145143
 
145443
145144
 
145444
145145
 
145445
- var HQCHART_VERSION="1.1.13980";
145146
+ var HQCHART_VERSION="1.1.13988";
145446
145147
 
145447
145148
  function PrintHQChartVersion()
145448
145149
  {