hqchart 1.1.13313 → 1.1.13324

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.13313",
3
+ "version": "1.1.13324",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -17,6 +17,7 @@ var JS_DRAWTOOL_MENU_ID=
17
17
  CMD_DELETE_ALL_DRAW_CHART_ID:3,
18
18
  CMD_ERASE_DRAW_CHART_ID:4,
19
19
  CMD_ENABLE_MAGNET_ID:5, //画图工具磁体功能
20
+ CMD_DELETE_DRAW_CHART_ID:6,
20
21
  };
21
22
 
22
23
  function JSDialogDrawTool()
@@ -519,8 +520,10 @@ function JSDialogDrawTool()
519
520
  if ((right+5)>=window.innerWidth) left=window.innerWidth-this.DivDialog.offsetWidth-5;
520
521
  if ((bottom+5)>=window.innerHeight) top=window.innerHeight-this.DivDialog.offsetHeight-5;
521
522
 
522
- this.DivDialog.style.left = left + 'px'
523
- this.DivDialog.style.top = top + 'px'
523
+ this.DivDialog.style.left = left + 'px';
524
+ this.DivDialog.style.top = top + 'px';
525
+
526
+ if(e.preventDefault) e.preventDefault();
524
527
  }
525
528
 
526
529
  this.DocOnMouseUpTitle=function(e)
@@ -542,6 +545,200 @@ function JSDialogModifyDraw()
542
545
  this.DivDialog=null;
543
546
  this.HQChart;
544
547
  this.ChartPicture;
548
+ this.ColorButton=null;
549
+
550
+ this.RandomLineColor=["rgb(255,69,0)", "rgb(173,255,47)", "rgb(238,154,73)", "rgb(255,105,180)"];
551
+ this.AryButton=
552
+ [
553
+ { Title:"点击切换颜色", ClassName: 'hqchart_drawtool icon-fangkuai', Type:2, Data:{ ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID }},
554
+ { Title:"删除", ClassName: 'hqchart_drawtool icon-recycle_bin', Type:2, Data:{ ID:JS_DRAWTOOL_MENU_ID.CMD_DELETE_DRAW_CHART_ID }}
555
+ ];
556
+
557
+
558
+ this.Inital=function(hqchart)
559
+ {
560
+ this.HQChart=hqchart;
561
+ }
562
+
563
+ this.Destroy=function()
564
+ {
565
+ this.ChartPicture=null;
566
+ this.ColorButton=null;
567
+ if (this.DivDialog)
568
+ {
569
+ document.body.remove(this.DivDialog);
570
+ this.DivDialog=null;
571
+ }
572
+ }
573
+
574
+ this.Create=function()
575
+ {
576
+ var divDom=document.createElement("div");
577
+ divDom.className='UMyChart_Draw_Modify_Dialog_Div';
578
+
579
+ var drgDiv=document.createElement("div");
580
+ drgDiv.className="UMyChart_Draw_Modify_Dialog_Drag_Div";
581
+ drgDiv.onmousedown=(e)=>{ this.OnMouseDownTitle(e); }
582
+ divDom.appendChild(drgDiv);
583
+
584
+ var spanDom=document.createElement("span");
585
+ spanDom.className="hqchart_drawtool icon-tuodong";
586
+ spanDom.classList.add("UMyChart_DrawTool_Span");
587
+ drgDiv.appendChild(spanDom);
588
+
589
+ for(var i=0;i<this.AryButton.length;++i)
590
+ {
591
+ var item=this.AryButton[i];
592
+ this.CreateButtonItem(item, divDom);
593
+ }
594
+
595
+ this.DivDialog=divDom;
596
+ document.body.appendChild(divDom);
597
+ }
598
+
599
+ this.CreateButtonItem=function(item, parentDivDom)
600
+ {
601
+ var divItem=document.createElement("div");
602
+ divItem.className="UMyChart_Draw_Modify_Dialog_Button_Div";
603
+ var spanDom=document.createElement("span");
604
+ spanDom.className=item.ClassName;
605
+ spanDom.classList.add("UMyChart_DrawTool_Span");
606
+ divItem.appendChild(spanDom);
607
+
608
+ var data={ Span:spanDom, Parent:parentDivDom, Item:item };
609
+ divItem.onmousedown=(e)=> { this.OnClickButton(e, data); }; //点击
610
+
611
+ if (item.Data.ID==JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID)
612
+ this.ColorButton=data;
613
+
614
+ parentDivDom.appendChild(divItem);
615
+ }
616
+
617
+ this.OnClickButton=function(e, data)
618
+ {
619
+ console.log('[JSDialogModifyDraw::OnClickButton] ', data);
620
+ if (!data.Item || !data.Item.Data) return;
621
+
622
+ var id=data.Item.Data.ID;
623
+ switch(id)
624
+ {
625
+ case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID:
626
+ this.ModifyLineColor();
627
+ break;
628
+ case JS_DRAWTOOL_MENU_ID.CMD_DELETE_DRAW_CHART_ID:
629
+ this.DeleteDrawPicture();
630
+ break;
631
+ }
632
+ }
633
+
634
+ this.Close=function(e)
635
+ {
636
+ if (!this.DivDialog) return;
637
+
638
+ this.ChartPicture=null;
639
+ this.DivDialog.style.visibility='hidden';
640
+ }
641
+
642
+ this.IsShow=function()
643
+ {
644
+ if (!this.DivDialog) return false;
645
+ return this.DivDialog.style.visibility==='visible';
646
+ }
647
+
648
+ this.DeleteDrawPicture=function()
649
+ {
650
+ if (this.ChartPicture && this.HQChart)
651
+ {
652
+ this.HQChart.ClearChartDrawPicture(this.ChartPicture);
653
+ }
654
+
655
+ this.Close();
656
+ }
657
+
658
+ this.ModifyLineColor=function()
659
+ {
660
+ if (!this.ChartPicture || !this.HQChart) return;
661
+
662
+ var color=this.ChartPicture.LineColor;
663
+ var colorIndex=0;
664
+ for(var i=0;i<this.RandomLineColor.length;++i)
665
+ {
666
+ if (color==this.RandomLineColor[i])
667
+ {
668
+ colorIndex=i+1;
669
+ break;
670
+ }
671
+ }
672
+
673
+ colorIndex=colorIndex%this.RandomLineColor.length;
674
+ color=this.RandomLineColor[colorIndex];
675
+
676
+ this.ChartPicture.LineColor = color;
677
+ this.ChartPicture.PointColor = color;
678
+
679
+ if (this.ColorButton) this.ColorButton.Span.style['color']=color;
680
+
681
+ if (this.HQChart.ChartDrawStorage) this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture); //保存下
682
+
683
+ this.HQChart.Draw();
684
+ }
685
+
686
+ this.Show=function(x, y)
687
+ {
688
+ if (!this.DivDialog) this.Create();
689
+
690
+ this.DivDialog.style.visibility='visible';
691
+ this.DivDialog.style.top = y + "px";
692
+ this.DivDialog.style.left = x + "px";
693
+ }
694
+
695
+ this.SetChartPicture=function(chart)
696
+ {
697
+ this.ChartPicture=chart;
698
+ if (this.ColorButton)
699
+ {
700
+ this.ColorButton.Span.style['color']=chart.LineColor;
701
+ }
702
+ }
703
+
704
+ this.OnMouseDownTitle=function(e)
705
+ {
706
+ if (!this.DivDialog) return;
707
+
708
+ var dragData={ X:e.clientX, Y:e.clientY };
709
+ dragData.YOffset=e.clientX - this.DivDialog.offsetLeft;
710
+ dragData.XOffset=e.clientY - this.DivDialog.offsetTop;
711
+ this.DragTitle=dragData;
712
+
713
+ document.onmousemove=(e)=>{ this.DocOnMouseMoveTitle(e); }
714
+ document.onmouseup=(e)=>{ this.DocOnMouseUpTitle(e); }
715
+ }
716
+
717
+ this.DocOnMouseMoveTitle=function(e)
718
+ {
719
+ if (!this.DragTitle) return;
720
+
721
+ var left = e.clientX - this.DragTitle.YOffset;
722
+ var top = e.clientY - this.DragTitle.XOffset;
723
+
724
+ var right=left+this.DivDialog.offsetWidth;
725
+ var bottom=top+ this.DivDialog.offsetHeight;
726
+
727
+ if ((right+5)>=window.innerWidth) left=window.innerWidth-this.DivDialog.offsetWidth-5;
728
+ if ((bottom+5)>=window.innerHeight) top=window.innerHeight-this.DivDialog.offsetHeight-5;
729
+
730
+ this.DivDialog.style.left = left + 'px'
731
+ this.DivDialog.style.top = top + 'px'
732
+
733
+ if(e.preventDefault) e.preventDefault();
734
+ }
735
+
736
+ this.DocOnMouseUpTitle=function(e)
737
+ {
738
+ this.DragTitle=null;
739
+ this.onmousemove = null;
740
+ this.onmouseup = null;
741
+ }
545
742
  }
546
743
 
547
744
 
@@ -4847,6 +4847,35 @@ function JSAlgorithm(errorHandler,symbolData)
4847
4847
  return result;
4848
4848
  }
4849
4849
 
4850
+ //反向过滤连续出现的信号.
4851
+ //用法:FILTERX(X,N):X满足条件后,将其前N周期内的数据置为0,N为常量.
4852
+ //例如:FILTERX(CLOSE>OPEN,5)查找阳线,前5天内出现过的阳线不被记录在内
4853
+ this.FILTERX=function(data, n, node)
4854
+ {
4855
+ var result=[];
4856
+ for(let i=0,j=0; i<data.length; ++i)
4857
+ {
4858
+ if (data[i])
4859
+ {
4860
+ result[i]=1;
4861
+ for(j=0;j<n && i-j-1>=0;++j)
4862
+ {
4863
+ result[i-j-1]=0;
4864
+ }
4865
+ i+=n;
4866
+ }
4867
+ else
4868
+ {
4869
+ result[i]=0;
4870
+ }
4871
+ }
4872
+
4873
+ return result;
4874
+ }
4875
+
4876
+ //上一次条件成立到当前的周期数.
4877
+ //用法:BARSLAST(X):上一次X不为0到现在的周期数
4878
+ //例如:BARSLAST(CLOSE/REF(CLOSE,1)>=1.1)表示上一个涨停板到当前的周期数
4850
4879
  this.BARSLAST=function(data)
4851
4880
  {
4852
4881
  var result=[];
@@ -4866,6 +4895,52 @@ function JSAlgorithm(errorHandler,symbolData)
4866
4895
  return result;
4867
4896
  }
4868
4897
 
4898
+ //倒数第N次成立时距今的周期数.
4899
+ //用法:BARSLASTS(X,N):X倒数第N满足到现在的周期数,N支持变量
4900
+ this.BARSLASTS=function(data, n, node)
4901
+ {
4902
+ var result=[];
4903
+ if (!data) return result;
4904
+ if (n<=0) n=data.length;
4905
+
4906
+ var day=null;
4907
+ var SingleValue=0; //单词数
4908
+ var periodCount=0;
4909
+ for(let i=0;i<data.length;++i)
4910
+ {
4911
+ result[i]=null;
4912
+ var value=data[i];
4913
+
4914
+ if (value>0)
4915
+ {
4916
+ if (day==null)
4917
+ {
4918
+ day=0;
4919
+ ++periodCount;
4920
+ }
4921
+ else
4922
+ {
4923
+ ++periodCount;
4924
+ if (periodCount>n) day-=SingleValue;
4925
+ }
4926
+
4927
+ SingleValue=0;
4928
+ }
4929
+ else
4930
+ {
4931
+ if (day!=null)
4932
+ {
4933
+ ++day;
4934
+ ++SingleValue;
4935
+ }
4936
+ }
4937
+
4938
+ if (day!=null) result[i]=day;
4939
+ }
4940
+
4941
+ return result;
4942
+ }
4943
+
4869
4944
  /*
4870
4945
  N周期内第一个条件成立到当前的周期数.
4871
4946
  用法:
@@ -8887,10 +8962,15 @@ function JSAlgorithm(errorHandler,symbolData)
8887
8962
  return this.FILTER(args[0],args[1]);
8888
8963
  case 'TFILTER':
8889
8964
  return this.TFILTER(args[0],args[1],args[2]);
8965
+ case "FILTERX":
8966
+ return this.FILTERX(args[0],args[1],node);
8890
8967
  case 'SLOPE':
8891
8968
  return this.SLOPE(args[0],args[1]);
8892
8969
  case 'BARSLAST':
8893
8970
  return this.BARSLAST(args[0]);
8971
+ case "BARSLASTS":
8972
+ //this.ThrowUnexpectedNode(node,`函数'BARSLASTS'还在开发中`, name);
8973
+ return this.BARSLASTS(args[0],args[1],node);
8894
8974
  case 'BARSCOUNT':
8895
8975
  return this.BARSCOUNT(args[0]);
8896
8976
  case 'BARSSINCEN':
@@ -16313,6 +16393,7 @@ JSSymbolData.prototype.JsonDataToFinance=function(data)
16313
16393
 
16314
16394
  var JS_EXECUTE_DEBUG_LOG=false;
16315
16395
 
16396
+
16316
16397
  var JS_EXECUTE_JOB_ID=
16317
16398
  {
16318
16399
  JOB_DOWNLOAD_SYMBOL_DATA:1, //下载股票的K线数据
@@ -18340,6 +18421,7 @@ function JSExplainer(ast,option)
18340
18421
  this.JobList=[]; //执行的任务队列
18341
18422
  this.VarTable=new Map(); //变量表
18342
18423
  this.OutVarTable=[]; //输出变量
18424
+ this.MaxValueLength=150; //最长的字符
18343
18425
 
18344
18426
  //脚本自动变量表, 只读
18345
18427
  this.ConstVarTable=new Map(
@@ -18440,9 +18522,10 @@ function JSExplainer(ast,option)
18440
18522
  if (!this.AST) this.ThrowError();
18441
18523
  if (!this.AST.Body) this.ThrowError();
18442
18524
 
18443
- for(let i in this.AST.Body)
18525
+ for(var i=0; i<this.AST.Body.length; ++i)
18444
18526
  {
18445
- let item =this.AST.Body[i];
18527
+ //console.log(`[JSExplainer::RunAST] ${i}`);
18528
+ var item =this.AST.Body[i];
18446
18529
  this.VisitNode(item);
18447
18530
 
18448
18531
  //输出变量
@@ -18565,7 +18648,7 @@ function JSExplainer(ast,option)
18565
18648
  {
18566
18649
  varName=itemExpression.Left.Name;
18567
18650
  let varValue=this.VarTable.get(varName);
18568
- this.VarTable.set(varName,varValue); //把常量放到变量表里
18651
+ this.VarTable.set(varName,this.ConvertToShortValue(varValue)); //把常量放到变量表里
18569
18652
  }
18570
18653
  else if (itemExpression.Type==Syntax.Identifier)
18571
18654
  {
@@ -18603,7 +18686,7 @@ function JSExplainer(ast,option)
18603
18686
  let varValue=this.ReadVariable(varName,itemExpression);
18604
18687
  varName="__temp_si_"+i+"__";
18605
18688
  isNoneName=true;
18606
- this.VarTable.set(varName,varValue); //放到变量表里
18689
+ this.VarTable.set(varName,this.ConvertToShortValue(varValue)); //放到变量表里
18607
18690
  }
18608
18691
  }
18609
18692
  else if(itemExpression.Type==Syntax.Literal) //常量
@@ -18808,7 +18891,7 @@ function JSExplainer(ast,option)
18808
18891
  return node.Out;
18809
18892
  }
18810
18893
 
18811
- JSConsole.Complier.Log('[JSExplainer::VisitCallExpression]' , funcName, '(', args.toString() ,')');
18894
+ if (JS_EXECUTE_DEBUG_LOG) JSConsole.Complier.Log('[JSExplainer::VisitCallExpression]' , funcName, '(', args.toString() ,')');
18812
18895
 
18813
18896
  if (g_JSComplierResource.IsCustomFunction(funcName))
18814
18897
  {
@@ -18835,6 +18918,8 @@ function JSExplainer(ast,option)
18835
18918
  ["BARSLASTCOUNT", { Name:"BARSLASTCOUNT", Param:{ Count:1 }, ToString:function(args) { return `条件${args[0]}连续成立次数`; } } ],
18836
18919
  ["BARSCOUNT", { Name:"BARSCOUNT", Param:{ Count:1 }, ToString:function(args) { return `${args[0]}有效数据周期数`; } } ],
18837
18920
  ["BARSLAST", { Name:"BARSLAST", Param:{ Count:1 }, ToString:function(args) { return `上次${args[0]}不为0距今天数`; } } ],
18921
+ ["BARSLASTS", { Name:"BARSLASTS", Param:{ Count:2 }, ToString:function(args) { return `倒数第N次成立时距今的周期数`; } } ],
18922
+
18838
18923
  ["BARSNEXT", { Name:"BARSNEXT", Param:{ Count:1 }, ToString:function(args) { return `下次${args[0]}不为0距今天数`; } } ],
18839
18924
  ["BARSSINCEN", { Name:"BARSSINCEN", Param:{ Count:2 }, ToString:function(args) { return `在${args[1]}周期内首次${args[0]}距今天数`; } } ],
18840
18925
  ["BARSSINCE", { Name:"BARSSINCE", Param:{ Count:1 }, ToString:function(args) { return `首次${args[0]}距今天数`; } } ],
@@ -19002,7 +19087,7 @@ function JSExplainer(ast,option)
19002
19087
  if (item.Param.Count!=args.length)
19003
19088
  this.ThrowUnexpectedNode(node,`函数${funcName}参数个数不正确. 需要${item.Param.Count}个参数`);
19004
19089
  }
19005
-
19090
+
19006
19091
  return item.ToString(args);
19007
19092
  }
19008
19093
 
@@ -19279,8 +19364,22 @@ function JSExplainer(ast,option)
19279
19364
  else if (right.Type==Syntax.UnaryExpression)
19280
19365
  value=this.VisitUnaryExpression(right);
19281
19366
 
19282
- JSConsole.Complier.Log('[JSExplainer::VisitAssignmentExpression]' , varName, ' = ',value);
19283
- this.VarTable.set(varName,value);
19367
+ if (JS_EXECUTE_DEBUG_LOG) JSConsole.Complier.Log('[JSExplainer::VisitAssignmentExpression]' , varName, ' = ',value);
19368
+
19369
+ this.VarTable.set(varName,this.ConvertToShortValue(value));
19370
+ }
19371
+
19372
+ this.ConvertToShortValue=function(value)
19373
+ {
19374
+ var maxLength=this.MaxValueLength;
19375
+ if (value && value.length>=maxLength)
19376
+ {
19377
+ var shortValue=value.slice(0, maxLength-10);
19378
+ shortValue+="......";
19379
+ return shortValue;
19380
+ }
19381
+
19382
+ return value;
19284
19383
  }
19285
19384
 
19286
19385
  this.ReadMemberVariable=function(node)
@@ -19340,7 +19439,7 @@ function JSExplainer(ast,option)
19340
19439
  let leftValue=this.GetNodeValue(value.Left);
19341
19440
  let rightValue=this.GetNodeValue(value.Right);
19342
19441
 
19343
- JSConsole.Complier.Log('[JSExplainer::VisitBinaryExpression] BinaryExpression',value , leftValue, rightValue);
19442
+ if (JS_EXECUTE_DEBUG_LOG) JSConsole.Complier.Log('[JSExplainer::VisitBinaryExpression] BinaryExpression',value , leftValue, rightValue);
19344
19443
  value.Out=null; //保存中间值
19345
19444
 
19346
19445
  value.Out=`(${leftValue} ${value.Operator} ${rightValue})`;
@@ -19357,14 +19456,14 @@ function JSExplainer(ast,option)
19357
19456
  else if (value.Operator=="=") value.Out='(平盘)';
19358
19457
  }
19359
19458
 
19360
- JSConsole.Complier.Log('[JSExplainer::VisitBinaryExpression] BinaryExpression',value);
19459
+ if (JS_EXECUTE_DEBUG_LOG) JSConsole.Complier.Log('[JSExplainer::VisitBinaryExpression] BinaryExpression',value);
19361
19460
  }
19362
19461
  else if (value.Type==Syntax.LogicalExpression)
19363
19462
  {
19364
19463
  let leftValue=this.GetNodeValue(value.Left);
19365
19464
  let rightValue=this.GetNodeValue(value.Right);
19366
19465
 
19367
- JSConsole.Complier.Log('[JSExecute::VisitBinaryExpression] LogicalExpression',value , leftValue, rightValue);
19466
+ if (JS_EXECUTE_DEBUG_LOG) JSConsole.Complier.Log('[JSExecute::VisitBinaryExpression] LogicalExpression',value , leftValue, rightValue);
19368
19467
  value.Out=null; //保存中间值
19369
19468
 
19370
19469
  switch(value.Operator)
@@ -19379,7 +19478,7 @@ function JSExplainer(ast,option)
19379
19478
  break;
19380
19479
  }
19381
19480
 
19382
- JSConsole.Complier.Log('[JSExplainer::VisitBinaryExpression] LogicalExpression',value);
19481
+ if (JS_EXECUTE_DEBUG_LOG) JSConsole.Complier.Log('[JSExplainer::VisitBinaryExpression] LogicalExpression',value);
19383
19482
  }
19384
19483
 
19385
19484
  node=temp;
@@ -1649,6 +1649,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
1649
1649
 
1650
1650
  //画图工具
1651
1651
  if (option.EnableDrawToolDialogV2===true) chart.InitalDrawToolDialog();
1652
+ if (option.EnableModifyDrawDialogV2===true) chart.InitalModifyDrawDialog();
1652
1653
 
1653
1654
  //注册事件
1654
1655
  if (option.EventCallback)
@@ -2911,6 +2912,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
2911
2912
  this.IsShowRightMenu=true; //显示右键菜单
2912
2913
 
2913
2914
  this.DialogDrawTool; //画图工具
2915
+ this.DialogModifyDraw; //画图修改
2914
2916
 
2915
2917
 
2916
2918
  this.ClearStockCache=function()
@@ -2935,6 +2937,15 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
2935
2937
  this.DialogDrawTool.Create();
2936
2938
  }
2937
2939
 
2940
+ this.InitalModifyDrawDialog=function()
2941
+ {
2942
+ if ( this.DialogModifyDraw) return;
2943
+
2944
+ this.DialogModifyDraw=new JSDialogModifyDraw();
2945
+ this.DialogModifyDraw.Inital(this);
2946
+ this.DialogModifyDraw.Create();
2947
+ }
2948
+
2938
2949
  this.ShowDrawToolDialog=function(x,y)
2939
2950
  {
2940
2951
  if (!this.DialogDrawTool) return;
@@ -2957,6 +2968,31 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
2957
2968
  return this.DialogDrawTool.IsShow();
2958
2969
  }
2959
2970
 
2971
+ this.ShowModifyDrawDialog=function(chart, x,y)
2972
+ {
2973
+ if (!this.DialogModifyDraw) return;
2974
+
2975
+ this.DialogModifyDraw.SetChartPicture(chart);
2976
+ if (this.DialogModifyDraw.IsShow()) return;
2977
+
2978
+ var rtClient=this.UIElement.getBoundingClientRect();
2979
+ var rtScroll=GetScrollPosition();
2980
+
2981
+ var top=this.UIElement.offsetTop+15;
2982
+ var left=(this.UIElement.offsetWidth-this.DialogModifyDraw.DivDialog.offsetWidth)/2;
2983
+ left+=rtClient.left+rtScroll.Left;
2984
+ top+=rtClient.top+rtScroll.Top;
2985
+
2986
+ this.DialogModifyDraw.Show(left, top);
2987
+ }
2988
+
2989
+ this.CloseModifyDrawDialog=function()
2990
+ {
2991
+ if (!this.DialogModifyDraw) return;
2992
+
2993
+ this.DialogModifyDraw.Close();
2994
+ }
2995
+
2960
2996
  //obj={ Element:, Canvas: }
2961
2997
  this.SetCorssCursorElement=function(obj)
2962
2998
  {
@@ -3636,6 +3672,9 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3636
3672
  }
3637
3673
  }
3638
3674
 
3675
+
3676
+ if (!this.SelectChartDrawPicture) this.CloseModifyDrawDialog(); //当前没有选中画图 隐藏画图修改框
3677
+
3639
3678
  document.onmousemove=(e)=>{ this.DocOnMouseMove(e); }
3640
3679
  document.onmouseup=(e)=> { this.DocOnMouseUp(e); }
3641
3680
 
@@ -6330,6 +6369,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6330
6369
  this.SelectChartDrawPicture=null;
6331
6370
  if (this.ChartPictureMenu) this.ChartPictureMenu.Hide();
6332
6371
  this.ClearChartDrawPicture(drawPicture); //删除选中的画图工具
6372
+ this.CloseModifyDrawDialog();
6333
6373
  }
6334
6374
  else if (this.SelectedChart && this.SelectedChart.Selected.Identify)
6335
6375
  {
@@ -8036,11 +8076,23 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8036
8076
  this.OnSelectChartPicture=function(chart)
8037
8077
  {
8038
8078
  JSConsole.Chart.Log('[JSChartContainer::OnSelectChartPicture]',chart);
8039
- if (!this.ChartPictureMenu) this.ChartPictureMenu=g_DialogFactory.Create('ChartPictureSettingMenu', this.UIElement.parentNode);
8040
- if (!this.ChartPictureMenu) return;
8041
8079
 
8042
- var event={ data: { ChartPicture:chart, HQChart:this}};
8043
- this.ChartPictureMenu.DoModal(event);
8080
+ if (!this.DialogModifyDraw) return;
8081
+
8082
+ if (chart.ClassName=="ChartDrawPictureText" || chart.ClassName=='ChartDrawVolProfile')
8083
+ {
8084
+ this.CloseModifyDrawDialog();
8085
+
8086
+ if (!this.ChartPictureMenu) this.ChartPictureMenu=g_DialogFactory.Create('ChartPictureSettingMenu', this.UIElement.parentNode);
8087
+ if (!this.ChartPictureMenu) return;
8088
+
8089
+ var event={ data: { ChartPicture:chart, HQChart:this}};
8090
+ this.ChartPictureMenu.DoModal(event);
8091
+ }
8092
+ else
8093
+ {
8094
+ this.ShowModifyDrawDialog(chart);
8095
+ }
8044
8096
  }
8045
8097
 
8046
8098
  this.FinishMoveChartDrawPicture=function()
@@ -60467,7 +60519,6 @@ function ChartDrawMonitorLine()
60467
60519
  LineDash:[3,5],
60468
60520
  }
60469
60521
 
60470
-
60471
60522
  this.SetOption=function(option)
60472
60523
  {
60473
60524
  if (option.LineColor) this.LineColor=option.LineColor;
@@ -60481,8 +60532,8 @@ function ChartDrawMonitorLine()
60481
60532
  if (item.LineDash) dest.LineDash=item.LineDash;
60482
60533
  if (IFrameSplitOperator.IsNumber(item.YTextOffset)) dest.YTextOffset=item.YTextOffset;
60483
60534
  }
60484
-
60485
- if (option.FormatLabelText) this.FormatLabelTextCallback=option.FormatLabelText;
60535
+
60536
+ if (option.FormatLabelTextCallback) this.FormatLabelTextCallback=option.FormatLabelTextCallback;
60486
60537
  }
60487
60538
 
60488
60539
  this.Draw=function()
@@ -1437,7 +1437,42 @@ input[type="color"] {
1437
1437
 
1438
1438
 
1439
1439
 
1440
+ /*
1441
+ Copyright (c) 2018 jones
1442
+
1443
+ http://www.apache.org/licenses/LICENSE-2.0
1444
+
1445
+ 开源项目 https://github.com/jones2000/HQChart
1446
+
1447
+ jones_2000@163.com
1448
+
1449
+ 内置画图属性修改对话框
1450
+ */
1451
+
1452
+ .UMyChart_Draw_Modify_Dialog_Div
1453
+ {
1454
+ font-family: "微软雅黑";
1455
+ /*display: flex;*/
1456
+ border: 2px solid;
1457
+ width:fit-content;
1458
+ border-color: rgb(204,204,204);
1459
+ visibility:hidden;
1460
+ position: absolute;
1461
+ background-color: rgba(250,250,250,1);
1462
+ left:1px;
1463
+ top:1px;
1464
+ display: flex;
1465
+ }
1466
+
1467
+ .UMyChart_Draw_Modify_Dialog_Drag_Div
1468
+ {
1469
+ width:24px;
1470
+ }
1440
1471
 
1472
+ .UMyChart_Draw_Modify_Dialog_Button_Div
1473
+ {
1474
+
1475
+ }
1441
1476
 
1442
1477
 
1443
1478
 
@@ -54,6 +54,12 @@
54
54
  <div class="content unicode" style="display: block;">
55
55
  <ul class="icon_lists dib-box">
56
56
 
57
+ <li class="dib">
58
+ <span class="icon hqchart_drawtool">&#xe6ff;</span>
59
+ <div class="name">拖动</div>
60
+ <div class="code-name">&amp;#xe6ff;</div>
61
+ </li>
62
+
57
63
  <li class="dib">
58
64
  <span class="icon hqchart_drawtool">&#xe936;</span>
59
65
  <div class="name">监测</div>
@@ -408,9 +414,9 @@
408
414
  <pre><code class="language-css"
409
415
  >@font-face {
410
416
  font-family: 'hqchart_drawtool';
411
- src: url('iconfont.woff2?t=1715871387338') format('woff2'),
412
- url('iconfont.woff?t=1715871387338') format('woff'),
413
- url('iconfont.ttf?t=1715871387338') format('truetype');
417
+ src: url('iconfont.woff2?t=1715878738024') format('woff2'),
418
+ url('iconfont.woff?t=1715878738024') format('woff'),
419
+ url('iconfont.ttf?t=1715878738024') format('truetype');
414
420
  }
415
421
  </code></pre>
416
422
  <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@@ -436,6 +442,15 @@
436
442
  <div class="content font-class">
437
443
  <ul class="icon_lists dib-box">
438
444
 
445
+ <li class="dib">
446
+ <span class="icon hqchart_drawtool icon-tuodong"></span>
447
+ <div class="name">
448
+ 拖动
449
+ </div>
450
+ <div class="code-name">.icon-tuodong
451
+ </div>
452
+ </li>
453
+
439
454
  <li class="dib">
440
455
  <span class="icon hqchart_drawtool icon-jiance"></span>
441
456
  <div class="name">
@@ -967,6 +982,14 @@
967
982
  <div class="content symbol">
968
983
  <ul class="icon_lists dib-box">
969
984
 
985
+ <li class="dib">
986
+ <svg class="icon svg-icon" aria-hidden="true">
987
+ <use xlink:href="#icon-tuodong"></use>
988
+ </svg>
989
+ <div class="name">拖动</div>
990
+ <div class="code-name">#icon-tuodong</div>
991
+ </li>
992
+
970
993
  <li class="dib">
971
994
  <svg class="icon svg-icon" aria-hidden="true">
972
995
  <use xlink:href="#icon-jiance"></use>