hqchart 1.1.13577 → 1.1.13584

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.
@@ -15,26 +15,36 @@ function JSScrollBarChart(divElement)
15
15
  {
16
16
  this.DivElement=divElement;
17
17
  this.JSChartContainer; //表格控件
18
-
19
- //h5 canvas
20
- this.CanvasElement=document.createElement("canvas");
21
- this.CanvasElement.className='jsscrollbar-drawing';
22
- this.CanvasElement.id=Guid();
23
- this.CanvasElement.setAttribute("tabindex",0);
24
- if (this.CanvasElement.style) this.CanvasElement.style.outline='none';
25
- if(divElement.hasChildNodes())
26
- {
27
- JSConsole.Chart.Log("[JSScrollBarChart::JSScrollBarChart] divElement hasChildNodes", divElement.childNodes);
28
- }
29
- divElement.appendChild(this.CanvasElement);
18
+ this.ResizeListener;
19
+
20
+ //h5 canvas
21
+ this.CanvasElement=document.createElement("canvas");
22
+ this.CanvasElement.className='jsscrollbar-drawing';
23
+ this.CanvasElement.id=Guid();
24
+ this.CanvasElement.setAttribute("tabindex",0);
25
+ if (this.CanvasElement.style) this.CanvasElement.style.outline='none';
26
+ if(divElement.hasChildNodes())
27
+ {
28
+ JSConsole.Chart.Log("[JSScrollBarChart::JSScrollBarChart] divElement hasChildNodes", divElement.childNodes);
29
+ }
30
+ divElement.appendChild(this.CanvasElement);
30
31
 
31
32
 
32
33
  this.OnSize=function()
33
34
  {
34
35
  //画布大小通过div获取
35
- var height=parseInt(this.DivElement.style.height.replace("px",""));
36
+ var height=this.DivElement.offsetHeight;
37
+ var width=this.DivElement.offsetWidth;
38
+ if (this.DivElement.style.height && this.DivElement.style.width)
39
+ {
40
+ if (this.DivElement.style.height.includes("px"))
41
+ height=parseInt(this.DivElement.style.height.replace("px",""));
42
+ if (this.DivElement.style.width.includes("px"))
43
+ width=parseInt(this.DivElement.style.width.replace("px",""));
44
+ }
45
+
36
46
  this.CanvasElement.height=height;
37
- this.CanvasElement.width=parseInt(this.DivElement.style.width.replace("px",""));
47
+ this.CanvasElement.width=width;
38
48
  this.CanvasElement.style.width=this.CanvasElement.width+'px';
39
49
  this.CanvasElement.style.height=this.CanvasElement.height+'px';
40
50
 
@@ -56,12 +66,14 @@ function JSScrollBarChart(divElement)
56
66
 
57
67
  if (!chart) return false;
58
68
 
69
+ this.JSChartContainer=chart;
70
+ this.DivElement.JSChart=this; //div中保存一份
71
+
72
+ if (option.EnableResize==true) this.CreateResizeListener();
73
+
59
74
  if (option.OnCreatedCallback) option.OnCreatedCallback(chart);
60
75
 
61
76
  chart.Draw();
62
-
63
- this.JSChartContainer=chart;
64
- this.DivElement.JSChart=this; //div中保存一份
65
77
  }
66
78
 
67
79
  this.CreateJSScrollBarChartContainer=function(option)
@@ -106,6 +118,18 @@ function JSScrollBarChart(divElement)
106
118
  if (IFrameSplitOperator.IsBool(item.AutoRight)) chart.AutoMargin.Right=item.AutoRight;
107
119
  }
108
120
 
121
+ this.CreateResizeListener=function()
122
+ {
123
+ this.ResizeListener = new ResizeObserver((entries)=>{ this.OnDivResize(entries); });
124
+ this.ResizeListener.observe(this.DivElement);
125
+ }
126
+
127
+ this.OnDivResize=function(entries)
128
+ {
129
+ JSConsole.Chart.Log("[JSScrollBarChart::OnDivResize] entries=", entries);
130
+ this.OnSize( );
131
+ }
132
+
109
133
  /////////////////////////////////////////////////////////////////////////////
110
134
  //对外接口
111
135
 
@@ -251,6 +275,11 @@ function JSScrollBarChartContainer(uielement)
251
275
  this.IsDestroy=true;
252
276
  }
253
277
 
278
+ this.GetHQChart=function()
279
+ {
280
+ return this.HQChart;
281
+ }
282
+
254
283
  //设置事件回调
255
284
  //{event:事件id, callback:回调函数}
256
285
  this.AddEventCallback=function(object)
@@ -329,6 +358,36 @@ function JSScrollBarChartContainer(uielement)
329
358
  //this.UIElement.ontouchend=(e)=> {this.OnTouchEnd(e); }
330
359
  }
331
360
 
361
+ //创建一个图形
362
+ this.CreateChartPaint=function(name)
363
+ {
364
+ var chart=g_ChartPaintFactory.Create(name);
365
+ if (!chart) return null;
366
+
367
+ chart.ChartFrame=this.Frame;
368
+ chart.ChartBorder=this.Frame.ChartBorder;
369
+ chart.Canvas=this.Canvas;
370
+ chart.Data=this.Frame.Data;
371
+ chart.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
372
+ chart.GetHQChartCallback=()=>{ return this.GetHQChart(); }
373
+
374
+ return chart;
375
+ }
376
+
377
+ this.GetChartPaintByClassName=function(name)
378
+ {
379
+ for(var i=0; i<this.ChartPaint.length; ++i)
380
+ {
381
+ var item=this.ChartPaint[i];
382
+ if (item.ClassName==name)
383
+ {
384
+ return { Chart:item, Index:i };
385
+ }
386
+ }
387
+
388
+ return null;
389
+ }
390
+
332
391
  this.Draw=function()
333
392
  {
334
393
  if (this.UIElement.width<=0 || this.UIElement.height<=0) return;
@@ -627,8 +627,29 @@ function GetBlackStyle()
627
627
  CheckBox:
628
628
  {
629
629
  Family:"iconfont", Size:15,
630
- Checked:{ Color:"rgb(237,60,31)", Symbol:"\ue6b3", DisableColor:"rgb(112,128,144)" },
631
- Unchecked:{ Color:"rgb(237,60,31)", Symbol:"\ue6b4", DisableColor:"rgb(112,128,144)" },
630
+ Checked:{ Color:"rgb(69,147,238)", Symbol:"\ue6b3", DisableColor:"rgb(120,120,120)", MouseOnColor:"rgb(69,147,238)" },
631
+ Unchecked:{ Color:"rgb(210,210,210)", Symbol:"\ue6b4", DisableColor:"rgb(120,120,120)", MouseOnColor:"rgb(69,147,238)" },
632
+ },
633
+
634
+ Link:
635
+ {
636
+ Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
637
+ TextColor:"rgb(0,144,255)",
638
+
639
+ Disable:{ TextColor:"rgb(211,211,211)" },
640
+ MouseOn:{ TextColor:"rgb(0,144,255)" },
641
+ },
642
+
643
+ ProgressBar:
644
+ {
645
+ BGColor:"rgb(20,24,28)",
646
+ BarColor:"rgb(47,124,197)",
647
+ Margin:{ Left:2, Right:2, Bottom:2, Top:2 },
648
+ BarMargin:{ Left:2, Right:2, Bottom:2, Top:2 },
649
+ TextColor:"rgb(230,230,230)",
650
+ Font:`${12*GetDevicePixelRatio()}px 微软雅黑`,
651
+ TextMargin:{ Left:40, Right:2, Bottom:2, Top:2},
652
+ Disable:{ BGColor:"rgb(61,61,61)", BarColor:"rgb(131,131,131)", TextColor:"rgb(159,161,159)"}
632
653
  }
633
654
  },
634
655