hqchart 1.1.15104 → 1.1.15106

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.
@@ -6758,12 +6758,6 @@ JSChart.RegisterScriptIndexChart=function(name, option)
6758
6758
  return g_ScriptIndexChartFactory.Add(name, option);
6759
6759
  }
6760
6760
 
6761
- //注册设置对话框类
6762
- //option:{ Create:创建类方法 }
6763
- JSChart.RegisterDialogClass=function(name, option)
6764
- {
6765
- return g_DialogFactory.Add(name, option);
6766
- }
6767
6761
 
6768
6762
  //注册框架类
6769
6763
  JSChart.RegisterChartFrameClass=function(name, option)
@@ -51951,17 +51945,40 @@ function ChartLock()
51951
51945
  if (!out || !IFrameSplitOperator.IsNonEmptyArray(aryText)) return false;
51952
51946
 
51953
51947
  this.Canvas.font=defaultFont;
51954
- var lineHeight=this.Canvas.measureText("擎").width; //行高
51948
+ var defaultLineHeight=this.Canvas.measureText("擎").width; //行高
51949
+ var lineHeight=defaultLineHeight;
51955
51950
  var height=0, width=0;
51956
51951
  out.AryText=[];
51957
51952
  for(var i=0;i<aryText.length;++i)
51958
51953
  {
51959
51954
  var item=aryText[i];
51960
- if (!item || !item.Text) continue;
51961
- var textWidth=this.Canvas.measureText(item.Text).width;
51955
+ if (!item || (!item.Text && !item.Image)) continue;
51956
+ if (item.Image)
51957
+ {
51958
+ textWidth=item.Image.Width;
51959
+ lineHeight=item.Image.Height;
51960
+ }
51961
+ else
51962
+ {
51963
+ if (item.Font)
51964
+ {
51965
+ this.Canvas.font=item.Font;
51966
+ lineHeight=this.Canvas.measureText("擎").width;
51967
+ }
51968
+ else
51969
+ {
51970
+ this.Canvas.font=defaultFont;
51971
+ lineHeight=defaultLineHeight;
51972
+ }
51973
+
51974
+ var textWidth=this.Canvas.measureText(item.Text).width;
51975
+ }
51962
51976
 
51963
51977
  var lineItem={ Text:item.Text, Width:textWidth, Height:lineHeight, Color:item.Color, TextMargin:{ Top:0, Bottom:0, Left:0, Right:0 }, YOffset:0 };
51964
51978
  if (IFrameSplitOperator.IsNumber(item.YOffset)) lineItem.YOffset=item.YOffset;
51979
+ if (item.Font) lineItem.Font=item.Font;
51980
+ if (IFrameSplitOperator.IsNumber(item.Align)) lineItem.Align=item.Align; //左右对齐 0=左 1=中 2=右
51981
+ if (item.Image) lineItem.Image=item.Image;
51965
51982
  if (item.TextMargin)
51966
51983
  {
51967
51984
  var margin=item.TextMargin;
@@ -52085,6 +52102,9 @@ function ChartLock()
52085
52102
  if (item.Color) this.Canvas.fillStyle=item.Color;
52086
52103
  else this.Canvas.fillStyle=this.TextColor;
52087
52104
 
52105
+ if (item.Font) this.Canvas.font = item.Font;
52106
+ else this.Canvas.font = this.Font;
52107
+
52088
52108
  yText+=item.Height;
52089
52109
  this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
52090
52110
  }
@@ -52101,11 +52121,35 @@ function ChartLock()
52101
52121
  for(var i=0;i<outSize.AryText.length;++i)
52102
52122
  {
52103
52123
  var item=outSize.AryText[i];
52104
- if (item.Color) this.Canvas.fillStyle=item.Color;
52105
- else this.Canvas.fillStyle=this.TextColor;
52124
+ if (item.Image)
52125
+ {
52126
+ xText=left;
52127
+ if (item.Align===1)
52128
+ {
52129
+ if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
52130
+ }
52106
52131
 
52107
- yText+=item.Height;
52108
- this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
52132
+ this.Canvas.drawImage(item.Image.Data, xText, yText, item.Image.Width, item.Image.Height);
52133
+
52134
+ yText+=item.Height;
52135
+ }
52136
+ else
52137
+ {
52138
+ if (item.Color) this.Canvas.fillStyle=item.Color;
52139
+ else this.Canvas.fillStyle=this.TextColor;
52140
+
52141
+ if (item.Font) this.Canvas.font = item.Font;
52142
+ else this.Canvas.font = this.Font;
52143
+
52144
+ yText+=item.Height;
52145
+ xText=left;
52146
+ if (item.Align===1)
52147
+ {
52148
+ if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
52149
+ }
52150
+
52151
+ this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
52152
+ }
52109
52153
  }
52110
52154
  }
52111
52155
  }
@@ -105103,239 +105147,9 @@ function IsFundSymbol(symbol)
105103
105147
  return false;
105104
105148
  }
105105
105149
 
105106
- //设置对话框工厂类
105107
- function DialogFactory()
105108
- {
105109
- //[key:name, { Create:function(divElement) { return new class(divElement); }} ]
105110
- this.DataMap=new Map(
105111
- [
105112
- ["ChartPictureSettingMenu", { Create:function(divElement) { return new ChartPictureSettingMenu(divElement); } }],
105113
- ]);
105114
-
105115
- this.Create=function(name, option)
105116
- {
105117
- if (!this.DataMap.has(name))
105118
- {
105119
- JSConsole.Chart.Warn(`[DialogFactory::Create] can't find class=${name}.`);
105120
- return null;
105121
- }
105122
-
105123
- var item=this.DataMap.get(name);
105124
- return item.Create(option);
105125
- }
105126
-
105127
- this.Add=function(name, option)
105128
- {
105129
- this.DataMap.set(name, { Create:option.Create } );
105130
- }
105131
- }
105132
-
105133
- var g_DialogFactory=new DialogFactory();
105134
-
105135
- //设置窗口基类
105136
- function IDivDialog(divElement)
105137
- {
105138
- this.DivElement=divElement; //父节点
105139
- this.ID=null; //div id
105140
- this.TimeOut=null; //定时器
105141
-
105142
- //隐藏窗口
105143
- this.Hide=function()
105144
- {
105145
- $("#"+this.ID).hide();
105146
- }
105147
-
105148
- //显示窗口
105149
- this.Show=function(left,top,width,height)
105150
- {
105151
- var cssData={display:'block'};
105152
- if (IFrameSplitOperator.IsNumber(left)) cssData.left=left+'px';
105153
- if (IFrameSplitOperator.IsNumber(top)) cssData.top=top+'px';
105154
- if (IFrameSplitOperator.IsNumber(width)) cssData.width=width+'px';
105155
- if (IFrameSplitOperator.IsNumber(height)) cssData.height=height+'px';
105156
-
105157
- $("#"+this.ID).css(cssData);
105158
- }
105159
- }
105160
-
105161
- //等待动画窗口
105162
- function WaitDialog(divElement)
105163
- {
105164
- this.newMethod=IDivDialog; //派生
105165
- this.newMethod(divElement);
105166
- delete this.newMethod;
105167
-
105168
- this.Title='加载中......';
105169
- this.Dialog;
105170
-
105171
- //隐藏窗口
105172
- this.Close=function()
105173
- {
105174
- if (this.Dialog)
105175
- {
105176
- this.DivElement.removeChild(this.Dialog);
105177
- this.Dialog=null;
105178
- }
105179
- }
105180
-
105181
- this.SetTitle=function(title)
105182
- {
105183
- this.Title=title;
105184
- if (!this.Dialog) return;
105185
- //TODO: 更新标题数据
105186
- }
105187
-
105188
- this.Create=function()
105189
- {
105190
- this.ID=Guid();
105191
- var div=document.createElement('div');
105192
- div.className='jchart-wait-box';
105193
- div.id=this.ID;
105194
- div.innerHTML=
105195
- `<div class='parameter jchart-kline-match-box'>
105196
- <div class='parameter-header'>
105197
- <span>${this.Title}</span>
105198
- </div>
105199
- </div>`.trim();
105200
-
105201
- this.DivElement.appendChild(div);
105202
- this.Dialog=div;
105203
- }
105204
-
105205
- //显示
105206
- this.DoModal=function(event)
105207
- {
105208
- this.Title=event.data.Title;
105209
- var chart=event.data.Chart;
105210
- if (this.ID==null) this.Create(); //第1次 需要创建div
105211
-
105212
- //居中显示
105213
- var border=chart.Frame.ChartBorder;
105214
- var scrollPos=GetScrollPosition();
105215
- var left=border.GetWidth()/2;
105216
- var top=border.GetHeight()/2;
105217
-
105218
- this.Show(left,top,200,40); //显示
105219
- }
105220
- }
105221
-
105222
- //画图工具 单个图形设置
105223
- function ChartPictureSettingMenu(divElement)
105224
- {
105225
- this.newMethod=IDivDialog; //派生
105226
- this.newMethod(divElement);
105227
- delete this.newMethod;
105228
-
105229
- this.HQChart;
105230
- this.ChartPicture;
105231
- this.SubToolsDiv;
105232
- this.SettingMenu;
105233
- this.SettingPV;
105234
-
105235
- this.DoModal=function(event)
105236
- {
105237
- var $body;
105238
- if (!this.SubToolsDiv)
105239
- {
105240
- this.ID=Guid();
105241
- var div=document.createElement("div");
105242
- div.className='subTolls';
105243
- div.id=this.ID;
105244
- this.DivElement.appendChild(div);
105245
- //$body = $("."+event.data.HQChart.ClassName).context.body;
105246
- //$body.append(div);
105247
- this.SubToolsDiv=div;
105248
- }
105249
- this.HQChart=event.data.HQChart;
105250
- this.ChartPicture=event.data.ChartPicture;
105251
-
105252
- var pixelTatio = GetDevicePixelRatio();
105253
- var frame=this.HQChart.Frame.SubFrame[0].Frame;
105254
- // var top=frame.ChartBorder.GetTopTitle();
105255
- var top=frame.ChartBorder.Top + 40;
105256
- // var right=frame.ChartBorder.GetRight();
105257
- var right=frame.ChartBorder.Right;
105258
- var left=frame.ChartBorder.GetLeft();
105259
- var className = this.ChartPicture.ClassName; //='ChartDrawPictureText'时加“设置”
105260
- var lineColor=this.ChartPicture.LineColor;
105261
- if (lineColor.indexOf("rgb(")==0 || lineColor.indexOf("RGB(")==0)
105262
- lineColor=IChartDrawPicture.RGBToHex(lineColor.toLowerCase());
105263
- var toolsDiv = "";
105264
- if(className === 'ChartDrawPictureText')
105265
- {
105266
- toolsDiv = '<span class="changes-color" title="改变图形颜色">'+
105267
- '<i class="iconfont icon-bianji"></i>'+
105268
- '<input type="color" name="color" id="color" class="change-color" value="'+ lineColor +'">'+
105269
- '</span>\n' +
105270
- '<span class="subtool-set" title="设置"><i class="iconfont icon-shezhi"></i></span>'+
105271
- '<span class="subtool-del"><i class="iconfont icon-recycle_bin"></i></span>';
105272
- }
105273
- else if (className=="ChartDrawVolProfile")
105274
- {
105275
- toolsDiv='<span class="vp-set" title="设置"><i class="iconfont icon-shezhi"></i></span>'+
105276
- '<span class="subtool-del"><i class="iconfont icon-recycle_bin"></i></span>';
105277
- }
105278
- else
105279
- {
105280
- toolsDiv =
105281
- '<p class="changes-color" title="改变图形颜色"><i class="iconfont icon-bianji"></i>' +
105282
- '<input type="color" name="color" id="color" class="change-color" value="'+ lineColor +'"></p>\n' +
105283
- ' <p class="subtool-del"><i class="iconfont icon-recycle_bin"></i></p>';
105284
- }
105285
-
105286
-
105287
- this.SubToolsDiv.style.right = right/pixelTatio + "px";
105288
- this.SubToolsDiv.style.top = top/pixelTatio + "px";
105289
- this.SubToolsDiv.innerHTML = toolsDiv;
105290
- this.SubToolsDiv.style.position = "absolute";
105291
- this.SubToolsDiv.style.display = "block";
105292
-
105293
- var hqChart = this.HQChart;
105294
- var picture = this.ChartPicture;
105295
- var subToolDiv = this.SubToolsDiv;
105296
- $(".subtool-del").click(function(){
105297
- hqChart.SelectChartDrawPicture=null;
105298
- hqChart.ClearChartDrawPicture(picture);
105299
- // subToolDiv.innerHTML = "";
105300
- $(".subTolls").css("display","none");
105301
- });
105302
- var self = this;
105303
- $(".subtool-set").click(function(){
105304
- $(self.SubToolsDiv).hide();
105305
- //创建div设置窗口
105306
- if (!self.SettingMenu) self.SettingMenu=new ChartPictureTextSettingMenu(frame.ChartBorder.UIElement.parentNode);
105307
-
105308
- self.SettingMenu.ChartPicture=picture;
105309
- self.SettingMenu.HQChart=hqChart;
105310
- self.SettingMenu.Position={Left:right + 80,Top:top + 20};
105311
- self.SettingMenu.DoModal();
105312
- });
105313
- $(".changes-color").click(function () {
105314
- document.getElementById('color').click();
105315
- $(".change-color").change(function () {
105316
- var color = $(".change-color").val();
105317
- picture.LineColor = color;
105318
- picture.PointColor = color;
105319
- if (hqChart.ChartDrawStorage) hqChart.ChartDrawStorage.SaveDrawData(picture); //保存下
105320
- });
105321
- });
105322
-
105323
- //成交量分布图设置
105324
- $(".vp-set").click(function()
105325
- {
105326
- if (!self.SettingPV) self.SettingPV=new ChartPictureVolProfileSettingMenu(frame.ChartBorder.UIElement.parentNode);
105327
- self.SettingPV.ChartPicture=picture;
105328
- self.SettingPV.HQChart=hqChart;
105329
- self.SettingPV.Position={Left:right + 80,Top:top + 20};
105330
- self.SettingPV.DoModal();
105331
- });
105332
-
105333
-
105334
- JSConsole.Chart.Log("[ChartPictureSettingMenu::DoModal]", {Top:top,Left:left, Right:right});
105335
- }
105336
- }
105337
105150
 
105338
105151
 
105152
+ /*
105339
105153
  function ChartPictureVolProfileSettingMenu(divElement)
105340
105154
  {
105341
105155
  this.newMethod=IDivDialog; //派生
@@ -105424,6 +105238,7 @@ function ChartPictureVolProfileSettingMenu(divElement)
105424
105238
  }
105425
105239
  }
105426
105240
  }
105241
+ */
105427
105242
 
105428
105243
 
105429
105244
 
@@ -158686,6 +158501,11 @@ function JSDialogModifyDraw()
158686
158501
  this.HQChart.Draw();
158687
158502
  }
158688
158503
 
158504
+ this.AdvancedSetting=function()
158505
+ {
158506
+
158507
+ }
158508
+
158689
158509
  this.GetRandomText=function(text)
158690
158510
  {
158691
158511
  var ARY_TEXT=["下跌形态","反转十字星","低位档五阳线","倒V型反转","双顶","持续整理形态"];
@@ -165782,7 +165602,7 @@ function HQChartScriptWorker()
165782
165602
 
165783
165603
 
165784
165604
 
165785
- var HQCHART_VERSION="1.1.15103";
165605
+ var HQCHART_VERSION="1.1.15105";
165786
165606
 
165787
165607
  function PrintHQChartVersion()
165788
165608
  {