From 547fbde5c4c61198883631eaab21677262dbe9e3 Mon Sep 17 00:00:00 2001 From: jones2000 Date: Wed, 11 Sep 2024 10:38:53 +0800 Subject: [PATCH] ver 13812 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 13809 区间选择增加顶部标记 13808 修正ShowMinuteChartDialog()计算X,Y错误 --- umychart_uniapp_h5/umychart.uniapp.h5.js | 83 ++++++++++++++++++- vuehqchart/src/jscommon/umychart.js | 81 +++++++++++++++++- vuehqchart/src/jscommon/umychart.version.js | 2 +- .../src/jscommon/umychart.vue/umychart.vue.js | 83 ++++++++++++++++++- webhqchart.demo/jscommon/umychart.js | 81 +++++++++++++++++- webhqchart.demo/jscommon/umychart.version.js | 2 +- webhqchart.demo/samples/kline_index_edit.html | 55 +++++++++++- .../samples/minute_index_edit.html | 60 ++++++++++++-- webhqchart/umychart.js | 81 +++++++++++++++++- webhqchart/umychart.version.js | 2 +- 10 files changed, 510 insertions(+), 20 deletions(-) diff --git a/umychart_uniapp_h5/umychart.uniapp.h5.js b/umychart_uniapp_h5/umychart.uniapp.h5.js index 992449772..df6dd06a8 100644 --- a/umychart_uniapp_h5/umychart.uniapp.h5.js +++ b/umychart_uniapp_h5/umychart.uniapp.h5.js @@ -47941,6 +47941,17 @@ function RectSelectPaint() this.AreaColor=g_JSChartResource.RectSelect.AreaColor; //面积 this.SubAreaColor=g_JSChartResource.RectSelect.SubAreaColor; + //标记图标 + this.MarkConfig= + { + Family:g_JSChartResource.RectSelect.Mark.Family, + Text:g_JSChartResource.RectSelect.Mark.Text, + Color:g_JSChartResource.RectSelect.Mark.Color, + Size:g_JSChartResource.RectSelect.Mark.Size, + IsShow:false, + Position: { Index:g_JSChartResource.RectSelect.Mark.Position.Index, Top:g_JSChartResource.RectSelect.Mark.Position.Top } + } + this.FirstPoint; this.SecondPoint; this.CenterPoint; @@ -47988,6 +47999,17 @@ function RectSelectPaint() if (IFrameSplitOperator.IsNumber(item.Position)) this.ShowRangeText.Position=item.Position; if (IFrameSplitOperator.IsNumber(item.SubPosition)) this.ShowRangeText.SubPosition=item.SubPosition; } + + if (option.Mark) + { + var item=option.Mark; + if (IFrameSplitOperator.IsBool(item.IsShow)) this.MarkConfig.IsShow=item.IsShow; + if (item.Position) + { + if (IFrameSplitOperator.IsNumber(item.Position.Index)) this.MarkConfig.Position.Index=item.Position.Index; + if (item.Position.Top) this.MarkConfig.Position.Top=item.Position.Top; + } + } } } @@ -48460,6 +48482,7 @@ function RectSelectPaint() this.DrawLines(aryLines); this.DrawArea(startPoint, endPoint, startDate, startEnd, this.AreaColor); + this.DrawMark(startPoint, endPoint); if (this.SubClient && this.SubClient.Start && this.SubClient.End) { @@ -48693,6 +48716,45 @@ function RectSelectPaint() if (IFrameSplitOperator.IsNumber(type)) this.DragRect.push( {Rect:rtArea, Type:type} ); } } + + this.DrawMark=function(startPoint,endPoint) + { + if (!startPoint ||!endPoint) return; + + if (!this.ChartFrame || !this.ChartFrame.SubFrame) return; + var subFrame=this.ChartFrame.SubFrame[0].Frame; + if (!subFrame) return; + + if (!this.MarkConfig) return; + var config=this.MarkConfig; + if (!config.IsShow) return; + + var font=`${config.Size}px ${config.Family}`; + this.Canvas.font=font; + var top=null; + switch(config.Position.Top) + { + case "TopEx": + top=subFrame.ChartBorder.GetTopEx(); + break; + case "Top": + top=subFrame.ChartBorder.GetTop(); + break; + case "TopTitle": + top=subFrame.ChartBorder.GetTopTitle(); + break; + default: + return; + } + + var xText=startPoint.X; + var yText=top; + + this.Canvas.textAlign="center"; + this.Canvas.textBaseline="bottom"; + this.Canvas.fillStyle=config.Color; + this.Canvas.fillText(config.Text,xText,yText); + } } //鼠标拖动选中区域 @@ -72821,6 +72883,8 @@ function JSChartResource() RangeTextSubColor:"rgb(255,255,255)", RangeTextSubFont:12*GetDevicePixelRatio() +"px 微软雅黑", RangeTextSubBGColor:'rgb(54,54,54)', + + Mark:{ Family:'iconfont', Text:'\ue695' , Color:'rgb(250,0,0)', Size:15*GetDevicePixelRatio(), Position:{ Index:0, Top:"TopEx" } } } //选中图形 @@ -73677,6 +73741,20 @@ function JSChartResource() if (item.RangeTextSubColor) this.RectSelect.RangeTextSubColor=item.RangeTextSubColor; if (item.RangeTextSubFont) this.RectSelect.RangeTextSubFont=item.RangeTextSubFont; if (item.RangeTextSubBGColor) this.RectSelect.RangeTextSubBGColor=item.RangeTextSubBGColor; + + if (item.Mark) + { + var subItem=item.Mark; + if (subItem.Family) this.RectSelect.Mark.Family=subItem.Family; + if (subItem.Text) this.RectSelect.Mark.Text=subItem.Text; + if (subItem.Color) this.RectSelect.Mark.Color=subItem.Color; + if (IFrameSplitOperator.IsNumber(subItem.Size)) this.RectSelect.Mark.Size=subItem.Size; + if (subItem.Position) + { + if (subItem.Position.Top) this.RectSelect.Mark.Position.Top=subItem.Position.Top; + if (IFrameSplitOperator.IsNumber(subItem.Position.Index)) this.RectSelect.Mark.Position.Index=subItem.Position.Index; + } + } } if (style.RectDrag) @@ -76252,6 +76330,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement) if (!this.PopMinuteChart) return; if (!data.Tooltip || !data.Chart) return; + var pixelRatio=GetDevicePixelRatio(); var rtClient=this.UIElement.getBoundingClientRect(); var rtScroll=GetScrollPosition(); @@ -76261,7 +76340,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement) var date=data.Tooltip.Data.Date; var symbol=data.Chart.Symbol; - this.PopMinuteChart.Show({ Date:date, Symbol:symbol, Data:data.Tooltip.Data }, x,y); + this.PopMinuteChart.Show({ Date:date, Symbol:symbol, Data:data.Tooltip.Data }, x/pixelRatio,y/pixelRatio); } @@ -138591,7 +138670,7 @@ function ScrollBarBGChart() -var HQCHART_VERSION="1.1.13803"; +var HQCHART_VERSION="1.1.13809"; function PrintHQChartVersion() { diff --git a/vuehqchart/src/jscommon/umychart.js b/vuehqchart/src/jscommon/umychart.js index cbf9560c6..9667d388f 100644 --- a/vuehqchart/src/jscommon/umychart.js +++ b/vuehqchart/src/jscommon/umychart.js @@ -44016,6 +44016,17 @@ function RectSelectPaint() this.AreaColor=g_JSChartResource.RectSelect.AreaColor; //面积 this.SubAreaColor=g_JSChartResource.RectSelect.SubAreaColor; + //标记图标 + this.MarkConfig= + { + Family:g_JSChartResource.RectSelect.Mark.Family, + Text:g_JSChartResource.RectSelect.Mark.Text, + Color:g_JSChartResource.RectSelect.Mark.Color, + Size:g_JSChartResource.RectSelect.Mark.Size, + IsShow:false, + Position: { Index:g_JSChartResource.RectSelect.Mark.Position.Index, Top:g_JSChartResource.RectSelect.Mark.Position.Top } + } + this.FirstPoint; this.SecondPoint; this.CenterPoint; @@ -44063,6 +44074,17 @@ function RectSelectPaint() if (IFrameSplitOperator.IsNumber(item.Position)) this.ShowRangeText.Position=item.Position; if (IFrameSplitOperator.IsNumber(item.SubPosition)) this.ShowRangeText.SubPosition=item.SubPosition; } + + if (option.Mark) + { + var item=option.Mark; + if (IFrameSplitOperator.IsBool(item.IsShow)) this.MarkConfig.IsShow=item.IsShow; + if (item.Position) + { + if (IFrameSplitOperator.IsNumber(item.Position.Index)) this.MarkConfig.Position.Index=item.Position.Index; + if (item.Position.Top) this.MarkConfig.Position.Top=item.Position.Top; + } + } } } @@ -44535,6 +44557,7 @@ function RectSelectPaint() this.DrawLines(aryLines); this.DrawArea(startPoint, endPoint, startDate, startEnd, this.AreaColor); + this.DrawMark(startPoint, endPoint); if (this.SubClient && this.SubClient.Start && this.SubClient.End) { @@ -44768,6 +44791,45 @@ function RectSelectPaint() if (IFrameSplitOperator.IsNumber(type)) this.DragRect.push( {Rect:rtArea, Type:type} ); } } + + this.DrawMark=function(startPoint,endPoint) + { + if (!startPoint ||!endPoint) return; + + if (!this.ChartFrame || !this.ChartFrame.SubFrame) return; + var subFrame=this.ChartFrame.SubFrame[0].Frame; + if (!subFrame) return; + + if (!this.MarkConfig) return; + var config=this.MarkConfig; + if (!config.IsShow) return; + + var font=`${config.Size}px ${config.Family}`; + this.Canvas.font=font; + var top=null; + switch(config.Position.Top) + { + case "TopEx": + top=subFrame.ChartBorder.GetTopEx(); + break; + case "Top": + top=subFrame.ChartBorder.GetTop(); + break; + case "TopTitle": + top=subFrame.ChartBorder.GetTopTitle(); + break; + default: + return; + } + + var xText=startPoint.X; + var yText=top; + + this.Canvas.textAlign="center"; + this.Canvas.textBaseline="bottom"; + this.Canvas.fillStyle=config.Color; + this.Canvas.fillText(config.Text,xText,yText); + } } //鼠标拖动选中区域 @@ -68896,6 +68958,8 @@ function JSChartResource() RangeTextSubColor:"rgb(255,255,255)", RangeTextSubFont:12*GetDevicePixelRatio() +"px 微软雅黑", RangeTextSubBGColor:'rgb(54,54,54)', + + Mark:{ Family:'iconfont', Text:'\ue695' , Color:'rgb(250,0,0)', Size:15*GetDevicePixelRatio(), Position:{ Index:0, Top:"TopEx" } } } //选中图形 @@ -69752,6 +69816,20 @@ function JSChartResource() if (item.RangeTextSubColor) this.RectSelect.RangeTextSubColor=item.RangeTextSubColor; if (item.RangeTextSubFont) this.RectSelect.RangeTextSubFont=item.RangeTextSubFont; if (item.RangeTextSubBGColor) this.RectSelect.RangeTextSubBGColor=item.RangeTextSubBGColor; + + if (item.Mark) + { + var subItem=item.Mark; + if (subItem.Family) this.RectSelect.Mark.Family=subItem.Family; + if (subItem.Text) this.RectSelect.Mark.Text=subItem.Text; + if (subItem.Color) this.RectSelect.Mark.Color=subItem.Color; + if (IFrameSplitOperator.IsNumber(subItem.Size)) this.RectSelect.Mark.Size=subItem.Size; + if (subItem.Position) + { + if (subItem.Position.Top) this.RectSelect.Mark.Position.Top=subItem.Position.Top; + if (IFrameSplitOperator.IsNumber(subItem.Position.Index)) this.RectSelect.Mark.Position.Index=subItem.Position.Index; + } + } } if (style.RectDrag) @@ -72327,6 +72405,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement) if (!this.PopMinuteChart) return; if (!data.Tooltip || !data.Chart) return; + var pixelRatio=GetDevicePixelRatio(); var rtClient=this.UIElement.getBoundingClientRect(); var rtScroll=GetScrollPosition(); @@ -72336,7 +72415,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement) var date=data.Tooltip.Data.Date; var symbol=data.Chart.Symbol; - this.PopMinuteChart.Show({ Date:date, Symbol:symbol, Data:data.Tooltip.Data }, x,y); + this.PopMinuteChart.Show({ Date:date, Symbol:symbol, Data:data.Tooltip.Data }, x/pixelRatio,y/pixelRatio); } diff --git a/vuehqchart/src/jscommon/umychart.version.js b/vuehqchart/src/jscommon/umychart.version.js index caa695f68..f71a3e102 100644 --- a/vuehqchart/src/jscommon/umychart.version.js +++ b/vuehqchart/src/jscommon/umychart.version.js @@ -5,7 +5,7 @@ -var HQCHART_VERSION="1.1.13803"; +var HQCHART_VERSION="1.1.13809"; function PrintHQChartVersion() { diff --git a/vuehqchart/src/jscommon/umychart.vue/umychart.vue.js b/vuehqchart/src/jscommon/umychart.vue/umychart.vue.js index b474deac1..19e039392 100644 --- a/vuehqchart/src/jscommon/umychart.vue/umychart.vue.js +++ b/vuehqchart/src/jscommon/umychart.vue/umychart.vue.js @@ -47985,6 +47985,17 @@ function RectSelectPaint() this.AreaColor=g_JSChartResource.RectSelect.AreaColor; //面积 this.SubAreaColor=g_JSChartResource.RectSelect.SubAreaColor; + //标记图标 + this.MarkConfig= + { + Family:g_JSChartResource.RectSelect.Mark.Family, + Text:g_JSChartResource.RectSelect.Mark.Text, + Color:g_JSChartResource.RectSelect.Mark.Color, + Size:g_JSChartResource.RectSelect.Mark.Size, + IsShow:false, + Position: { Index:g_JSChartResource.RectSelect.Mark.Position.Index, Top:g_JSChartResource.RectSelect.Mark.Position.Top } + } + this.FirstPoint; this.SecondPoint; this.CenterPoint; @@ -48032,6 +48043,17 @@ function RectSelectPaint() if (IFrameSplitOperator.IsNumber(item.Position)) this.ShowRangeText.Position=item.Position; if (IFrameSplitOperator.IsNumber(item.SubPosition)) this.ShowRangeText.SubPosition=item.SubPosition; } + + if (option.Mark) + { + var item=option.Mark; + if (IFrameSplitOperator.IsBool(item.IsShow)) this.MarkConfig.IsShow=item.IsShow; + if (item.Position) + { + if (IFrameSplitOperator.IsNumber(item.Position.Index)) this.MarkConfig.Position.Index=item.Position.Index; + if (item.Position.Top) this.MarkConfig.Position.Top=item.Position.Top; + } + } } } @@ -48504,6 +48526,7 @@ function RectSelectPaint() this.DrawLines(aryLines); this.DrawArea(startPoint, endPoint, startDate, startEnd, this.AreaColor); + this.DrawMark(startPoint, endPoint); if (this.SubClient && this.SubClient.Start && this.SubClient.End) { @@ -48737,6 +48760,45 @@ function RectSelectPaint() if (IFrameSplitOperator.IsNumber(type)) this.DragRect.push( {Rect:rtArea, Type:type} ); } } + + this.DrawMark=function(startPoint,endPoint) + { + if (!startPoint ||!endPoint) return; + + if (!this.ChartFrame || !this.ChartFrame.SubFrame) return; + var subFrame=this.ChartFrame.SubFrame[0].Frame; + if (!subFrame) return; + + if (!this.MarkConfig) return; + var config=this.MarkConfig; + if (!config.IsShow) return; + + var font=`${config.Size}px ${config.Family}`; + this.Canvas.font=font; + var top=null; + switch(config.Position.Top) + { + case "TopEx": + top=subFrame.ChartBorder.GetTopEx(); + break; + case "Top": + top=subFrame.ChartBorder.GetTop(); + break; + case "TopTitle": + top=subFrame.ChartBorder.GetTopTitle(); + break; + default: + return; + } + + var xText=startPoint.X; + var yText=top; + + this.Canvas.textAlign="center"; + this.Canvas.textBaseline="bottom"; + this.Canvas.fillStyle=config.Color; + this.Canvas.fillText(config.Text,xText,yText); + } } //鼠标拖动选中区域 @@ -72865,6 +72927,8 @@ function JSChartResource() RangeTextSubColor:"rgb(255,255,255)", RangeTextSubFont:12*GetDevicePixelRatio() +"px 微软雅黑", RangeTextSubBGColor:'rgb(54,54,54)', + + Mark:{ Family:'iconfont', Text:'\ue695' , Color:'rgb(250,0,0)', Size:15*GetDevicePixelRatio(), Position:{ Index:0, Top:"TopEx" } } } //选中图形 @@ -73721,6 +73785,20 @@ function JSChartResource() if (item.RangeTextSubColor) this.RectSelect.RangeTextSubColor=item.RangeTextSubColor; if (item.RangeTextSubFont) this.RectSelect.RangeTextSubFont=item.RangeTextSubFont; if (item.RangeTextSubBGColor) this.RectSelect.RangeTextSubBGColor=item.RangeTextSubBGColor; + + if (item.Mark) + { + var subItem=item.Mark; + if (subItem.Family) this.RectSelect.Mark.Family=subItem.Family; + if (subItem.Text) this.RectSelect.Mark.Text=subItem.Text; + if (subItem.Color) this.RectSelect.Mark.Color=subItem.Color; + if (IFrameSplitOperator.IsNumber(subItem.Size)) this.RectSelect.Mark.Size=subItem.Size; + if (subItem.Position) + { + if (subItem.Position.Top) this.RectSelect.Mark.Position.Top=subItem.Position.Top; + if (IFrameSplitOperator.IsNumber(subItem.Position.Index)) this.RectSelect.Mark.Position.Index=subItem.Position.Index; + } + } } if (style.RectDrag) @@ -76296,6 +76374,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement) if (!this.PopMinuteChart) return; if (!data.Tooltip || !data.Chart) return; + var pixelRatio=GetDevicePixelRatio(); var rtClient=this.UIElement.getBoundingClientRect(); var rtScroll=GetScrollPosition(); @@ -76305,7 +76384,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement) var date=data.Tooltip.Data.Date; var symbol=data.Chart.Symbol; - this.PopMinuteChart.Show({ Date:date, Symbol:symbol, Data:data.Tooltip.Data }, x,y); + this.PopMinuteChart.Show({ Date:date, Symbol:symbol, Data:data.Tooltip.Data }, x/pixelRatio,y/pixelRatio); } @@ -143147,7 +143226,7 @@ function HQChartScriptWorker() -var HQCHART_VERSION="1.1.13803"; +var HQCHART_VERSION="1.1.13809"; function PrintHQChartVersion() { diff --git a/webhqchart.demo/jscommon/umychart.js b/webhqchart.demo/jscommon/umychart.js index cbf9560c6..9667d388f 100644 --- a/webhqchart.demo/jscommon/umychart.js +++ b/webhqchart.demo/jscommon/umychart.js @@ -44016,6 +44016,17 @@ function RectSelectPaint() this.AreaColor=g_JSChartResource.RectSelect.AreaColor; //面积 this.SubAreaColor=g_JSChartResource.RectSelect.SubAreaColor; + //标记图标 + this.MarkConfig= + { + Family:g_JSChartResource.RectSelect.Mark.Family, + Text:g_JSChartResource.RectSelect.Mark.Text, + Color:g_JSChartResource.RectSelect.Mark.Color, + Size:g_JSChartResource.RectSelect.Mark.Size, + IsShow:false, + Position: { Index:g_JSChartResource.RectSelect.Mark.Position.Index, Top:g_JSChartResource.RectSelect.Mark.Position.Top } + } + this.FirstPoint; this.SecondPoint; this.CenterPoint; @@ -44063,6 +44074,17 @@ function RectSelectPaint() if (IFrameSplitOperator.IsNumber(item.Position)) this.ShowRangeText.Position=item.Position; if (IFrameSplitOperator.IsNumber(item.SubPosition)) this.ShowRangeText.SubPosition=item.SubPosition; } + + if (option.Mark) + { + var item=option.Mark; + if (IFrameSplitOperator.IsBool(item.IsShow)) this.MarkConfig.IsShow=item.IsShow; + if (item.Position) + { + if (IFrameSplitOperator.IsNumber(item.Position.Index)) this.MarkConfig.Position.Index=item.Position.Index; + if (item.Position.Top) this.MarkConfig.Position.Top=item.Position.Top; + } + } } } @@ -44535,6 +44557,7 @@ function RectSelectPaint() this.DrawLines(aryLines); this.DrawArea(startPoint, endPoint, startDate, startEnd, this.AreaColor); + this.DrawMark(startPoint, endPoint); if (this.SubClient && this.SubClient.Start && this.SubClient.End) { @@ -44768,6 +44791,45 @@ function RectSelectPaint() if (IFrameSplitOperator.IsNumber(type)) this.DragRect.push( {Rect:rtArea, Type:type} ); } } + + this.DrawMark=function(startPoint,endPoint) + { + if (!startPoint ||!endPoint) return; + + if (!this.ChartFrame || !this.ChartFrame.SubFrame) return; + var subFrame=this.ChartFrame.SubFrame[0].Frame; + if (!subFrame) return; + + if (!this.MarkConfig) return; + var config=this.MarkConfig; + if (!config.IsShow) return; + + var font=`${config.Size}px ${config.Family}`; + this.Canvas.font=font; + var top=null; + switch(config.Position.Top) + { + case "TopEx": + top=subFrame.ChartBorder.GetTopEx(); + break; + case "Top": + top=subFrame.ChartBorder.GetTop(); + break; + case "TopTitle": + top=subFrame.ChartBorder.GetTopTitle(); + break; + default: + return; + } + + var xText=startPoint.X; + var yText=top; + + this.Canvas.textAlign="center"; + this.Canvas.textBaseline="bottom"; + this.Canvas.fillStyle=config.Color; + this.Canvas.fillText(config.Text,xText,yText); + } } //鼠标拖动选中区域 @@ -68896,6 +68958,8 @@ function JSChartResource() RangeTextSubColor:"rgb(255,255,255)", RangeTextSubFont:12*GetDevicePixelRatio() +"px 微软雅黑", RangeTextSubBGColor:'rgb(54,54,54)', + + Mark:{ Family:'iconfont', Text:'\ue695' , Color:'rgb(250,0,0)', Size:15*GetDevicePixelRatio(), Position:{ Index:0, Top:"TopEx" } } } //选中图形 @@ -69752,6 +69816,20 @@ function JSChartResource() if (item.RangeTextSubColor) this.RectSelect.RangeTextSubColor=item.RangeTextSubColor; if (item.RangeTextSubFont) this.RectSelect.RangeTextSubFont=item.RangeTextSubFont; if (item.RangeTextSubBGColor) this.RectSelect.RangeTextSubBGColor=item.RangeTextSubBGColor; + + if (item.Mark) + { + var subItem=item.Mark; + if (subItem.Family) this.RectSelect.Mark.Family=subItem.Family; + if (subItem.Text) this.RectSelect.Mark.Text=subItem.Text; + if (subItem.Color) this.RectSelect.Mark.Color=subItem.Color; + if (IFrameSplitOperator.IsNumber(subItem.Size)) this.RectSelect.Mark.Size=subItem.Size; + if (subItem.Position) + { + if (subItem.Position.Top) this.RectSelect.Mark.Position.Top=subItem.Position.Top; + if (IFrameSplitOperator.IsNumber(subItem.Position.Index)) this.RectSelect.Mark.Position.Index=subItem.Position.Index; + } + } } if (style.RectDrag) @@ -72327,6 +72405,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement) if (!this.PopMinuteChart) return; if (!data.Tooltip || !data.Chart) return; + var pixelRatio=GetDevicePixelRatio(); var rtClient=this.UIElement.getBoundingClientRect(); var rtScroll=GetScrollPosition(); @@ -72336,7 +72415,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement) var date=data.Tooltip.Data.Date; var symbol=data.Chart.Symbol; - this.PopMinuteChart.Show({ Date:date, Symbol:symbol, Data:data.Tooltip.Data }, x,y); + this.PopMinuteChart.Show({ Date:date, Symbol:symbol, Data:data.Tooltip.Data }, x/pixelRatio,y/pixelRatio); } diff --git a/webhqchart.demo/jscommon/umychart.version.js b/webhqchart.demo/jscommon/umychart.version.js index caa695f68..f71a3e102 100644 --- a/webhqchart.demo/jscommon/umychart.version.js +++ b/webhqchart.demo/jscommon/umychart.version.js @@ -5,7 +5,7 @@ -var HQCHART_VERSION="1.1.13803"; +var HQCHART_VERSION="1.1.13809"; function PrintHQChartVersion() { diff --git a/webhqchart.demo/samples/kline_index_edit.html b/webhqchart.demo/samples/kline_index_edit.html index afa184648..6749691b0 100644 --- a/webhqchart.demo/samples/kline_index_edit.html +++ b/webhqchart.demo/samples/kline_index_edit.html @@ -264,6 +264,7 @@ //Info:["互动易","大宗交易",'龙虎榜',"调研","业绩预告","公告"], //信息地雷 //Info:["公告"], + //InfoPosition:0, IsShowTooltip:true, //是否显示K线提示信息 DrawType:0, //K线类型 0=实心K线柱子 1=收盘价线 2=美国线 3=空心K线柱子 4=收盘价面积图 //FirstShowDate:20161201, @@ -290,6 +291,11 @@ EnableIndexChartDrag:true, GlobalOption:{ SelectedBorder:{ Mode:1} }, + + SelectRect: + { + Mark:{ IsShow:true, Position:{ Top:"TopEx" } } + }, KLineTitle: //标题设置 { @@ -408,6 +414,7 @@ resource.DownBarColor='rgb(84,255,255)'; resource.Frame.XBottomOffset=4; resource.IndexTitleMerginLeft=3*GetDevicePixelRatio(); + resource.DOTLINE.LineDash=[10,10]; //resource.IndexTitle.ArrowType=1; resource.IndexTitle.EnableIndexArrow=false; @@ -564,7 +571,7 @@ var hqchart=data.HQChart; var kData=hqchart.ChartPaint[0].Data; - var closeLine={ name:'价', type:0, data:kData.GetClose() }; + var closeLine={ name:'价', type:0, data:kData.GetClose(), color:"rgb(255, 52, 179)" }; var apiData= { @@ -743,6 +750,29 @@ data.Frame.CustomHorizontalInfo.push(info); } + else if (data.ID==1) + { + /* + var info=new CoordinateInfo(); + info.Type=10; + info.Value="TopEx"; + info.LineColor="rgb(255,0,0)"; + info.LineType=-1; + info.ExtendLine=[null,{Width:20}] + info.Message=[null, "顶部刻度 888"] + + data.Frame.CustomHorizontalInfo.push(info); + + var info=new CoordinateInfo(); + info.Type=10; + info.Value="BottomEx"; + info.LineColor="rgb(0,255,0)"; + info.TextColor="rgb(0,0,0)"; + info.Message=[null, "底部刻度 666"] + + data.Frame.CustomHorizontalInfo.push(info); + */ + } } this.OnSize=function(option) //自适应大小调整 @@ -1264,12 +1294,22 @@ else { var menuItem=this.Chart.JSChartContainer.GetShowIndexMenuData(data.Info.FrameID); + var frame=this.Chart.JSChartContainer.Frame.SubFrame[data.Info.FrameID].Frame; + var menuData= { Menu: [ menuItem, - { Name:"设置2", ID:"INDEX_DRAPDOWN_MENU_2", Data:{ WindowIndex:data.Info.FrameID } }, + { + Name:"Y轴分割方式", + SubMenu: + [ + { Name:"自动", Data:{ ID:"CHANGE_Y_SPLIT_TYPE", Args:[data.Info.FrameID, 0] }, Checked:frame.YSplitOperator.SplitType===0 }, + { Name:"数值最大最小", Data:{ ID:"CHANGE_Y_SPLIT_TYPE", Args:[data.Info.FrameID, 1] },Checked:frame.YSplitOperator.SplitType===1 }, + ] + }, + { Name:"设置2", Data:{ ID:"INDEX_DRAPDOWN_MENU_2", WindowIndex:data.Info.FrameID } }, ], Position:JSPopMenu.POSITION_ID.TAB_MENU_ID, @@ -1278,7 +1318,6 @@ }; } - this.Chart.PopupMenuByDrapdown(menuData, rtButton); if(e.preventDefault) e.preventDefault(); @@ -1293,11 +1332,19 @@ { this.Chart.JSChartContainer.ExecuteMenuCommand(menuData.Data.ID, menuData.Data.Args); } + else if (menuData.Data.ID=="CHANGE_Y_SPLIT_TYPE") + { + var frameID=menuData.Data.Args[0]; + var frame=this.Chart.JSChartContainer.Frame.SubFrame[frameID].Frame; + frame.YSplitOperator.SplitType=menuData.Data.Args[1]; + this.Chart.JSChartContainer.ResetFrameXYSplit(); + this.Chart.JSChartContainer.Draw(); + } else { console.log("[KLineChart::OnClickIndexDrapdownMenu] menuData=", menuData); - var text=`指标下拉菜单\r\n窗口:${menuData.Data.WindowIndex}\r\n菜单ID:${menuData.ID}`; + var text=`指标下拉菜单\r\n窗口:${menuData.Data.WindowIndex}\r\n菜单ID:${menuData.Data.ID}`; alert(text); } diff --git a/webhqchart.demo/samples/minute_index_edit.html b/webhqchart.demo/samples/minute_index_edit.html index ab3cb8818..05c0d84a8 100644 --- a/webhqchart.demo/samples/minute_index_edit.html +++ b/webhqchart.demo/samples/minute_index_edit.html @@ -110,6 +110,7 @@ + @@ -140,7 +141,7 @@ Windows: //窗口指标 [ - { Index:"MACD" } + { Index:"RSI" } ], OverlayIndex: @@ -176,9 +177,17 @@ SelectRect: { - ShowRangeText:{ Enable:true, Position:1 } + ShowRangeText:{ Enable:true, Position:1 }, + //Mark:{ IsShow:true } }, + /* + DragSelectRect: + { + Enable:true + }, + */ + MinuteLine: { IsDrawAreaPrice:true, //是否画价格面积图 @@ -210,11 +219,12 @@ EnableIndexChartDrag:true, EnableSelectRect:true, + EnableNightDayBG:true, Border: //边框 { - Left:50, //左边间距 - Right:20, //右边间距 + Left:80, //左边间距 + Right:1, //右边间距 Top:25, Bottom:25, @@ -224,7 +234,10 @@ Frame: //子框架设置 [ - { SplitCount:5, IsShowLeftText:true ,RightTextFormat:0,YTextBaseline:1, IsShowYLine:true, + { + SplitCount:5, IsShowLeftText:true ,RightTextFormat:0,YTextBaseline:1, IsShowYLine:true, + //HorizontalReserved:{ Top:4, Bottom:20}, + //BottomSpace:40, Custom: [ @@ -233,7 +246,7 @@ } ] }, - { SplitCount:5 }, + { SplitCount:5,}, { SplitCount:5 }, { SplitCount:11, IsShowXLine:false }, ], @@ -283,6 +296,14 @@ event:JSCHART_EVENT_ID.ON_MENU_COMMAND, callback:(event, data, obj)=>{ this.OnMenuCommand(event, data, obj); } }, + { + event:JSCHART_EVENT_ID.ON_CUSTOM_MINUTE_NIGHT_DAY_X_INDEX, + callback:(event, data, obj)=>{ this.OnCustomNightDayXIndex(event, data, obj); } + }, + { + event:JSCHART_EVENT_ID.ON_CUSTOM_MINUTE_BG, + callback:(event, data, obj)=>{ this.OnCustomMinuteBG(event, data, obj); } + } ]; this.Chart.SetOption(this.Option); //设置K线配置 @@ -404,6 +425,29 @@ console.log("[KLineChart::OnMenuCommand] data=", data); } + this.OnCustomNightDayXIndex=function(event, data, obj) + { + //data.XIndex=120; + } + + this.OnCustomMinuteBG=function(event, data, obj) + { + return; + + if (data.DayCount==1) + { + data.AryDay[0].BGColor="rgb(100,100,0)"; //设置背景 + } + else if (data.DayCount>1) + { + for(var i=0;i=2) item.BGColor="rgb(219,112,147)"; //设置背景 + } + } + } + this.OnSize=function(option) //自适应大小调整 { var height= $(window).height()-300; @@ -692,6 +736,10 @@ $(function () { + var a=4664.7300000000004, b=4664.73; + var test=NumberCompare.LT(a,b); + var test2=NumberCompare.GT(a,b); + const font = new FontFace("iconfont",`url('../jscommon/umychart.resource/font/iconfont.woff?t=1690947130935') format('woff')`); document.fonts.add(font); //把字体添加到 document.font(FontFaceSet)中 font.load(); // 加载字体 diff --git a/webhqchart/umychart.js b/webhqchart/umychart.js index cbf9560c6..9667d388f 100644 --- a/webhqchart/umychart.js +++ b/webhqchart/umychart.js @@ -44016,6 +44016,17 @@ function RectSelectPaint() this.AreaColor=g_JSChartResource.RectSelect.AreaColor; //面积 this.SubAreaColor=g_JSChartResource.RectSelect.SubAreaColor; + //标记图标 + this.MarkConfig= + { + Family:g_JSChartResource.RectSelect.Mark.Family, + Text:g_JSChartResource.RectSelect.Mark.Text, + Color:g_JSChartResource.RectSelect.Mark.Color, + Size:g_JSChartResource.RectSelect.Mark.Size, + IsShow:false, + Position: { Index:g_JSChartResource.RectSelect.Mark.Position.Index, Top:g_JSChartResource.RectSelect.Mark.Position.Top } + } + this.FirstPoint; this.SecondPoint; this.CenterPoint; @@ -44063,6 +44074,17 @@ function RectSelectPaint() if (IFrameSplitOperator.IsNumber(item.Position)) this.ShowRangeText.Position=item.Position; if (IFrameSplitOperator.IsNumber(item.SubPosition)) this.ShowRangeText.SubPosition=item.SubPosition; } + + if (option.Mark) + { + var item=option.Mark; + if (IFrameSplitOperator.IsBool(item.IsShow)) this.MarkConfig.IsShow=item.IsShow; + if (item.Position) + { + if (IFrameSplitOperator.IsNumber(item.Position.Index)) this.MarkConfig.Position.Index=item.Position.Index; + if (item.Position.Top) this.MarkConfig.Position.Top=item.Position.Top; + } + } } } @@ -44535,6 +44557,7 @@ function RectSelectPaint() this.DrawLines(aryLines); this.DrawArea(startPoint, endPoint, startDate, startEnd, this.AreaColor); + this.DrawMark(startPoint, endPoint); if (this.SubClient && this.SubClient.Start && this.SubClient.End) { @@ -44768,6 +44791,45 @@ function RectSelectPaint() if (IFrameSplitOperator.IsNumber(type)) this.DragRect.push( {Rect:rtArea, Type:type} ); } } + + this.DrawMark=function(startPoint,endPoint) + { + if (!startPoint ||!endPoint) return; + + if (!this.ChartFrame || !this.ChartFrame.SubFrame) return; + var subFrame=this.ChartFrame.SubFrame[0].Frame; + if (!subFrame) return; + + if (!this.MarkConfig) return; + var config=this.MarkConfig; + if (!config.IsShow) return; + + var font=`${config.Size}px ${config.Family}`; + this.Canvas.font=font; + var top=null; + switch(config.Position.Top) + { + case "TopEx": + top=subFrame.ChartBorder.GetTopEx(); + break; + case "Top": + top=subFrame.ChartBorder.GetTop(); + break; + case "TopTitle": + top=subFrame.ChartBorder.GetTopTitle(); + break; + default: + return; + } + + var xText=startPoint.X; + var yText=top; + + this.Canvas.textAlign="center"; + this.Canvas.textBaseline="bottom"; + this.Canvas.fillStyle=config.Color; + this.Canvas.fillText(config.Text,xText,yText); + } } //鼠标拖动选中区域 @@ -68896,6 +68958,8 @@ function JSChartResource() RangeTextSubColor:"rgb(255,255,255)", RangeTextSubFont:12*GetDevicePixelRatio() +"px 微软雅黑", RangeTextSubBGColor:'rgb(54,54,54)', + + Mark:{ Family:'iconfont', Text:'\ue695' , Color:'rgb(250,0,0)', Size:15*GetDevicePixelRatio(), Position:{ Index:0, Top:"TopEx" } } } //选中图形 @@ -69752,6 +69816,20 @@ function JSChartResource() if (item.RangeTextSubColor) this.RectSelect.RangeTextSubColor=item.RangeTextSubColor; if (item.RangeTextSubFont) this.RectSelect.RangeTextSubFont=item.RangeTextSubFont; if (item.RangeTextSubBGColor) this.RectSelect.RangeTextSubBGColor=item.RangeTextSubBGColor; + + if (item.Mark) + { + var subItem=item.Mark; + if (subItem.Family) this.RectSelect.Mark.Family=subItem.Family; + if (subItem.Text) this.RectSelect.Mark.Text=subItem.Text; + if (subItem.Color) this.RectSelect.Mark.Color=subItem.Color; + if (IFrameSplitOperator.IsNumber(subItem.Size)) this.RectSelect.Mark.Size=subItem.Size; + if (subItem.Position) + { + if (subItem.Position.Top) this.RectSelect.Mark.Position.Top=subItem.Position.Top; + if (IFrameSplitOperator.IsNumber(subItem.Position.Index)) this.RectSelect.Mark.Position.Index=subItem.Position.Index; + } + } } if (style.RectDrag) @@ -72327,6 +72405,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement) if (!this.PopMinuteChart) return; if (!data.Tooltip || !data.Chart) return; + var pixelRatio=GetDevicePixelRatio(); var rtClient=this.UIElement.getBoundingClientRect(); var rtScroll=GetScrollPosition(); @@ -72336,7 +72415,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement) var date=data.Tooltip.Data.Date; var symbol=data.Chart.Symbol; - this.PopMinuteChart.Show({ Date:date, Symbol:symbol, Data:data.Tooltip.Data }, x,y); + this.PopMinuteChart.Show({ Date:date, Symbol:symbol, Data:data.Tooltip.Data }, x/pixelRatio,y/pixelRatio); } diff --git a/webhqchart/umychart.version.js b/webhqchart/umychart.version.js index caa695f68..f71a3e102 100644 --- a/webhqchart/umychart.version.js +++ b/webhqchart/umychart.version.js @@ -5,7 +5,7 @@ -var HQCHART_VERSION="1.1.13803"; +var HQCHART_VERSION="1.1.13809"; function PrintHQChartVersion() {