hqchart 1.1.13232 → 1.1.13245

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.
@@ -1645,6 +1645,9 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
1645
1645
  //内置菜单
1646
1646
  if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
1647
1647
 
1648
+ //画图工具
1649
+ if (option.EnableDrawToolDialogV2===true) chart.InitalDrawToolDialog();
1650
+
1648
1651
  //注册事件
1649
1652
  if (option.EventCallback)
1650
1653
  {
@@ -2895,6 +2898,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
2895
2898
  this.JSPopMenu; //内置菜单
2896
2899
  this.IsShowRightMenu=true; //显示右键菜单
2897
2900
 
2901
+ this.DialogDrawTool; //画图工具
2902
+
2898
2903
 
2899
2904
  this.ClearStockCache=function()
2900
2905
  {
@@ -2909,6 +2914,37 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
2909
2914
  this.JSPopMenu.Inital();
2910
2915
  }
2911
2916
 
2917
+ this.InitalDrawToolDialog=function()
2918
+ {
2919
+ if (this.DialogDrawTool) return;
2920
+
2921
+ this.DialogDrawTool=new JSDialogDrawTool();
2922
+ this.DialogDrawTool.Inital(this);
2923
+ this.DialogDrawTool.Create();
2924
+ }
2925
+
2926
+ this.ShowDrawToolDialog=function(x,y)
2927
+ {
2928
+ if (!this.DialogDrawTool) return;
2929
+
2930
+ var rtClient=this.UIElement.getBoundingClientRect();
2931
+ var rtScroll=GetScrollPosition();
2932
+
2933
+ var top=this.UIElement.offsetTop+15;
2934
+ var left=this.UIElement.offsetWidth-this.DialogDrawTool.DivDialog.offsetWidth-15;
2935
+ left+=rtClient.left+rtScroll.Left;
2936
+ top+=rtClient.top+rtScroll.Top;
2937
+
2938
+ this.DialogDrawTool.Show(left,top);
2939
+ }
2940
+
2941
+ this.IsShowDrawToolDialog=function()
2942
+ {
2943
+ if (!this.DialogDrawTool) return false;
2944
+
2945
+ return this.DialogDrawTool.IsShow();
2946
+ }
2947
+
2912
2948
  //obj={ Element:, Canvas: }
2913
2949
  this.SetCorssCursorElement=function(obj)
2914
2950
  {
@@ -7935,6 +7971,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7935
7971
  if (drawPicture.PointCount!=drawPicture.Point.length) return false;
7936
7972
  if (drawPicture.ClassName=="ChartDrawRuler") //尺子不用保存的
7937
7973
  {
7974
+ if (drawPicture.FinishedCallback) drawPicture.FinishedCallback(drawPicture);
7938
7975
  this.CurrentChartDrawPicture=null;
7939
7976
  return true;
7940
7977
  }
@@ -8120,7 +8157,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8120
8157
  {
8121
8158
  var item=this.ExtendChartPaint[i];
8122
8159
  if (!item) continue;
8123
- if (item.ClassName=="StockChip" || item.ClassName=="DrawToolsButton")
8160
+ if (item.ClassName=="StockChip")
8124
8161
  {
8125
8162
  if (IFrameSplitOperator.IsNumber(item.Width))
8126
8163
  width+=item.Width;
@@ -9210,30 +9247,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9210
9247
  }
9211
9248
  break;
9212
9249
  case JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID:
9213
- var option={Name:'画图工具', Top:this.Frame.ChartBorder.Top };
9214
- var extendChart=this.CreateExtendChart(option.Name, option); //创建扩展图形
9215
- this.SetSizeChange(true);
9216
- this.Draw();
9217
- break;
9218
- case JSCHART_MENU_ID.CMD_HIDE_DRAWTOOL_ID:
9219
- var drawTools=this.GetExtendChartByClassName('DrawToolsButton');
9220
- if (drawTools)
9221
- {
9222
- var toolsWidth=drawTools.Chart.Width;
9223
- var toolsIndex=parseInt(drawTools.Index);
9224
- for(var i=toolsIndex+1; i<this.ExtendChartPaint.length; ++i) //在画图工具后面创建的需要减去工具的宽度
9225
- {
9226
- var item=this.ExtendChartPaint[i];
9227
- if (item.ClassName=='StockChip')
9228
- {
9229
- item.Left-=toolsWidth;
9230
- }
9231
- }
9232
- this.DeleteExtendChart(drawTools);
9233
- this.Frame.ChartBorder.Right-=toolsWidth;
9234
- this.SetSizeChange(true);
9235
- this.Draw();
9236
- }
9250
+ if (!this.IsShowDrawToolDialog())
9251
+ this.ShowDrawToolDialog();
9237
9252
  break;
9238
9253
  case JSCHART_MENU_ID.CMD_SHOW_STOCKCHIP_ID:
9239
9254
  var option={Name:'筹码分布', ShowType:1, Width:230 };
@@ -41965,235 +41980,6 @@ function StockChip()
41965
41980
  }
41966
41981
  }
41967
41982
 
41968
- //画图工具条
41969
- function DrawToolsButton()
41970
- {
41971
- this.newMethod=IExtendChartPainting; //派生
41972
- this.newMethod();
41973
- delete this.newMethod;
41974
-
41975
- this.ClassName='DrawToolsButton';
41976
- this.HQChart;
41977
- this.ID=Guid();
41978
- this.ToolsDiv;
41979
- // this.Color='rgb(105,105,105)'; //颜色
41980
- this.Color = "#696969"; //input type="color"不支持rgb的颜色格式
41981
-
41982
- //this.Left=5;
41983
- this.Top=5*GetDevicePixelRatio();
41984
- this.Width=45*GetDevicePixelRatio(); //宽度
41985
-
41986
- this.SetOption=function(option)
41987
- {
41988
- var pixelRatio=GetDevicePixelRatio();
41989
- if (!option) return;
41990
- if (option.Width>10) this.Width=option.Width*pixelRatio;
41991
- }
41992
-
41993
- this.Clear=function()
41994
- {
41995
- if (this.ToolsDiv) this.ChartBorder.UIElement.parentNode.removeChild(this.ToolsDiv);
41996
- }
41997
-
41998
- this.Draw = function () {
41999
- if (this.SizeChange == false) return;
42000
-
42001
- //工具列表
42002
- const TOOL_LIST =
42003
- [
42004
- [
42005
- { HTML: { Title: '线段', IClass: 'iconfont icon-draw_line', ID: 'icon-segment' }, Name: '线段' },
42006
- { HTML: { Title: '尺子', IClass: 'iconfont icon-ruler', ID: 'icon_ruler' }, Name: '尺子' },
42007
- { HTML: { Title: '射线', IClass: 'iconfont icon-draw_rays', ID: 'icon-beam' }, Name: '射线' },
42008
- { HTML: { Title: '标价线', IClass: 'iconfont icon-price_line', ID: 'icon-price-line' }, Name: '标价线' },
42009
- { HTML: { Title: '垂直线', IClass: 'iconfont icon-vertical_line', ID: 'icon-vertical-line' }, Name: '垂直线' },
42010
- { HTML: { Title: '箭头', IClass: 'iconfont icon-draw_rays', ID: 'icon-beam2' }, Name: '箭头' },
42011
- { HTML: { Title: '趋势线', IClass: 'iconfont icon-draw_trendline', ID: 'icon-trendline' }, Name: '趋势线' },
42012
- { HTML: { Title: '水平线', IClass: 'iconfont icon-draw_hline', ID: 'icon-hline' }, Name: '水平线' },
42013
- { HTML: { Title: '水平线段', IClass: 'iconfont icon-draw_hlinesegment', ID: 'icon-hlineseg' }, Name: '水平线段' },
42014
- { HTML: { Title: '平行射线', IClass: 'iconfont icon-draw_p_rays_lines', ID: 'icon-rayslineseg' }, Name: '平行射线' },
42015
- { HTML: { Title: '平行线', IClass: 'iconfont icon-draw_parallel_lines', ID: 'icon-parallellines' }, Name: '平行线' },
42016
- { HTML: { Title: '平行通道', IClass: 'iconfont icon-draw_parallelchannel', ID: 'icon-parallelchannel' }, Name: '平行通道' },
42017
- { HTML: { Title: '价格通道线', IClass: 'iconfont icon-draw_pricechannel', ID: 'icon-pricechannel' }, Name: '价格通道线' },
42018
- { HTML: { Title: 'M头W底', IClass: 'iconfont icon-draw_wavemw', ID: 'icon-wavemw' }, Name: 'M头W底' },
42019
- { HTML: { Title: '头肩型', IClass: 'iconfont icon-draw_head_shoulders_bt', ID: 'icon-Head-Shoulders' }, Name: '头肩型' },
42020
- { HTML: { Title: '波浪尺', IClass: 'iconfont icon-waveruler', ID: 'icon-wave-ruler' }, Name: '波浪尺' },
42021
- { HTML: { Title: 'AB波浪尺', IClass: 'iconfont icon-waveruler', ID: 'icon-wave-ruler2' }, Name: 'AB波浪尺' },
42022
- { HTML: { Title: '箱型线', IClass: 'iconfont icon-draw_box', ID: 'icon-drawbox' }, Name: '箱型线' },
42023
- { HTML: { Title: '涂鸦线段', IClass: 'iconfont icon-draw_line', ID: 'icon-segment2' }, Name: '涂鸦线段' },
42024
-
42025
- ],
42026
- [
42027
- { HTML: { Title: '圆弧', IClass: 'iconfont icon-draw_arc', ID: 'icon-arc' }, Name: '圆弧线' },
42028
- { HTML: { Title: '矩形', IClass: 'iconfont icon-rectangle', ID: 'icon-rect' }, Name: '矩形' },
42029
- { HTML: { Title: '平行四边形', IClass: 'iconfont icon-draw_quadrangle', ID: 'icon-quad' }, Name: '平行四边形' },
42030
- { HTML: { Title: '三角形', IClass: 'iconfont icon-draw_triangle', ID: 'icon-triangle' }, Name: '三角形' },
42031
- { HTML: { Title: '圆', IClass: 'iconfont icon-draw_circle', ID: 'icon-circle' }, Name: '圆' },
42032
- { HTML: { Title: '对称角度', IClass: 'iconfont icon-draw_symangle', ID: 'icon-symangle' }, Name: '对称角度' },
42033
- ],
42034
- [
42035
- { HTML: { Title: '文本', IClass: 'iconfont icon-draw_text', ID: 'icon-text' }, Name: '文本' },
42036
- { HTML: { Title: '向上箭头', IClass: 'iconfont icon-arrow_up', ID: 'icon-arrowup' }, Name: 'icon-arrow_up' },
42037
- { HTML: { Title: '向下箭头', IClass: 'iconfont icon-arrow_down', ID: 'icon-arrowdown' }, Name: 'icon-arrow_down' },
42038
- { HTML: { Title: '向左箭头', IClass: 'iconfont icon-arrow_left', ID: 'icon-arrowleft' }, Name: 'icon-arrow_left' },
42039
- { HTML: { Title: '向右箭头', IClass: 'iconfont icon-arrow_right', ID: 'icon-arrowright' }, Name: 'icon-arrow_right' },
42040
- ],
42041
- [
42042
- { HTML: { Title: '江恩角度线', IClass: 'iconfont icon-draw_gannfan', ID: 'icon-gannfan' }, Name: '江恩角度线' },
42043
- { HTML: { Title: '斐波那契周期线', IClass: 'iconfont icon-draw_fibonacci', ID: 'icon-fibonacci' }, Name: '斐波那契周期线' },
42044
- { HTML: { Title: '阻速线', IClass: 'iconfont icon-draw_resline', ID: 'icon-resline' }, Name: '阻速线' },
42045
- { HTML: { Title: '黄金分割', IClass: 'iconfont icon-draw_goldensection', ID: 'icon-goldensection' }, Name: '黄金分割' },
42046
- { HTML: { Title: '百分比线', IClass: 'iconfont icon-draw_percentage', ID: 'icon-percentage' }, Name: '百分比线' },
42047
- { HTML: { Title: '波段线', IClass: 'iconfont icon-draw_waveband', ID: 'icon-waveband' }, Name: '波段线' },
42048
- { HTML: { Title: '线形回归线', IClass: 'iconfont icon-linear_3', ID: 'icon-waveband2' }, Name: '线形回归线' },
42049
- { HTML: { Title: '线形回归带', IClass: 'iconfont icon-linear_1', ID: 'icon-waveband3' }, Name: '线形回归带' },
42050
- { HTML: { Title: '延长线形回归带', IClass: 'iconfont icon-linear_2', ID: 'icon-waveband5' }, Name: '延长线形回归带' },
42051
- ],
42052
- [{ HTML: { Title: '全部删除', IClass: 'iconfont icon-recycle_bin', ID: 'icon-delete' }, Name: '全部删除' }]
42053
- ];
42054
-
42055
- var hqChart = this.HQChart;
42056
-
42057
- if (!this.ToolsDiv) {
42058
- var div = document.createElement("div");
42059
- div.className = 'drawtools';
42060
- div.id = this.ID;
42061
-
42062
- var spanList = ""; //一层菜单
42063
- var menuTwoList = ""; //二层菜单
42064
- var menuOne = new Array();
42065
- TOOL_LIST.forEach(function(item,index){
42066
- menuOne.push(item[0]);
42067
- });
42068
- for (var i = 0; i < TOOL_LIST.length; i++) {
42069
- var itemOut = menuOne[i];
42070
- var itemIn = TOOL_LIST[i];
42071
- var menuTwoStr = "";
42072
- var contentArrow = "";
42073
- for (var j = 0; j < itemIn.length; j++) {
42074
- var currentItem = itemIn[j];
42075
- var menuTwoName = currentItem.Name;
42076
- if(menuTwoName.indexOf('up') > -1){
42077
- menuTwoName = "向上箭头";
42078
- }else if(menuTwoName.indexOf('down') > -1){
42079
- menuTwoName = "向下箭头";
42080
- }else if(menuTwoName.indexOf('left') > -1){
42081
- menuTwoName = "向左箭头";
42082
- }else if(menuTwoName.indexOf('right') > -1){
42083
- menuTwoName = "向右箭头";
42084
- }
42085
- menuTwoStr += '<p class="menuTwoItem ' + currentItem.HTML.ID + '">' + menuTwoName + '<i class="' + currentItem.HTML.IClass + '" title="' + currentItem.HTML.Title + '"></i></p>';
42086
- }
42087
- if (i !== TOOL_LIST.length - 1) { //不是“全部删除”项
42088
- menuTwoList = '<div class="menuTwo">' + menuTwoStr + '</div>';
42089
- contentArrow = '<i class="contentArrow iconfont icon-menu_arraw_left"></i>';
42090
- } else {
42091
- menuTwoList = "";
42092
- contentArrow = "";
42093
- }
42094
-
42095
- var spanNode = '<div class="icon-image ' + 'first-' + itemOut.HTML.ID + '"><i class="' + itemOut.HTML.IClass + '" title="' + itemOut.HTML.Title + '"></i>' + menuTwoList + contentArrow +'</div>';
42096
- spanList += spanNode;
42097
- }
42098
- this.ChartBorder.UIElement.parentNode.appendChild(div);
42099
-
42100
- div.innerHTML = spanList;
42101
- this.ToolsDiv = div;
42102
-
42103
- for (var i in TOOL_LIST) {
42104
- var item = TOOL_LIST[i][0];
42105
- $('#' + this.ID + " .first-" + item.HTML.ID).hover(function(){ //箭头的旋转过渡
42106
- $(".drawtools").find(".contentArrow").hide();
42107
- $(this).find(".contentArrow").removeClass("trans").show();
42108
- });
42109
- $('#' + this.ID + " .first-" + item.HTML.ID+" .contentArrow").click(function(event){ //点击三角展示二级菜单
42110
- event.stopPropagation();
42111
- $(".drawtools").find(".menuTwo").hide();
42112
- $(this).siblings('.menuTwo').show();
42113
- });
42114
- $('#' + this.ID + " .first-" + item.HTML.ID+" .trans").click(function(){ //点击三角隐藏二级菜单
42115
- event.stopPropagation();
42116
- $(this).siblings('.menuTwo').hide();
42117
- });
42118
-
42119
-
42120
- if (item.Name == '全部删除') {
42121
- $('#' + this.ID + " .first-icon-delete").click(function () {
42122
- $(".drawtools").find(".menuTwo").hide();
42123
- $(this).siblings().removeClass('active');
42124
- $(this).addClass('active');
42125
- hqChart.ClearChartDrawPicture();
42126
- $(".subTolls").css("display", "none");
42127
- });
42128
- }
42129
- else {
42130
- $('#' + this.ID + " .first-" + menuOne[i].HTML.ID).click( //一层菜单类名是:“first-”+item.HTML.ID
42131
- {
42132
- // DrawName: menuOne[i].Name, //把画法名字传进去
42133
- CurrentIndex:i
42134
- },
42135
- function (event) {
42136
- $(".drawtools").find(".menuTwo").hide();
42137
- $(this).siblings().removeClass('active');
42138
- $(this).addClass('active');
42139
- hqChart.CreateChartDrawPicture(menuOne[event.data.CurrentIndex].Name);
42140
- }
42141
- );
42142
- for (var j in TOOL_LIST[i]) {
42143
- var itemTwo = TOOL_LIST[i][j];
42144
- let classname = itemTwo.HTML.IClass; //闭包问题
42145
- $('#' + this.ID + ' .' + itemTwo.HTML.ID).hover(function(event){
42146
- event.stopPropagation();
42147
- $(this).closest('.icon-image').find(".contentArrow").addClass("trans");
42148
- });
42149
- $('#' + this.ID + ' .' + itemTwo.HTML.ID).click(//二层菜单
42150
- {
42151
- DrawName: itemTwo.Name, //把画法名字传进去
42152
- CurrentIndex:i,
42153
- CurrentData:itemTwo
42154
- },
42155
- function (event) {
42156
- event.stopPropagation();
42157
- $(this).closest('.icon-image').find(".contentArrow").hide();
42158
- $(this).siblings().removeClass("current");
42159
- $(this).addClass("current");
42160
- $(this).closest('.icon-image').children('i').eq(0).removeClass().addClass(classname,"active").attr('title',event.data.CurrentData.HTML.Title);
42161
- menuOne.splice(event.data.CurrentIndex,1,event.data.CurrentData);
42162
- $(this).parent().hide();
42163
- hqChart.CreateChartDrawPicture(event.data.DrawName);
42164
- }
42165
- );
42166
- }
42167
- }
42168
- }
42169
-
42170
- }
42171
- var curID = this.ID;
42172
- $(document).click(function(event){
42173
- if(!($("#"+curID).is(event.target)) && ($("#"+curID).has(event.target).length === 0)){
42174
- $("#"+curID+" .menuTwo").hide();
42175
- $("#"+curID+" .contentArrow").hide();
42176
- }
42177
- });
42178
- var scrollPos = GetScrollPosition();
42179
- var pixelRatio=GetDevicePixelRatio();
42180
- // var left=this.ChartBorder.GetChartWidth()-this.Right-this.ToolsWidth;
42181
- var left=ToFixedPoint(this.ChartBorder.GetRight()+this.Left);
42182
- // var top = this.Top+this.ChartBorder.UIElement.getBoundingClientRect().top+scrollPos.Top;
42183
- var top = this.ChartBorder.GetTop();
42184
- this.ToolsDiv.style.left = left/pixelRatio + "px";
42185
- this.ToolsDiv.style.top = top/pixelRatio + "px";
42186
- this.ToolsDiv.style.width = (this.Width-5)/pixelRatio + "px";
42187
- this.ToolsDiv.style.height = 'auto';
42188
- this.ToolsDiv.style.position = "absolute";
42189
- this.ToolsDiv.style.display = "block";
42190
- // this.ToolsDiv.style.paddingLeft = "10px";
42191
-
42192
- this.SizeChange == true;
42193
- }
42194
- }
42195
-
42196
-
42197
41983
  //窗口分割
42198
41984
  function FrameSplitPaint()
42199
41985
  {
@@ -49120,15 +48906,17 @@ function ChartCorssCursor()
49120
48906
  this.DrawRightButton=function(drawTop, drawRight, drawWidth, drawHeight, data)
49121
48907
  {
49122
48908
  this.Canvas.fillStyle=this.RightButton.BGColor;
49123
- var rtButtom={Left:drawRight-drawWidth, Top:drawTop, Width:drawWidth, Height:drawHeight };
49124
- this.RightButton.Rect=rtButtom;
48909
+ var rtButton={Left:drawRight-drawWidth, Top:drawTop, Width:drawWidth, Height:drawHeight };
48910
+ rtButton.Right=rtButton.Left+rtButton.Width;
48911
+ rtButton.Bottom=rtButton.Top+rtButton.Height;
48912
+ this.RightButton.Rect=rtButton;
49125
48913
  this.RightButton.Data=data;
49126
- this.Canvas.fillRect(ToFixedPoint(rtButtom.Left+1),ToFixedPoint(rtButtom.Top),ToFixedRect(rtButtom.Width),ToFixedRect(rtButtom.Height));
48914
+ this.Canvas.fillRect(ToFixedPoint(rtButton.Left+1),ToFixedPoint(rtButton.Top),ToFixedRect(rtButton.Width),ToFixedRect(rtButton.Height));
49127
48915
 
49128
48916
  var pixelRatio=GetDevicePixelRatio();
49129
48917
  var spaceWidth=3;
49130
- var yCenter=(rtButtom.Top+spaceWidth)+(rtButtom.Height-spaceWidth*2)/2;
49131
- var xCenter=(rtButtom.Left+spaceWidth)+(rtButtom.Width-spaceWidth*2)/2;
48918
+ var yCenter=(rtButton.Top+spaceWidth)+(rtButton.Height-spaceWidth*2)/2;
48919
+ var xCenter=(rtButton.Left+spaceWidth)+(rtButton.Width-spaceWidth*2)/2;
49132
48920
 
49133
48921
  if (this.RightButton.Icon)
49134
48922
  {
@@ -49149,10 +48937,10 @@ function ChartCorssCursor()
49149
48937
  this.Canvas.linewidth=1*pixelRatio;
49150
48938
  this.Canvas.beginPath();
49151
48939
  this.Canvas.moveTo(ToFixedPoint(x), ToFixedPoint(yCenter));
49152
- this.Canvas.lineTo(ToFixedPoint(x+rtButtom.Width-spaceWidth*2), ToFixedPoint(yCenter));
48940
+ this.Canvas.lineTo(ToFixedPoint(x+rtButton.Width-spaceWidth*2), ToFixedPoint(yCenter));
49153
48941
 
49154
48942
  this.Canvas.moveTo(ToFixedPoint(xCenter),ToFixedPoint(y));
49155
- this.Canvas.lineTo(ToFixedPoint(xCenter), ToFixedPoint(y+rtButtom.Height-spaceWidth*2));
48943
+ this.Canvas.lineTo(ToFixedPoint(xCenter), ToFixedPoint(y+rtButton.Height-spaceWidth*2));
49156
48944
 
49157
48945
  this.Canvas.stroke();
49158
48946
  this.Canvas.restore();
@@ -55416,7 +55204,7 @@ IChartDrawPicture.ArrayDrawPricture=
55416
55204
  { Name:"固定范围成交量分布图", ClassName:"ChartDrawVolProfile", Create:function() { return new ChartDrawVolProfile(); }},
55417
55205
 
55418
55206
  { Name:"DisjointChannel", ClassName:"ChartDrawDisjontChannel", Create:function() { return new ChartDrawDisjontChannel();}},
55419
- { Name:"FlatTop", ClassName:"ChartDrawDisjontChannel", Create:function() { return new ChartDrawFlatTop();}},
55207
+ { Name:"FlatTop", ClassName:"ChartDrawFlatTop", Create:function() { return new ChartDrawFlatTop();}},
55420
55208
 
55421
55209
  { Name:"水平线2", ClassName:"ChartDrawHLine", Create:function() { return new ChartDrawHLine(); }},
55422
55210
 
@@ -57587,7 +57375,7 @@ function ChartDrawPictureParallelLines()
57587
57375
  }
57588
57376
 
57589
57377
 
57590
- //FlatTop/Bottom
57378
+ //FlatTop/Bottom 平滑顶/底
57591
57379
  function ChartDrawFlatTop()
57592
57380
  {
57593
57381
  this.newMethod=IChartDrawPicture; //派生
@@ -57674,7 +57462,7 @@ function ChartDrawFlatTop()
57674
57462
  }
57675
57463
  }
57676
57464
 
57677
- //Disjont Channel
57465
+ //Disjont Channel 不相交通道 (未完成)
57678
57466
  function ChartDrawDisjontChannel()
57679
57467
  {
57680
57468
  this.newMethod=ChartDrawFlatTop; //派生
@@ -67426,7 +67214,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
67426
67214
  this.TickApiUrl=g_JSChartResource.Domain+'/API/StockDetail'; //当天分笔数据
67427
67215
 
67428
67216
  this.MinuteDialog; //双击历史K线 弹出分钟走势图
67429
- this.RightMenu; //右键菜单
67430
67217
 
67431
67218
  this.BeforeBindMainData=null; //function(funcName) 在BindMainData() 调用前回调用
67432
67219
  this.AfterBindMainData=null; //function(funcName) 在BindMainData() 调用前后调用
@@ -71663,17 +71450,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
71663
71450
  this.ExtendChartPaint.push(chart);
71664
71451
  this.Frame.ChartBorder.Right+=chart.Width; //创建筹码需要增加右边的间距
71665
71452
  return chart;
71666
- case '画图工具':
71667
- chart=new DrawToolsButton();
71668
- chart.Canvas=this.Canvas;
71669
- chart.ChartBorder=this.Frame.ChartBorder;
71670
- chart.ChartFrame=this.Frame;
71671
- chart.HQChart=this;
71672
- chart.Left=this.Frame.ChartBorder.Right; //左边间距使用当前框架间距
71673
- chart.SetOption(option);
71674
- this.ExtendChartPaint.push(chart);
71675
- this.Frame.ChartBorder.Right+=chart.Width; //创建筹码需要增加右边的间距
71676
- return chart;
71677
71453
  case 'KLineTooltip':
71678
71454
  if (option.Create && typeof(option.Create)=='function') chart=option.Create();
71679
71455
  else chart=new KLineTooltipPaint();
@@ -72687,6 +72463,11 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72687
72463
  return true;
72688
72464
  }
72689
72465
 
72466
+ this.ClearCurrnetDrawPicture=function()
72467
+ {
72468
+ this.CurrentChartDrawPicture=null;
72469
+ }
72470
+
72690
72471
  this.AddChartDrawPicture=function(obj)
72691
72472
  {
72692
72473
  if (!obj) return null;
@@ -72848,6 +72629,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72848
72629
  {
72849
72630
  var windowCount=this.Frame.SubFrame.length; //窗口个数
72850
72631
  var klineChart=this.ChartPaint[0];
72632
+ var klineType=klineChart.DrawType;
72633
+ var bThinAKBar=klineChart.IsThinAKBar;
72851
72634
  var priceGap=klineChart.PriceGap; //缺口配置信息
72852
72635
  var coordinateType=null, yCoordinateType=null; //坐标类型
72853
72636
  var mainFrame=null;
@@ -72872,9 +72655,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72872
72655
  if (item && item.Symbol) aryOverlaySymbol.push(item.Symbol)
72873
72656
  }
72874
72657
 
72875
- var bBGSpit=false, bShowDrawTool=false, bShowStockChip=false;
72658
+ var bBGSpit=false, bShowStockChip=false;
72876
72659
  if (this.GetExtendChartByClassName("SessionBreaksPaint")) bBGSpit=true;
72877
- if (this.GetExtendChartByClassName('DrawToolsButton')) bShowDrawTool=true; //画图工具
72878
72660
  if (this.GetExtendChartByClassName('StockChip')) bShowStockChip=true; //筹码
72879
72661
 
72880
72662
  var aryMenu=
@@ -72980,17 +72762,17 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72980
72762
  Name:"主图线型",
72981
72763
  SubMenu:
72982
72764
  [
72983
- { Name:"K线(空心阳线)", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[3]} },
72984
- { Name:"K线(实心阳线)", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[0]} },
72985
- { Name:"美国线", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[2, true, { IsThinAKBar:false }]} },
72986
- { Name:"美国线(细)", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[2, true, { IsThinAKBar:true }]} },
72987
- { Name:"收盘线", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[1]} },
72988
- { Name:"收盘面积", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[4]} },
72989
- { Name:"K线(空心阳线阴线)", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[6]} },
72990
- { Name:"Heikin Ashi", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[11]} },
72991
- { Name:"Line Break", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[12]} },
72992
- { Name:"High-low", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[13]} },
72993
- { Name:"HLC Area", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[15]} },
72765
+ { Name:"K线(空心阳线)", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[3]}, Checked:klineType==0 },
72766
+ { Name:"K线(实心阳线)", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[0]}, Checked:klineType==3 },
72767
+ { Name:"美国线", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[2, true, { IsThinAKBar:false }]}, Checked:(klineType==2&&!bThinAKBar) },
72768
+ { Name:"美国线(细)", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[2, true, { IsThinAKBar:true }]}, Checked:(klineType==2&&bThinAKBar) },
72769
+ { Name:"收盘线", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[1]}, Checked:klineType==1},
72770
+ { Name:"收盘面积", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[4]}, Checked:klineType==4 },
72771
+ { Name:"K线(空心阳线阴线)", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[6]}, Checked:klineType==6 },
72772
+ { Name:"Heikin Ashi", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[11]}, Checked:klineType==11 },
72773
+ { Name:"Line Break", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[12]}, Checked:klineType==12 },
72774
+ { Name:"High-low", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[13]}, Checked:klineType==13 },
72775
+ { Name:"HLC Area", Data:{ ID: JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID, Args:[15]}, Checked:klineType==15 },
72994
72776
  ]
72995
72777
  },
72996
72778
  {
@@ -73032,7 +72814,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
73032
72814
 
73033
72815
  { Name:"背景分割", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_BG_SPLIT_ID, Args:[!bBGSpit]}, Checked:bBGSpit},
73034
72816
 
73035
- { Name:"画图工具", Data:{ ID:bShowDrawTool?JSCHART_MENU_ID.CMD_HIDE_DRAWTOOL_ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID, Args:[]}, Checked:bShowDrawTool},
72817
+ { Name:"画图工具", Data:{ ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID, Args:[]}, Checked:this.IsShowDrawToolDialog()},
73036
72818
 
73037
72819
  { Name:"移动筹码图", Data:{ ID:bShowStockChip?JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:JSCHART_MENU_ID.CMD_SHOW_STOCKCHIP_ID, Args:[]}, Checked:bShowStockChip},
73038
72820
  ]
@@ -76510,9 +76292,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
76510
76292
  if (item && item.Symbol) aryOverlaySymbol.push(item.Symbol)
76511
76293
  }
76512
76294
 
76513
- var bShowDrawTool=false;
76514
- if (this.GetExtendChartByClassName('DrawToolsButton')) bShowDrawTool=true; //画图工具
76515
-
76516
76295
  var aryMenu=
76517
76296
  [
76518
76297
  {
@@ -76570,7 +76349,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
76570
76349
  Name:"其他设置",
76571
76350
  SubMenu:
76572
76351
  [
76573
- { Name:"画图工具", Data:{ ID:bShowDrawTool?JSCHART_MENU_ID.CMD_HIDE_DRAWTOOL_ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID, Args:[]}, Checked:bShowDrawTool},
76352
+ { Name:"画图工具", Data:{ ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID, Args:[]}, Checked:this.IsShowDrawToolDialog()},
76574
76353
  ]
76575
76354
  }
76576
76355
 
@@ -79735,17 +79514,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
79735
79514
  chart.SetOption(option);
79736
79515
  this.ExtendChartPaint.push(chart);
79737
79516
  return chart;
79738
- case '画图工具':
79739
- chart=new DrawToolsButton();
79740
- chart.Canvas=this.Canvas;
79741
- chart.ChartBorder=this.Frame.ChartBorder;
79742
- chart.ChartFrame=this.Frame;
79743
- chart.HQChart=this;
79744
- chart.Left=this.Frame.ChartBorder.Right; //左边间距使用当前框架间距
79745
- chart.SetOption(option);
79746
- this.ExtendChartPaint.push(chart);
79747
- this.Frame.ChartBorder.Right+=chart.Width; //创建筹码需要增加右边的间距
79748
- return chart;
79749
79517
  case "MinuteBackgroundPaint":
79750
79518
  chart=new MinuteBackgroundPaint();
79751
79519
  chart.Canvas=this.Canvas;
@@ -258,6 +258,12 @@ function JSPopMenu()
258
258
  var yBottom=window.innerHeight-15;
259
259
  if (yMenuBottom>yBottom) yTop=rtButton.Top-menuHeight;
260
260
 
261
+ if (this.Data.Position==JSPopMenu.POSITION_ID.DROPDOWN_RIGHT_MENU_ID)
262
+ {
263
+ var menuWidth=this.RootDOM.offsetWidth;
264
+ xLeft=rtButton.Right-menuWidth;
265
+ }
266
+
261
267
  this.RootDOM.style.visibility='visible';
262
268
  this.RootDOM.style.top = yTop + "px";
263
269
  this.RootDOM.style.left = xLeft + "px";
@@ -346,4 +352,6 @@ function JSPopMenu()
346
352
  JSPopMenu.POSITION_ID={ };
347
353
  JSPopMenu.POSITION_ID.RIGHT_MENU_ID=0;
348
354
  JSPopMenu.POSITION_ID.TAB_MENU_ID=1;
355
+ JSPopMenu.POSITION_ID.DROPDOWN_MENU_ID=2; //左对齐下拉
356
+ JSPopMenu.POSITION_ID.DROPDOWN_RIGHT_MENU_ID=3; //右对齐下拉
349
357
  JSPopMenu.SEPARATOR_LINE_NAME="MENU_SEPARATOR"; //分割线
@@ -1326,6 +1326,108 @@ input[type="color"] {
1326
1326
 
1327
1327
 
1328
1328
 
1329
+ /*
1330
+ Copyright (c) 2018 jones
1331
+
1332
+ http://www.apache.org/licenses/LICENSE-2.0
1333
+
1334
+ 开源项目 https://github.com/jones2000/HQChart
1335
+
1336
+ jones_2000@163.com
1337
+
1338
+ 内置画图工具对话框
1339
+ */
1340
+
1341
+ .UMyChart_DrawTool_Dialog_Div
1342
+ {
1343
+ font-family: "微软雅黑";
1344
+ /*display: flex;*/
1345
+ border: 2px solid;
1346
+ width:fit-content;
1347
+ border-color: rgb(128,128,128);
1348
+ visibility:hidden;
1349
+ position: absolute;
1350
+ background-color: rgba(255,255,255,0.9);
1351
+ left:1px;
1352
+ top:1px;
1353
+ }
1354
+
1355
+ .UMyChart_DrawTool_Title_Div
1356
+ {
1357
+ padding-left: 2px;
1358
+ height:20px;
1359
+ border-bottom: 1px solid;
1360
+ border-color: rgb(128,128,128);
1361
+ display: flex;
1362
+ cursor: default;
1363
+ user-select: none;
1364
+ }
1365
+
1366
+ .UMyChart_DrawTool_Close_Div
1367
+ {
1368
+ margin-left: auto;
1369
+ padding-right: 4px;
1370
+ cursor:pointer;
1371
+ }
1372
+
1373
+ .UMyChart_DrawTool_Table
1374
+ {
1375
+ border-collapse: collapse;
1376
+ border-spacing: 2px;
1377
+ }
1378
+
1379
+ .UMyChart_DrawTool_Tbody
1380
+ {
1381
+
1382
+ }
1383
+
1384
+ .UMyChart_DrawTool_Tr
1385
+ {
1386
+ display: table-row;
1387
+ height:20px;
1388
+ }
1389
+
1390
+ .UMyChart_DrawTool_Span_Selected
1391
+ {
1392
+ background: rgb(128,128,128);
1393
+ color: rgb(255,255,255);
1394
+ }
1395
+
1396
+ .UMyChart_DrawTool_Td
1397
+ {
1398
+ padding: 2px;
1399
+ }
1400
+
1401
+ .UMyChart_DrawTool_Span
1402
+ {
1403
+ font-size:22px;
1404
+ border: 1px solid;
1405
+ border-color: rgb(128,128,128);
1406
+ }
1407
+
1408
+ .UMyChart_DrawTool_Group_Tr
1409
+ {
1410
+ font-size: 12px;
1411
+ cursor: default;
1412
+ user-select: none;
1413
+ }
1414
+
1415
+ .UMyChart_DrawTool_Group_Td
1416
+ {
1417
+ text-align:center;
1418
+ }
1419
+
1420
+ .UMyChart_DrawTool_Group_End_Tr
1421
+ {
1422
+ height:5px;
1423
+ border-bottom: 1px solid;
1424
+ border-color: rgb(128,128,128);
1425
+ }
1426
+
1427
+
1428
+
1429
+
1430
+
1329
1431
 
1330
1432
 
1331
1433