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.
@@ -6714,12 +6714,6 @@ JSChart.RegisterScriptIndexChart=function(name, option)
6714
6714
  return g_ScriptIndexChartFactory.Add(name, option);
6715
6715
  }
6716
6716
 
6717
- //注册设置对话框类
6718
- //option:{ Create:创建类方法 }
6719
- JSChart.RegisterDialogClass=function(name, option)
6720
- {
6721
- return g_DialogFactory.Add(name, option);
6722
- }
6723
6717
 
6724
6718
  //注册框架类
6725
6719
  JSChart.RegisterChartFrameClass=function(name, option)
@@ -51907,17 +51901,40 @@ function ChartLock()
51907
51901
  if (!out || !IFrameSplitOperator.IsNonEmptyArray(aryText)) return false;
51908
51902
 
51909
51903
  this.Canvas.font=defaultFont;
51910
- var lineHeight=this.Canvas.measureText("擎").width; //行高
51904
+ var defaultLineHeight=this.Canvas.measureText("擎").width; //行高
51905
+ var lineHeight=defaultLineHeight;
51911
51906
  var height=0, width=0;
51912
51907
  out.AryText=[];
51913
51908
  for(var i=0;i<aryText.length;++i)
51914
51909
  {
51915
51910
  var item=aryText[i];
51916
- if (!item || !item.Text) continue;
51917
- var textWidth=this.Canvas.measureText(item.Text).width;
51911
+ if (!item || (!item.Text && !item.Image)) continue;
51912
+ if (item.Image)
51913
+ {
51914
+ textWidth=item.Image.Width;
51915
+ lineHeight=item.Image.Height;
51916
+ }
51917
+ else
51918
+ {
51919
+ if (item.Font)
51920
+ {
51921
+ this.Canvas.font=item.Font;
51922
+ lineHeight=this.Canvas.measureText("擎").width;
51923
+ }
51924
+ else
51925
+ {
51926
+ this.Canvas.font=defaultFont;
51927
+ lineHeight=defaultLineHeight;
51928
+ }
51929
+
51930
+ var textWidth=this.Canvas.measureText(item.Text).width;
51931
+ }
51918
51932
 
51919
51933
  var lineItem={ Text:item.Text, Width:textWidth, Height:lineHeight, Color:item.Color, TextMargin:{ Top:0, Bottom:0, Left:0, Right:0 }, YOffset:0 };
51920
51934
  if (IFrameSplitOperator.IsNumber(item.YOffset)) lineItem.YOffset=item.YOffset;
51935
+ if (item.Font) lineItem.Font=item.Font;
51936
+ if (IFrameSplitOperator.IsNumber(item.Align)) lineItem.Align=item.Align; //左右对齐 0=左 1=中 2=右
51937
+ if (item.Image) lineItem.Image=item.Image;
51921
51938
  if (item.TextMargin)
51922
51939
  {
51923
51940
  var margin=item.TextMargin;
@@ -52041,6 +52058,9 @@ function ChartLock()
52041
52058
  if (item.Color) this.Canvas.fillStyle=item.Color;
52042
52059
  else this.Canvas.fillStyle=this.TextColor;
52043
52060
 
52061
+ if (item.Font) this.Canvas.font = item.Font;
52062
+ else this.Canvas.font = this.Font;
52063
+
52044
52064
  yText+=item.Height;
52045
52065
  this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
52046
52066
  }
@@ -52057,11 +52077,35 @@ function ChartLock()
52057
52077
  for(var i=0;i<outSize.AryText.length;++i)
52058
52078
  {
52059
52079
  var item=outSize.AryText[i];
52060
- if (item.Color) this.Canvas.fillStyle=item.Color;
52061
- else this.Canvas.fillStyle=this.TextColor;
52080
+ if (item.Image)
52081
+ {
52082
+ xText=left;
52083
+ if (item.Align===1)
52084
+ {
52085
+ if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
52086
+ }
52062
52087
 
52063
- yText+=item.Height;
52064
- this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
52088
+ this.Canvas.drawImage(item.Image.Data, xText, yText, item.Image.Width, item.Image.Height);
52089
+
52090
+ yText+=item.Height;
52091
+ }
52092
+ else
52093
+ {
52094
+ if (item.Color) this.Canvas.fillStyle=item.Color;
52095
+ else this.Canvas.fillStyle=this.TextColor;
52096
+
52097
+ if (item.Font) this.Canvas.font = item.Font;
52098
+ else this.Canvas.font = this.Font;
52099
+
52100
+ yText+=item.Height;
52101
+ xText=left;
52102
+ if (item.Align===1)
52103
+ {
52104
+ if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
52105
+ }
52106
+
52107
+ this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
52108
+ }
52065
52109
  }
52066
52110
  }
52067
52111
  }
@@ -105059,239 +105103,9 @@ function IsFundSymbol(symbol)
105059
105103
  return false;
105060
105104
  }
105061
105105
 
105062
- //设置对话框工厂类
105063
- function DialogFactory()
105064
- {
105065
- //[key:name, { Create:function(divElement) { return new class(divElement); }} ]
105066
- this.DataMap=new Map(
105067
- [
105068
- ["ChartPictureSettingMenu", { Create:function(divElement) { return new ChartPictureSettingMenu(divElement); } }],
105069
- ]);
105070
-
105071
- this.Create=function(name, option)
105072
- {
105073
- if (!this.DataMap.has(name))
105074
- {
105075
- JSConsole.Chart.Warn(`[DialogFactory::Create] can't find class=${name}.`);
105076
- return null;
105077
- }
105078
-
105079
- var item=this.DataMap.get(name);
105080
- return item.Create(option);
105081
- }
105082
-
105083
- this.Add=function(name, option)
105084
- {
105085
- this.DataMap.set(name, { Create:option.Create } );
105086
- }
105087
- }
105088
-
105089
- var g_DialogFactory=new DialogFactory();
105090
-
105091
- //设置窗口基类
105092
- function IDivDialog(divElement)
105093
- {
105094
- this.DivElement=divElement; //父节点
105095
- this.ID=null; //div id
105096
- this.TimeOut=null; //定时器
105097
-
105098
- //隐藏窗口
105099
- this.Hide=function()
105100
- {
105101
- $("#"+this.ID).hide();
105102
- }
105103
-
105104
- //显示窗口
105105
- this.Show=function(left,top,width,height)
105106
- {
105107
- var cssData={display:'block'};
105108
- if (IFrameSplitOperator.IsNumber(left)) cssData.left=left+'px';
105109
- if (IFrameSplitOperator.IsNumber(top)) cssData.top=top+'px';
105110
- if (IFrameSplitOperator.IsNumber(width)) cssData.width=width+'px';
105111
- if (IFrameSplitOperator.IsNumber(height)) cssData.height=height+'px';
105112
-
105113
- $("#"+this.ID).css(cssData);
105114
- }
105115
- }
105116
-
105117
- //等待动画窗口
105118
- function WaitDialog(divElement)
105119
- {
105120
- this.newMethod=IDivDialog; //派生
105121
- this.newMethod(divElement);
105122
- delete this.newMethod;
105123
-
105124
- this.Title='加载中......';
105125
- this.Dialog;
105126
-
105127
- //隐藏窗口
105128
- this.Close=function()
105129
- {
105130
- if (this.Dialog)
105131
- {
105132
- this.DivElement.removeChild(this.Dialog);
105133
- this.Dialog=null;
105134
- }
105135
- }
105136
-
105137
- this.SetTitle=function(title)
105138
- {
105139
- this.Title=title;
105140
- if (!this.Dialog) return;
105141
- //TODO: 更新标题数据
105142
- }
105143
-
105144
- this.Create=function()
105145
- {
105146
- this.ID=Guid();
105147
- var div=document.createElement('div');
105148
- div.className='jchart-wait-box';
105149
- div.id=this.ID;
105150
- div.innerHTML=
105151
- `<div class='parameter jchart-kline-match-box'>
105152
- <div class='parameter-header'>
105153
- <span>${this.Title}</span>
105154
- </div>
105155
- </div>`.trim();
105156
-
105157
- this.DivElement.appendChild(div);
105158
- this.Dialog=div;
105159
- }
105160
-
105161
- //显示
105162
- this.DoModal=function(event)
105163
- {
105164
- this.Title=event.data.Title;
105165
- var chart=event.data.Chart;
105166
- if (this.ID==null) this.Create(); //第1次 需要创建div
105167
-
105168
- //居中显示
105169
- var border=chart.Frame.ChartBorder;
105170
- var scrollPos=GetScrollPosition();
105171
- var left=border.GetWidth()/2;
105172
- var top=border.GetHeight()/2;
105173
-
105174
- this.Show(left,top,200,40); //显示
105175
- }
105176
- }
105177
-
105178
- //画图工具 单个图形设置
105179
- function ChartPictureSettingMenu(divElement)
105180
- {
105181
- this.newMethod=IDivDialog; //派生
105182
- this.newMethod(divElement);
105183
- delete this.newMethod;
105184
-
105185
- this.HQChart;
105186
- this.ChartPicture;
105187
- this.SubToolsDiv;
105188
- this.SettingMenu;
105189
- this.SettingPV;
105190
-
105191
- this.DoModal=function(event)
105192
- {
105193
- var $body;
105194
- if (!this.SubToolsDiv)
105195
- {
105196
- this.ID=Guid();
105197
- var div=document.createElement("div");
105198
- div.className='subTolls';
105199
- div.id=this.ID;
105200
- this.DivElement.appendChild(div);
105201
- //$body = $("."+event.data.HQChart.ClassName).context.body;
105202
- //$body.append(div);
105203
- this.SubToolsDiv=div;
105204
- }
105205
- this.HQChart=event.data.HQChart;
105206
- this.ChartPicture=event.data.ChartPicture;
105207
-
105208
- var pixelTatio = GetDevicePixelRatio();
105209
- var frame=this.HQChart.Frame.SubFrame[0].Frame;
105210
- // var top=frame.ChartBorder.GetTopTitle();
105211
- var top=frame.ChartBorder.Top + 40;
105212
- // var right=frame.ChartBorder.GetRight();
105213
- var right=frame.ChartBorder.Right;
105214
- var left=frame.ChartBorder.GetLeft();
105215
- var className = this.ChartPicture.ClassName; //='ChartDrawPictureText'时加“设置”
105216
- var lineColor=this.ChartPicture.LineColor;
105217
- if (lineColor.indexOf("rgb(")==0 || lineColor.indexOf("RGB(")==0)
105218
- lineColor=IChartDrawPicture.RGBToHex(lineColor.toLowerCase());
105219
- var toolsDiv = "";
105220
- if(className === 'ChartDrawPictureText')
105221
- {
105222
- toolsDiv = '<span class="changes-color" title="改变图形颜色">'+
105223
- '<i class="iconfont icon-bianji"></i>'+
105224
- '<input type="color" name="color" id="color" class="change-color" value="'+ lineColor +'">'+
105225
- '</span>\n' +
105226
- '<span class="subtool-set" title="设置"><i class="iconfont icon-shezhi"></i></span>'+
105227
- '<span class="subtool-del"><i class="iconfont icon-recycle_bin"></i></span>';
105228
- }
105229
- else if (className=="ChartDrawVolProfile")
105230
- {
105231
- toolsDiv='<span class="vp-set" title="设置"><i class="iconfont icon-shezhi"></i></span>'+
105232
- '<span class="subtool-del"><i class="iconfont icon-recycle_bin"></i></span>';
105233
- }
105234
- else
105235
- {
105236
- toolsDiv =
105237
- '<p class="changes-color" title="改变图形颜色"><i class="iconfont icon-bianji"></i>' +
105238
- '<input type="color" name="color" id="color" class="change-color" value="'+ lineColor +'"></p>\n' +
105239
- ' <p class="subtool-del"><i class="iconfont icon-recycle_bin"></i></p>';
105240
- }
105241
-
105242
-
105243
- this.SubToolsDiv.style.right = right/pixelTatio + "px";
105244
- this.SubToolsDiv.style.top = top/pixelTatio + "px";
105245
- this.SubToolsDiv.innerHTML = toolsDiv;
105246
- this.SubToolsDiv.style.position = "absolute";
105247
- this.SubToolsDiv.style.display = "block";
105248
-
105249
- var hqChart = this.HQChart;
105250
- var picture = this.ChartPicture;
105251
- var subToolDiv = this.SubToolsDiv;
105252
- $(".subtool-del").click(function(){
105253
- hqChart.SelectChartDrawPicture=null;
105254
- hqChart.ClearChartDrawPicture(picture);
105255
- // subToolDiv.innerHTML = "";
105256
- $(".subTolls").css("display","none");
105257
- });
105258
- var self = this;
105259
- $(".subtool-set").click(function(){
105260
- $(self.SubToolsDiv).hide();
105261
- //创建div设置窗口
105262
- if (!self.SettingMenu) self.SettingMenu=new ChartPictureTextSettingMenu(frame.ChartBorder.UIElement.parentNode);
105263
-
105264
- self.SettingMenu.ChartPicture=picture;
105265
- self.SettingMenu.HQChart=hqChart;
105266
- self.SettingMenu.Position={Left:right + 80,Top:top + 20};
105267
- self.SettingMenu.DoModal();
105268
- });
105269
- $(".changes-color").click(function () {
105270
- document.getElementById('color').click();
105271
- $(".change-color").change(function () {
105272
- var color = $(".change-color").val();
105273
- picture.LineColor = color;
105274
- picture.PointColor = color;
105275
- if (hqChart.ChartDrawStorage) hqChart.ChartDrawStorage.SaveDrawData(picture); //保存下
105276
- });
105277
- });
105278
-
105279
- //成交量分布图设置
105280
- $(".vp-set").click(function()
105281
- {
105282
- if (!self.SettingPV) self.SettingPV=new ChartPictureVolProfileSettingMenu(frame.ChartBorder.UIElement.parentNode);
105283
- self.SettingPV.ChartPicture=picture;
105284
- self.SettingPV.HQChart=hqChart;
105285
- self.SettingPV.Position={Left:right + 80,Top:top + 20};
105286
- self.SettingPV.DoModal();
105287
- });
105288
-
105289
-
105290
- JSConsole.Chart.Log("[ChartPictureSettingMenu::DoModal]", {Top:top,Left:left, Right:right});
105291
- }
105292
- }
105293
105106
 
105294
105107
 
105108
+ /*
105295
105109
  function ChartPictureVolProfileSettingMenu(divElement)
105296
105110
  {
105297
105111
  this.newMethod=IDivDialog; //派生
@@ -105380,6 +105194,7 @@ function ChartPictureVolProfileSettingMenu(divElement)
105380
105194
  }
105381
105195
  }
105382
105196
  }
105197
+ */
105383
105198
 
105384
105199
 
105385
105200
 
@@ -153902,7 +153717,7 @@ function ScrollBarBGChart()
153902
153717
 
153903
153718
 
153904
153719
 
153905
- var HQCHART_VERSION="1.1.15103";
153720
+ var HQCHART_VERSION="1.1.15105";
153906
153721
 
153907
153722
  function PrintHQChartVersion()
153908
153723
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.15103";
8
+ var HQCHART_VERSION="1.1.15105";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {