
                <html><style>body { overflow:hidden;}
            h1 { font-family: Arial, sans-serif; font-size: 24px; color: #44a; }
            p { margin:0; padding:0; }
            br  { margin:0; padding:0; }
            .line { 
                white-space: nowrap;
                height:16px; 
            }
            .line>span { 
                display:inline-block; background-color:#eef; height:100%; 
                margin: 0 5px 0 0; padding-right: 5px; color:#999;   
            }
            comment {color: #080;} module {color: #804;} 
            quote {color: #008;} comment>quote {color: #080;}
            .listing { margin: 10px; border: 1px solid #ccc; 
                    font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace;
                    font-size: 14px;  
                    overflow:scroll;
                    height:90%;
            }
            code { padding: 5px 0;}</style></html><body>
                <h1>src/Chart.ts</h1>
                <div class='listing'><code><p id=1 class="line"><span>&nbsp;&nbsp;&nbsp;1</span><comment>/**</comment></p>
<p id=2 class="line"><span>&nbsp;&nbsp;&nbsp;2</span><comment>&nbsp;*&nbsp;#&nbsp;Chart</comment></p>
<p id=3 class="line"><span>&nbsp;&nbsp;&nbsp;3</span><comment>&nbsp;*&nbsp;renders&nbsp;the&nbsp;chart&nbsp;background&nbsp;and&nbsp;title.</comment></p>
<p id=4 class="line"><span>&nbsp;&nbsp;&nbsp;4</span><comment>&nbsp;*&nbsp;</comment></p>
<p id=5 class="line"><span>&nbsp;&nbsp;&nbsp;5</span><comment>&nbsp;*&nbsp;###&nbsp;Attributes</comment></p>
<p id=6 class="line"><span>&nbsp;&nbsp;&nbsp;6</span><comment>&nbsp;*&nbsp;The&nbsp;`Chart`&nbsp;class&nbsp;is&nbsp;called&nbsp;by&nbsp;{@link&nbsp;Graph.Graph&nbsp;`Graph`}&nbsp;as&nbsp;</comment></p>
<p id=7 class="line"><span>&nbsp;&nbsp;&nbsp;7</span><comment>&nbsp;*&nbsp;`m(Chart,&nbsp;{&nbsp;cfg:cfg.chart,&nbsp;plotArea:plotArea&nbsp;})`</comment></p>
<p id=8 class="line"><span>&nbsp;&nbsp;&nbsp;8</span><comment>&nbsp;*&nbsp;with&nbsp;the&nbsp;following&nbsp;attributes:</comment></p>
<p id=9 class="line"><span>&nbsp;&nbsp;&nbsp;9</span><comment>&nbsp;*&nbsp;-&nbsp;cfg:&nbsp;a&nbsp;{@link&nbsp;Chart.ChartConfig&nbsp;ChartConfig}&nbsp;object</comment></p>
<p id=10 class="line"><span>&nbsp;&nbsp;10</span><comment>&nbsp;*&nbsp;-&nbsp;plotArea:&nbsp;a&nbsp;{@link&nbsp;SVGElem.Rect&nbsp;Rect&nbsp;}&nbsp;object&nbsp;for&nbsp;plotting&nbsp;the&nbsp;chart&nbsp;background</comment></p>
<p id=11 class="line"><span>&nbsp;&nbsp;11</span><comment>&nbsp;*&nbsp;</comment></p>
<p id=12 class="line"><span>&nbsp;&nbsp;12</span><comment>&nbsp;*&nbsp;###&nbsp;Configurations&nbsp;and&nbsp;Defaults</comment></p>
<p id=13 class="line"><span>&nbsp;&nbsp;13</span><comment>&nbsp;*&nbsp;See&nbsp;{@link&nbsp;Chart.Chart.defaultConfig&nbsp;Chart.defaultConfig}</comment></p>
<p id=14 class="line"><span>&nbsp;&nbsp;14</span><comment>&nbsp;*/</comment></p>
<p id=15 class="line"><span>&nbsp;&nbsp;15</span></p>
<p id=16 class="line"><span>&nbsp;&nbsp;16</span>&nbsp;<comment>/**&nbsp;*/</comment></p>
<p id=17 class="line"><span>&nbsp;&nbsp;17</span>&nbsp;export&nbsp;const&nbsp;m&nbsp;=&nbsp;require(<quote>"mithril"</quote>);</p>
<p id=18 class="line"><span>&nbsp;&nbsp;18</span>&nbsp;export&nbsp;type&nbsp;Vnode&nbsp;=&nbsp;typeof&nbsp;m.Vnode;</p>
<p id=19 class="line"><span>&nbsp;&nbsp;19</span>&nbsp;import&nbsp;{&nbsp;Config,&nbsp;</p>
<p id=20 class="line"><span>&nbsp;&nbsp;20</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LabelCfg,</p>
<p id=21 class="line"><span>&nbsp;&nbsp;21</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VisibleCfg&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;<quote>'./Graph'</quote>;</p>
<p id=22 class="line"><span>&nbsp;&nbsp;22</span>import&nbsp;{&nbsp;SVGElem,&nbsp;&nbsp;Rect&nbsp;}&nbsp;&nbsp;&nbsp;from&nbsp;<quote>'./SVGElem'</quote>;</p>
<p id=23 class="line"><span>&nbsp;&nbsp;23</span></p>
<p id=24 class="line"><span>&nbsp;&nbsp;24</span></p>
<p id=25 class="line"><span>&nbsp;&nbsp;25</span><comment>/**&nbsp;Defines&nbsp;configurable&nbsp;settings.&nbsp;*/</comment></p>
<p id=26 class="line"><span>&nbsp;&nbsp;26</span>export&nbsp;interface&nbsp;ChartConfig&nbsp;extends&nbsp;VisibleCfg&nbsp;{</p>
<p id=27 class="line"><span>&nbsp;&nbsp;27</span>&nbsp;&nbsp;&nbsp;&nbsp;<comment>/**&nbsp;the&nbsp;title&nbsp;text&nbsp;and&nbsp;positioning&nbsp;&nbsp;*/</comment></p>
<p id=28 class="line"><span>&nbsp;&nbsp;28</span>&nbsp;&nbsp;&nbsp;&nbsp;title:&nbsp;&nbsp;LabelCfg;</p>
<p id=29 class="line"><span>&nbsp;&nbsp;29</span>}</p>
<p id=30 class="line"><span>&nbsp;&nbsp;30</span></p>
<p id=31 class="line"><span>&nbsp;&nbsp;31</span><comment>/**</comment></p>
<p id=32 class="line"><span>&nbsp;&nbsp;32</span><comment>&nbsp;*&nbsp;Renders&nbsp;the&nbsp;chart&nbsp;background&nbsp;and&nbsp;title.</comment></p>
<p id=33 class="line"><span>&nbsp;&nbsp;33</span><comment>&nbsp;*/</comment></p>
<p id=34 class="line"><span>&nbsp;&nbsp;34</span>export&nbsp;class&nbsp;Chart&nbsp;extends&nbsp;SVGElem&nbsp;{&nbsp;</p>
<p id=35 class="line"><span>&nbsp;&nbsp;35</span>&nbsp;&nbsp;&nbsp;&nbsp;<comment>/**&nbsp;</comment></p>
<p id=36 class="line"><span>&nbsp;&nbsp;36</span><comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Defines&nbsp;default&nbsp;values&nbsp;for&nbsp;display&nbsp;elements&nbsp;in&nbsp;`Chart`</comment></p>
<p id=37 class="line"><span>&nbsp;&nbsp;37</span><comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;See&nbsp;{@link&nbsp;Graph.Graph.makeConfig&nbsp;Graph.makeConfig}&nbsp;for&nbsp;the&nbsp;sequence&nbsp;of&nbsp;initializations.</comment></p>
<p id=38 class="line"><span>&nbsp;&nbsp;38</span><comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</comment></p>
<p id=39 class="line"><span>&nbsp;&nbsp;39</span><comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;###&nbsp;Configurations&nbsp;and&nbsp;Defaults</comment></p>
<p id=40 class="line"><span>&nbsp;&nbsp;40</span><comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;```</comment></p>
<p id=41 class="line"><span>&nbsp;&nbsp;41</span><comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;cfg.chart&nbsp;=&nbsp;{@link&nbsp;Chart.ChartConfig&nbsp;<ChartConfig>}{</comment></p>
<p id=42 class="line"><span>&nbsp;&nbsp;42</span><comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;visible:&nbsp;true,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;Chart&nbsp;area&nbsp;is&nbsp;visible</comment></comment></p>
<p id=43 class="line"><span>&nbsp;&nbsp;43</span><comment><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;title:&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;the&nbsp;chart&nbsp;title</comment></comment></p>
<p id=44 class="line"><span>&nbsp;&nbsp;44</span><comment><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;visible:&nbsp;true,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;Chart&nbsp;title&nbsp;is&nbsp;visible</comment></comment></p>
<p id=45 class="line"><span>&nbsp;&nbsp;45</span><comment><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;text:<quote>''</quote>,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;the&nbsp;sting&nbsp;to&nbsp;display</comment></comment></p>
<p id=46 class="line"><span>&nbsp;&nbsp;46</span><comment><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hOffset:&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;horizontal&nbsp;label&nbsp;offset&nbsp;in&nbsp;<quote>'em'</quote></comment></comment></p>
<p id=47 class="line"><span>&nbsp;&nbsp;47</span><comment><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vOffset:&nbsp;-1.5,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;vertical&nbsp;label&nbsp;offset&nbsp;in&nbsp;<quote>'em'</quote></comment></comment></p>
<p id=48 class="line"><span>&nbsp;&nbsp;48</span><comment><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xpos:<quote>'middle'</quote>,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;start&nbsp;|&nbsp;middle&nbsp;|&nbsp;end;&nbsp;hor.&nbsp;title&nbsp;position:&nbsp;0-100%,&nbsp;rel.&nbsp;to&nbsp;Chart</comment></comment></p>
<p id=49 class="line"><span>&nbsp;&nbsp;49</span><comment><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ypos:<quote>'top'</quote>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;top&nbsp;|&nbsp;center&nbsp;|&nbsp;bottom&nbsp;ver.&nbsp;title&nbsp;position:&nbsp;0-100%,&nbsp;rel.&nbsp;to&nbsp;Chart</comment></comment></p>
<p id=50 class="line"><span>&nbsp;&nbsp;50</span><comment><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;</comment></p>
<p id=51 class="line"><span>&nbsp;&nbsp;51</span><comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;}&nbsp;</comment></p>
<p id=52 class="line"><span>&nbsp;&nbsp;52</span><comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;```&nbsp;</comment></p>
<p id=53 class="line"><span>&nbsp;&nbsp;53</span><comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;cfg&nbsp;the&nbsp;configuration&nbsp;object,&nbsp;containing&nbsp;default&nbsp;settings&nbsp;for&nbsp;all&nbsp;</comment></p>
<p id=54 class="line"><span>&nbsp;&nbsp;54</span><comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;previously&nbsp;configured&nbsp;components.</comment></p>
<p id=55 class="line"><span>&nbsp;&nbsp;55</span><comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</comment></p>
<p id=56 class="line"><span>&nbsp;&nbsp;56</span>&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;defaultConfig(cfg:Config)&nbsp;{</p>
<p id=57 class="line"><span>&nbsp;&nbsp;57</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cfg.chart&nbsp;=&nbsp;<ChartConfig>{</p>
<p id=58 class="line"><span>&nbsp;&nbsp;58</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;visible:&nbsp;true,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;Chart&nbsp;area&nbsp;is&nbsp;visible</comment></p>
<p id=59 class="line"><span>&nbsp;&nbsp;59</span><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;title:&nbsp;&nbsp;<LabelCfg>{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;the&nbsp;chart&nbsp;title</comment></p>
<p id=60 class="line"><span>&nbsp;&nbsp;60</span><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;visible:&nbsp;true,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;Chart&nbsp;title&nbsp;is&nbsp;visible</comment></p>
<p id=61 class="line"><span>&nbsp;&nbsp;61</span><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;text:<quote>''</quote>,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;the&nbsp;sting&nbsp;to&nbsp;display</comment></p>
<p id=62 class="line"><span>&nbsp;&nbsp;62</span><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hOffset:&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;horizontal&nbsp;label&nbsp;offset&nbsp;in&nbsp;<quote>'em'</quote></comment></p>
<p id=63 class="line"><span>&nbsp;&nbsp;63</span><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vOffset:&nbsp;-1.5,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;vertical&nbsp;label&nbsp;offset&nbsp;in&nbsp;<quote>'em'</quote></comment></p>
<p id=64 class="line"><span>&nbsp;&nbsp;64</span><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xpos:<quote>'middle'</quote>,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;hor.&nbsp;title&nbsp;position:&nbsp;0-100%,&nbsp;rel.&nbsp;to&nbsp;Chart</comment></p>
<p id=65 class="line"><span>&nbsp;&nbsp;65</span><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ypos:<quote>'top'</quote>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;ver.&nbsp;title&nbsp;position:&nbsp;0-100%,&nbsp;rel.&nbsp;to&nbsp;Chart</comment></p>
<p id=66 class="line"><span>&nbsp;&nbsp;66</span><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p id=67 class="line"><span>&nbsp;&nbsp;67</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};</p>
<p id=68 class="line"><span>&nbsp;&nbsp;68</span>&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;cfg;</p>
<p id=69 class="line"><span>&nbsp;&nbsp;69</span>&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p id=70 class="line"><span>&nbsp;&nbsp;70</span></p>
<p id=71 class="line"><span>&nbsp;&nbsp;71</span>&nbsp;&nbsp;&nbsp;&nbsp;<comment>/**</comment></p>
<p id=72 class="line"><span>&nbsp;&nbsp;72</span><comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Makes&nbsp;adjustments&nbsp;to&nbsp;cfg&nbsp;based&nbsp;on&nbsp;current&nbsp;settings</comment></p>
<p id=73 class="line"><span>&nbsp;&nbsp;73</span><comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;cfg&nbsp;the&nbsp;configuration&nbsp;object,&nbsp;containing&nbsp;default&nbsp;settings&nbsp;for&nbsp;all&nbsp;components</comment></p>
<p id=74 class="line"><span>&nbsp;&nbsp;74</span><comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</comment></p>
<p id=75 class="line"><span>&nbsp;&nbsp;75</span>&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;adjustConfig(cfg:Config)&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p id=76 class="line"><span>&nbsp;&nbsp;76</span>&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p id=77 class="line"><span>&nbsp;&nbsp;77</span>&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p id=78 class="line"><span>&nbsp;&nbsp;78</span>&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;clientWidth:number;</p>
<p id=79 class="line"><span>&nbsp;&nbsp;79</span>&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;clientHeight:number;</p>
<p id=80 class="line"><span>&nbsp;&nbsp;80</span></p>
<p id=81 class="line"><span>&nbsp;&nbsp;81</span>&nbsp;&nbsp;&nbsp;&nbsp;onupdate(node?:&nbsp;Vnode)&nbsp;{&nbsp;</p>
<p id=82 class="line"><span>&nbsp;&nbsp;82</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.updateTitleSize(node);</p>
<p id=83 class="line"><span>&nbsp;&nbsp;83</span><comment>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m.redraw();</comment></p>
<p id=84 class="line"><span>&nbsp;&nbsp;84</span><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p id=85 class="line"><span>&nbsp;&nbsp;85</span></p>
<p id=86 class="line"><span>&nbsp;&nbsp;86</span>&nbsp;&nbsp;&nbsp;&nbsp;updateTitleSize(node:&nbsp;Vnode)&nbsp;{</p>
<p id=87 class="line"><span>&nbsp;&nbsp;87</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<comment>//&nbsp;get&nbsp;clientWidth&nbsp;/Height&nbsp;of&nbsp;title</comment></p>
<p id=88 class="line"><span>&nbsp;&nbsp;88</span><comment></comment>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(node.dom)&nbsp;{</p>
<p id=89 class="line"><span>&nbsp;&nbsp;89</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;c&nbsp;=&nbsp;node.dom.lastChild;</p>
<p id=90 class="line"><span>&nbsp;&nbsp;90</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(c&nbsp;&&&nbsp;c.clientWidth>0)&nbsp;{</p>
<p id=91 class="line"><span>&nbsp;&nbsp;91</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(Chart.clientWidth&nbsp;!==&nbsp;c.clientWidth)&nbsp;{</p>
<p id=92 class="line"><span>&nbsp;&nbsp;92</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Chart.clientWidth&nbsp;=&nbsp;c.clientWidth;</p>
<p id=93 class="line"><span>&nbsp;&nbsp;93</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Chart.clientHeight&nbsp;=&nbsp;c.clientHeight;</p>
<p id=94 class="line"><span>&nbsp;&nbsp;94</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p id=95 class="line"><span>&nbsp;&nbsp;95</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p id=96 class="line"><span>&nbsp;&nbsp;96</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p id=97 class="line"><span>&nbsp;&nbsp;97</span>&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p id=98 class="line"><span>&nbsp;&nbsp;98</span></p>
<p id=99 class="line"><span>&nbsp;&nbsp;99</span>&nbsp;&nbsp;&nbsp;&nbsp;drawBackground(plotArea:Rect)&nbsp;{</p>
<p id=100 class="line"><span>&nbsp;100</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;tl&nbsp;=&nbsp;plotArea.tl;</p>
<p id=101 class="line"><span>&nbsp;101</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;br&nbsp;=&nbsp;plotArea.br;</p>
<p id=102 class="line"><span>&nbsp;102</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;this.rect({x:tl.x,&nbsp;y:tl.y},&nbsp;{w:&nbsp;br.x-tl.x,&nbsp;h:&nbsp;br.y-tl.y},<quote>''</quote>);</p>
<p id=103 class="line"><span>&nbsp;103</span>&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p id=104 class="line"><span>&nbsp;104</span></p>
<p id=105 class="line"><span>&nbsp;105</span>&nbsp;&nbsp;&nbsp;&nbsp;drawTitle(plotArea:Rect,&nbsp;cfg:ChartConfig)&nbsp;{</p>
<p id=106 class="line"><span>&nbsp;106</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;tl&nbsp;=&nbsp;plotArea.tl;</p>
<p id=107 class="line"><span>&nbsp;107</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;br&nbsp;=&nbsp;plotArea.br;</p>
<p id=108 class="line"><span>&nbsp;108</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cfg.title.cssClass&nbsp;=&nbsp;<quote>'hs-graph-chart-title'</quote>;</p>
<p id=109 class="line"><span>&nbsp;109</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch(cfg.title.xpos)&nbsp;{</p>
<p id=110 class="line"><span>&nbsp;110</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;<quote>'start'</quote>:&nbsp;&nbsp;&nbsp;cfg.title.x&nbsp;=&nbsp;tl.x+<quote>''</quote>;&nbsp;&nbsp;&nbsp;break;</p>
<p id=111 class="line"><span>&nbsp;111</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;<quote>'middle'</quote>:&nbsp;&nbsp;cfg.title.x&nbsp;=&nbsp;(tl.x+br.x)/2+<quote>''</quote>;&nbsp;&nbsp;break;</p>
<p id=112 class="line"><span>&nbsp;112</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;<quote>'end'</quote>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cfg.title.x&nbsp;=&nbsp;br.x+<quote>''</quote>;&nbsp;break;</p>
<p id=113 class="line"><span>&nbsp;113</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p id=114 class="line"><span>&nbsp;114</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch(cfg.title.ypos)&nbsp;{</p>
<p id=115 class="line"><span>&nbsp;115</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;<quote>'top'</quote>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cfg.title.y&nbsp;=&nbsp;tl.y+<quote>''</quote>;&nbsp;&nbsp;&nbsp;break;</p>
<p id=116 class="line"><span>&nbsp;116</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;<quote>'center'</quote>:&nbsp;&nbsp;cfg.title.y&nbsp;=&nbsp;(tl.y+br.y)/2+<quote>''</quote>;&nbsp;&nbsp;break;</p>
<p id=117 class="line"><span>&nbsp;117</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case&nbsp;<quote>'bottom'</quote>:&nbsp;&nbsp;cfg.title.y&nbsp;=&nbsp;br.y+<quote>''</quote>;&nbsp;break;</p>
<p id=118 class="line"><span>&nbsp;118</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p id=119 class="line"><span>&nbsp;119</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;!cfg.title.visible?&nbsp;undefined&nbsp;:&nbsp;this.text(cfg.title,&nbsp;cfg.title.text);</p>
<p id=120 class="line"><span>&nbsp;120</span>&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p id=121 class="line"><span>&nbsp;121</span></p>
<p id=122 class="line"><span>&nbsp;122</span>&nbsp;&nbsp;&nbsp;&nbsp;view(node?:&nbsp;Vnode):&nbsp;Vnode&nbsp;{</p>
<p id=123 class="line"><span>&nbsp;123</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;cfg:ChartConfig&nbsp;=&nbsp;node.attrs.cfg;</p>
<p id=124 class="line"><span>&nbsp;124</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;plotArea:Rect&nbsp;=&nbsp;node.attrs.plotArea;</p>
<p id=125 class="line"><span>&nbsp;125</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;m(<quote>'svg'</quote>,&nbsp;{&nbsp;class:<quote>'hs-graph-chart'</quote>},&nbsp;[</p>
<p id=126 class="line"><span>&nbsp;126</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.drawBackground(plotArea),</p>
<p id=127 class="line"><span>&nbsp;127</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.drawTitle(plotArea,&nbsp;cfg)</p>
<p id=128 class="line"><span>&nbsp;128</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]);</p>
<p id=129 class="line"><span>&nbsp;129</span>&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p id=130 class="line"><span>&nbsp;130</span>}</p>
<p id=131 class="line"><span>&nbsp;131</span></p>
<p id=132 class="line"><span>&nbsp;132</span></p></code></div>
                </body>
            