From c9fb485ec438ca387305b57cafeb58cafbb70a29 Mon Sep 17 00:00:00 2001 From: jones2000 Date: Tue, 13 Aug 2024 17:34:53 +0800 Subject: [PATCH] ver 13698 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 13696 小程序K线增加拖动属性EnableMoveData 13695 GetFinance()支持错误信息设置 --- umychart_uniapp_h5/umychart.uniapp.h5.js | 11 +++--- .../jscommon/umychart.NetworkFilterTest.js | 27 ++++++++++++-- vuehqchart/src/jscommon/umychart.complier.js | 9 ++--- vuehqchart/src/jscommon/umychart.version.js | 2 +- .../src/jscommon/umychart.vue/umychart.vue.js | 11 +++--- .../jscommon/umychart.NetworkFilterTest.js | 27 ++++++++++++-- webhqchart.demo/jscommon/umychart.complier.js | 9 ++--- webhqchart.demo/jscommon/umychart.testdata.js | 27 ++++++++++++-- webhqchart.demo/jscommon/umychart.version.js | 2 +- webhqchart/umychart.NetworkFilterTest.js | 27 ++++++++++++-- webhqchart/umychart.complier.js | 9 ++--- webhqchart/umychart.testdata.js | 27 ++++++++++++-- webhqchart/umychart.version.js | 2 +- wechathqchart/umychart.version.wechat.js | 2 +- wechathqchart/umychart.wechat.3.0.js | 35 ++++++++++++------- 15 files changed, 179 insertions(+), 48 deletions(-) diff --git a/umychart_uniapp_h5/umychart.uniapp.h5.js b/umychart_uniapp_h5/umychart.uniapp.h5.js index bf2564ca5..7ecf44ab4 100644 --- a/umychart_uniapp_h5/umychart.uniapp.h5.js +++ b/umychart_uniapp_h5/umychart.uniapp.h5.js @@ -99580,11 +99580,11 @@ function JSParser(code) return this.LookAhead.Type==7 /*Punctuator*/ && this.LookAhead.Value==value; } - this.Expect=function(value) + this.Expect=function(value, message) { let token=this.NextToken(); if (token.Type!=7 /*Punctuator*/ || token.Value!=value) - this.ThrowUnexpectedToken(token); + this.ThrowUnexpectedToken(token, message); } //是否是赋值操作符 @@ -100009,7 +100009,7 @@ function JSParser(code) // Quietly expect a comma when in tolerant mode, otherwise delegates to expect(). this.ExpectCommaSeparator=function() { - this.Expect(','); + this.Expect(',',"函数参数格式错误"); } // https://tc39.github.io/ecma262/#sec-primary-expression @@ -112372,7 +112372,8 @@ function JSSymbolData(ast,option,jsExecute) }; this.NetworkFilter(obj, function(recvData) { - self.RecvStockValue(recvData,jobItem,key,0); + if (recvData.Error) self.AddStockValueError(key,recvData.Error); + else self.RecvStockValue(recvData,jobItem,key,0); self.Execute.RunNextJob(); }); @@ -137750,7 +137751,7 @@ function ScrollBarBGChart() -var HQCHART_VERSION="1.1.13688"; +var HQCHART_VERSION="1.1.13697"; function PrintHQChartVersion() { diff --git a/vuehqchart/src/jscommon/umychart.NetworkFilterTest.js b/vuehqchart/src/jscommon/umychart.NetworkFilterTest.js index 783838054..ac250405e 100644 --- a/vuehqchart/src/jscommon/umychart.NetworkFilterTest.js +++ b/vuehqchart/src/jscommon/umychart.NetworkFilterTest.js @@ -49163,10 +49163,13 @@ HQData.RequestIndexVariantData=function(data,callback) //测试数据 var kData=data.Self.Data; var hqchartData={ DataType:2, Data:[] }; + var testValue=0.15; for(var i=0;i0.23) testValue=0.15; } callback(hqchartData); } @@ -49182,6 +49185,12 @@ HQData.RequestIndexVariantData=function(data,callback) } callback(hqchartData); } + else + { + var error= `变量'${varName}' 没有对接数据. [HQData.RequestIndexVariantData]`; + var hqchartData={ Error:error }; + callback(hqchartData); + } } @@ -49204,6 +49213,11 @@ HQData.CustomFunction_RequestData=function(data, callback) hqchartData.Data.push({ Date:kItem.Date, Time:kItem.Time, Value:kItem.Vol/3 }); } } + else + { + var error= `函数'${funcName}' 没有对接数据. [HQData.CustomFunction_RequestData]`; + var hqchartData={ Error:error }; + } callback(hqchartData); } @@ -49226,7 +49240,9 @@ HQData.CustomVarData_RequestData=function(data, callback) } else { - throw `${varName} 没有对接. [HQData.CustomVarData_RequestData]` + var error= `变量'${varName}' 没有对接数据. [HQData.CustomVarData_RequestData]`; + var hqchartData={ Error:error }; + callback(hqchartData); } @@ -49380,7 +49396,14 @@ HQData.Finance_RequestData=function(data,callback) var id=data.Request.Data.id; var hqchartData=null; if (id==7) // 流通股本(随时间可能有变化) + { hqchartData=TEST_FINANCE_7.data; + } + else + { + var error= `Finance(${id}) 没有对接数据. [HQData.Finance_RequestData]`; + hqchartData={ Error:error }; + } if (hqchartData) callback(hqchartData); } diff --git a/vuehqchart/src/jscommon/umychart.complier.js b/vuehqchart/src/jscommon/umychart.complier.js index 7f3ad950c..b11f00dc5 100644 --- a/vuehqchart/src/jscommon/umychart.complier.js +++ b/vuehqchart/src/jscommon/umychart.complier.js @@ -1605,11 +1605,11 @@ function JSParser(code) return this.LookAhead.Type==7 /*Punctuator*/ && this.LookAhead.Value==value; } - this.Expect=function(value) + this.Expect=function(value, message) { let token=this.NextToken(); if (token.Type!=7 /*Punctuator*/ || token.Value!=value) - this.ThrowUnexpectedToken(token); + this.ThrowUnexpectedToken(token, message); } //是否是赋值操作符 @@ -2034,7 +2034,7 @@ function JSParser(code) // Quietly expect a comma when in tolerant mode, otherwise delegates to expect(). this.ExpectCommaSeparator=function() { - this.Expect(','); + this.Expect(',',"函数参数格式错误"); } // https://tc39.github.io/ecma262/#sec-primary-expression @@ -14397,7 +14397,8 @@ function JSSymbolData(ast,option,jsExecute) }; this.NetworkFilter(obj, function(recvData) { - self.RecvStockValue(recvData,jobItem,key,0); + if (recvData.Error) self.AddStockValueError(key,recvData.Error); + else self.RecvStockValue(recvData,jobItem,key,0); self.Execute.RunNextJob(); }); diff --git a/vuehqchart/src/jscommon/umychart.version.js b/vuehqchart/src/jscommon/umychart.version.js index 2f3e65677..1ca365ed2 100644 --- a/vuehqchart/src/jscommon/umychart.version.js +++ b/vuehqchart/src/jscommon/umychart.version.js @@ -5,7 +5,7 @@ -var HQCHART_VERSION="1.1.13688"; +var HQCHART_VERSION="1.1.13697"; function PrintHQChartVersion() { diff --git a/vuehqchart/src/jscommon/umychart.vue/umychart.vue.js b/vuehqchart/src/jscommon/umychart.vue/umychart.vue.js index a696e85b5..04d85cc77 100644 --- a/vuehqchart/src/jscommon/umychart.vue/umychart.vue.js +++ b/vuehqchart/src/jscommon/umychart.vue/umychart.vue.js @@ -99624,11 +99624,11 @@ function JSParser(code) return this.LookAhead.Type==7 /*Punctuator*/ && this.LookAhead.Value==value; } - this.Expect=function(value) + this.Expect=function(value, message) { let token=this.NextToken(); if (token.Type!=7 /*Punctuator*/ || token.Value!=value) - this.ThrowUnexpectedToken(token); + this.ThrowUnexpectedToken(token, message); } //是否是赋值操作符 @@ -100053,7 +100053,7 @@ function JSParser(code) // Quietly expect a comma when in tolerant mode, otherwise delegates to expect(). this.ExpectCommaSeparator=function() { - this.Expect(','); + this.Expect(',',"函数参数格式错误"); } // https://tc39.github.io/ecma262/#sec-primary-expression @@ -112416,7 +112416,8 @@ function JSSymbolData(ast,option,jsExecute) }; this.NetworkFilter(obj, function(recvData) { - self.RecvStockValue(recvData,jobItem,key,0); + if (recvData.Error) self.AddStockValueError(key,recvData.Error); + else self.RecvStockValue(recvData,jobItem,key,0); self.Execute.RunNextJob(); }); @@ -142266,7 +142267,7 @@ function HQChartScriptWorker() -var HQCHART_VERSION="1.1.13688"; +var HQCHART_VERSION="1.1.13697"; function PrintHQChartVersion() { diff --git a/webhqchart.demo/jscommon/umychart.NetworkFilterTest.js b/webhqchart.demo/jscommon/umychart.NetworkFilterTest.js index 783838054..ac250405e 100644 --- a/webhqchart.demo/jscommon/umychart.NetworkFilterTest.js +++ b/webhqchart.demo/jscommon/umychart.NetworkFilterTest.js @@ -49163,10 +49163,13 @@ HQData.RequestIndexVariantData=function(data,callback) //测试数据 var kData=data.Self.Data; var hqchartData={ DataType:2, Data:[] }; + var testValue=0.15; for(var i=0;i0.23) testValue=0.15; } callback(hqchartData); } @@ -49182,6 +49185,12 @@ HQData.RequestIndexVariantData=function(data,callback) } callback(hqchartData); } + else + { + var error= `变量'${varName}' 没有对接数据. [HQData.RequestIndexVariantData]`; + var hqchartData={ Error:error }; + callback(hqchartData); + } } @@ -49204,6 +49213,11 @@ HQData.CustomFunction_RequestData=function(data, callback) hqchartData.Data.push({ Date:kItem.Date, Time:kItem.Time, Value:kItem.Vol/3 }); } } + else + { + var error= `函数'${funcName}' 没有对接数据. [HQData.CustomFunction_RequestData]`; + var hqchartData={ Error:error }; + } callback(hqchartData); } @@ -49226,7 +49240,9 @@ HQData.CustomVarData_RequestData=function(data, callback) } else { - throw `${varName} 没有对接. [HQData.CustomVarData_RequestData]` + var error= `变量'${varName}' 没有对接数据. [HQData.CustomVarData_RequestData]`; + var hqchartData={ Error:error }; + callback(hqchartData); } @@ -49380,7 +49396,14 @@ HQData.Finance_RequestData=function(data,callback) var id=data.Request.Data.id; var hqchartData=null; if (id==7) // 流通股本(随时间可能有变化) + { hqchartData=TEST_FINANCE_7.data; + } + else + { + var error= `Finance(${id}) 没有对接数据. [HQData.Finance_RequestData]`; + hqchartData={ Error:error }; + } if (hqchartData) callback(hqchartData); } diff --git a/webhqchart.demo/jscommon/umychart.complier.js b/webhqchart.demo/jscommon/umychart.complier.js index 7f3ad950c..b11f00dc5 100644 --- a/webhqchart.demo/jscommon/umychart.complier.js +++ b/webhqchart.demo/jscommon/umychart.complier.js @@ -1605,11 +1605,11 @@ function JSParser(code) return this.LookAhead.Type==7 /*Punctuator*/ && this.LookAhead.Value==value; } - this.Expect=function(value) + this.Expect=function(value, message) { let token=this.NextToken(); if (token.Type!=7 /*Punctuator*/ || token.Value!=value) - this.ThrowUnexpectedToken(token); + this.ThrowUnexpectedToken(token, message); } //是否是赋值操作符 @@ -2034,7 +2034,7 @@ function JSParser(code) // Quietly expect a comma when in tolerant mode, otherwise delegates to expect(). this.ExpectCommaSeparator=function() { - this.Expect(','); + this.Expect(',',"函数参数格式错误"); } // https://tc39.github.io/ecma262/#sec-primary-expression @@ -14397,7 +14397,8 @@ function JSSymbolData(ast,option,jsExecute) }; this.NetworkFilter(obj, function(recvData) { - self.RecvStockValue(recvData,jobItem,key,0); + if (recvData.Error) self.AddStockValueError(key,recvData.Error); + else self.RecvStockValue(recvData,jobItem,key,0); self.Execute.RunNextJob(); }); diff --git a/webhqchart.demo/jscommon/umychart.testdata.js b/webhqchart.demo/jscommon/umychart.testdata.js index 5f4c3b6dc..9215fd4e7 100644 --- a/webhqchart.demo/jscommon/umychart.testdata.js +++ b/webhqchart.demo/jscommon/umychart.testdata.js @@ -488,10 +488,13 @@ HQData.RequestIndexVariantData=function(data,callback) //测试数据 var kData=data.Self.Data; var hqchartData={ DataType:2, Data:[] }; + var testValue=0.15; for(var i=0;i0.23) testValue=0.15; } callback(hqchartData); } @@ -507,6 +510,12 @@ HQData.RequestIndexVariantData=function(data,callback) } callback(hqchartData); } + else + { + var error= `变量'${varName}' 没有对接数据. [HQData.RequestIndexVariantData]`; + var hqchartData={ Error:error }; + callback(hqchartData); + } } @@ -529,6 +538,11 @@ HQData.CustomFunction_RequestData=function(data, callback) hqchartData.Data.push({ Date:kItem.Date, Time:kItem.Time, Value:kItem.Vol/3 }); } } + else + { + var error= `函数'${funcName}' 没有对接数据. [HQData.CustomFunction_RequestData]`; + var hqchartData={ Error:error }; + } callback(hqchartData); } @@ -551,7 +565,9 @@ HQData.CustomVarData_RequestData=function(data, callback) } else { - throw `${varName} 没有对接. [HQData.CustomVarData_RequestData]` + var error= `变量'${varName}' 没有对接数据. [HQData.CustomVarData_RequestData]`; + var hqchartData={ Error:error }; + callback(hqchartData); } @@ -705,7 +721,14 @@ HQData.Finance_RequestData=function(data,callback) var id=data.Request.Data.id; var hqchartData=null; if (id==7) // 流通股本(随时间可能有变化) + { hqchartData=TEST_FINANCE_7.data; + } + else + { + var error= `Finance(${id}) 没有对接数据. [HQData.Finance_RequestData]`; + hqchartData={ Error:error }; + } if (hqchartData) callback(hqchartData); } diff --git a/webhqchart.demo/jscommon/umychart.version.js b/webhqchart.demo/jscommon/umychart.version.js index 2f3e65677..1ca365ed2 100644 --- a/webhqchart.demo/jscommon/umychart.version.js +++ b/webhqchart.demo/jscommon/umychart.version.js @@ -5,7 +5,7 @@ -var HQCHART_VERSION="1.1.13688"; +var HQCHART_VERSION="1.1.13697"; function PrintHQChartVersion() { diff --git a/webhqchart/umychart.NetworkFilterTest.js b/webhqchart/umychart.NetworkFilterTest.js index 783838054..ac250405e 100644 --- a/webhqchart/umychart.NetworkFilterTest.js +++ b/webhqchart/umychart.NetworkFilterTest.js @@ -49163,10 +49163,13 @@ HQData.RequestIndexVariantData=function(data,callback) //测试数据 var kData=data.Self.Data; var hqchartData={ DataType:2, Data:[] }; + var testValue=0.15; for(var i=0;i0.23) testValue=0.15; } callback(hqchartData); } @@ -49182,6 +49185,12 @@ HQData.RequestIndexVariantData=function(data,callback) } callback(hqchartData); } + else + { + var error= `变量'${varName}' 没有对接数据. [HQData.RequestIndexVariantData]`; + var hqchartData={ Error:error }; + callback(hqchartData); + } } @@ -49204,6 +49213,11 @@ HQData.CustomFunction_RequestData=function(data, callback) hqchartData.Data.push({ Date:kItem.Date, Time:kItem.Time, Value:kItem.Vol/3 }); } } + else + { + var error= `函数'${funcName}' 没有对接数据. [HQData.CustomFunction_RequestData]`; + var hqchartData={ Error:error }; + } callback(hqchartData); } @@ -49226,7 +49240,9 @@ HQData.CustomVarData_RequestData=function(data, callback) } else { - throw `${varName} 没有对接. [HQData.CustomVarData_RequestData]` + var error= `变量'${varName}' 没有对接数据. [HQData.CustomVarData_RequestData]`; + var hqchartData={ Error:error }; + callback(hqchartData); } @@ -49380,7 +49396,14 @@ HQData.Finance_RequestData=function(data,callback) var id=data.Request.Data.id; var hqchartData=null; if (id==7) // 流通股本(随时间可能有变化) + { hqchartData=TEST_FINANCE_7.data; + } + else + { + var error= `Finance(${id}) 没有对接数据. [HQData.Finance_RequestData]`; + hqchartData={ Error:error }; + } if (hqchartData) callback(hqchartData); } diff --git a/webhqchart/umychart.complier.js b/webhqchart/umychart.complier.js index 7f3ad950c..b11f00dc5 100644 --- a/webhqchart/umychart.complier.js +++ b/webhqchart/umychart.complier.js @@ -1605,11 +1605,11 @@ function JSParser(code) return this.LookAhead.Type==7 /*Punctuator*/ && this.LookAhead.Value==value; } - this.Expect=function(value) + this.Expect=function(value, message) { let token=this.NextToken(); if (token.Type!=7 /*Punctuator*/ || token.Value!=value) - this.ThrowUnexpectedToken(token); + this.ThrowUnexpectedToken(token, message); } //是否是赋值操作符 @@ -2034,7 +2034,7 @@ function JSParser(code) // Quietly expect a comma when in tolerant mode, otherwise delegates to expect(). this.ExpectCommaSeparator=function() { - this.Expect(','); + this.Expect(',',"函数参数格式错误"); } // https://tc39.github.io/ecma262/#sec-primary-expression @@ -14397,7 +14397,8 @@ function JSSymbolData(ast,option,jsExecute) }; this.NetworkFilter(obj, function(recvData) { - self.RecvStockValue(recvData,jobItem,key,0); + if (recvData.Error) self.AddStockValueError(key,recvData.Error); + else self.RecvStockValue(recvData,jobItem,key,0); self.Execute.RunNextJob(); }); diff --git a/webhqchart/umychart.testdata.js b/webhqchart/umychart.testdata.js index 5f4c3b6dc..9215fd4e7 100644 --- a/webhqchart/umychart.testdata.js +++ b/webhqchart/umychart.testdata.js @@ -488,10 +488,13 @@ HQData.RequestIndexVariantData=function(data,callback) //测试数据 var kData=data.Self.Data; var hqchartData={ DataType:2, Data:[] }; + var testValue=0.15; for(var i=0;i0.23) testValue=0.15; } callback(hqchartData); } @@ -507,6 +510,12 @@ HQData.RequestIndexVariantData=function(data,callback) } callback(hqchartData); } + else + { + var error= `变量'${varName}' 没有对接数据. [HQData.RequestIndexVariantData]`; + var hqchartData={ Error:error }; + callback(hqchartData); + } } @@ -529,6 +538,11 @@ HQData.CustomFunction_RequestData=function(data, callback) hqchartData.Data.push({ Date:kItem.Date, Time:kItem.Time, Value:kItem.Vol/3 }); } } + else + { + var error= `函数'${funcName}' 没有对接数据. [HQData.CustomFunction_RequestData]`; + var hqchartData={ Error:error }; + } callback(hqchartData); } @@ -551,7 +565,9 @@ HQData.CustomVarData_RequestData=function(data, callback) } else { - throw `${varName} 没有对接. [HQData.CustomVarData_RequestData]` + var error= `变量'${varName}' 没有对接数据. [HQData.CustomVarData_RequestData]`; + var hqchartData={ Error:error }; + callback(hqchartData); } @@ -705,7 +721,14 @@ HQData.Finance_RequestData=function(data,callback) var id=data.Request.Data.id; var hqchartData=null; if (id==7) // 流通股本(随时间可能有变化) + { hqchartData=TEST_FINANCE_7.data; + } + else + { + var error= `Finance(${id}) 没有对接数据. [HQData.Finance_RequestData]`; + hqchartData={ Error:error }; + } if (hqchartData) callback(hqchartData); } diff --git a/webhqchart/umychart.version.js b/webhqchart/umychart.version.js index 2f3e65677..1ca365ed2 100644 --- a/webhqchart/umychart.version.js +++ b/webhqchart/umychart.version.js @@ -5,7 +5,7 @@ -var HQCHART_VERSION="1.1.13688"; +var HQCHART_VERSION="1.1.13697"; function PrintHQChartVersion() { diff --git a/wechathqchart/umychart.version.wechat.js b/wechathqchart/umychart.version.wechat.js index 37a4440bf..d1df7b1a0 100644 --- a/wechathqchart/umychart.version.wechat.js +++ b/wechathqchart/umychart.version.wechat.js @@ -5,7 +5,7 @@ -var HQCHART_VERSION="1.1.13687"; +var HQCHART_VERSION="1.1.13696"; function PrintHQChartVersion() { diff --git a/wechathqchart/umychart.wechat.3.0.js b/wechathqchart/umychart.wechat.3.0.js index 60c241b78..2077f8a7c 100644 --- a/wechathqchart/umychart.wechat.3.0.js +++ b/wechathqchart/umychart.wechat.3.0.js @@ -302,6 +302,7 @@ function JSChart(element) if (option.SourceDatatLimit) chart.SetSourceDatatLimit(option.SourceDatatLimit); if (option.EnableZoomUpDown) chart.EnableZoomUpDown=option.EnableZoomUpDown; + if (option.EnableMoveData) chart.EnableMoveData=option.EnableMoveData; if (option.TouchMoveMinAngle) chart.TouchMoveMinAngle=option.TouchMoveMinAngle; if (IFrameSplitOperator.IsBool(option.EnableScrollUpDown)) chart.EnableScrollUpDown=option.EnableScrollUpDown; if (option.ZoomStepPixel>0) chart.ZoomStepPixel=option.ZoomStepPixel; @@ -1847,6 +1848,19 @@ function JSChartContainer(uielement) } } + this.StartMoveTimer=function(touches, e) + { + var x = touches[0].clientX; + var y = touches[0].clientY; + this.LastMovePoint={ X:x, Y:y }; + if (this.DrawMoveTimer) return; + this.DrawMoveTimer=setTimeout(()=> + { + if (!this.LastMovePoint) return; + this.OnMouseMove(this.LastMovePoint.X, this.LastMovePoint.Y, e); + this.DrawMoveTimer=null; + }, this.DrawMoveWaitTime); + } this.ontouchmove = function (e) { @@ -1854,23 +1868,13 @@ function JSChartContainer(uielement) var jsChart = this; var touches = this.GetToucheData(e, jsChart.IsForceLandscape); - + if (this.IsPhoneDragging(e)) { var drag = jsChart.MouseDrag; if (drag == null) { - var x = touches[0].clientX; - var y = touches[0].clientY; - this.LastMovePoint={ X:x, Y:y }; - if (this.DrawMoveTimer) return; - this.DrawMoveTimer=setTimeout(()=> - { - if (!this.LastMovePoint) return; - this.OnMouseMove(this.LastMovePoint.X, this.LastMovePoint.Y, e); - this.DrawMoveTimer=null; - }, this.DrawMoveWaitTime); - + this.StartMoveTimer(touches, e); } else { @@ -1943,6 +1947,12 @@ function JSChartContainer(uielement) } } + if (this.EnableMoveData && this.EnableMoveData.Touch===false) + { + jsChart.MouseDrag = null; + return; + } + if (moveSetp < 5) return; var isLeft = true; if (drag.LastMove.X < touches[0].clientX) isLeft = false;//右移数据 @@ -5260,6 +5270,7 @@ function KLineChartContainer(uielement) this.StepPixel = 4; //移动一个数据需要的像素 this.ZoomStepPixel = 5; //放大缩小手势需要的最小像素 this.EnableZoomUpDown=null; //是否手势/键盘/鼠标允许缩放{ Touch:true/false, Mouse:true/false, Keyboard:true/false, Wheel:true/false } + this.EnableMoveData=null; //是否可以移动K线 { Touch:true/false } this.DragDownload = { Day: { Enable: false, IsEnd: false, Status: 0 }, //日线数据拖拽下载(暂不支持) Status: 0空闲 1 下载中