| 1 |
%% |
| 2 |
%% This is file `timechart.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% timechart.dtx (with options: `package') |
| 8 |
%% |
| 9 |
%% This is a generated file. |
| 10 |
%% |
| 11 |
%% Copyright (C) 2025 Alan J. Cain |
| 12 |
%% |
| 13 |
%% This file may be distributed and/or modified under the |
| 14 |
%% conditions of the LaTeX Project Public Licence, either |
| 15 |
%% version 1.3c of this licence or (at your option) any later |
| 16 |
%% version. The latest version of this licence is in: |
| 17 |
%% |
| 18 |
%% http://www.latex-project.org/lppl.txt |
| 19 |
%% |
| 20 |
%% and version 1.3c or later is part of all distributions of |
| 21 |
%% LaTeX version 2008-05-04 or later. |
| 22 |
%% |
| 23 |
\NeedsTeXFormat{LaTeX2e}[2020-02-02] |
| 24 |
\ProvidesExplPackage{timechart}{2025-10-17}{0.56.1} |
| 25 |
{Typesetting chronological charts} |
| 26 |
\cs_new:Npn \__timechart_debug_real:n #1 |
| 27 |
{ |
| 28 |
\typeout{timechart:~#1} |
| 29 |
} |
| 30 |
\cs_set_eq:NN\__timechart_debug:n\use_none:n |
| 31 |
\RequirePackage{tikz} |
| 32 |
\bool_new:N\l__timechart_tmpa_bool |
| 33 |
\bool_new:N\l__timechart_tmpb_bool |
| 34 |
\bool_new:N\l__timechart_tmpc_bool |
| 35 |
\bool_new:N\l__timechart_tmpd_bool |
| 36 |
\cs_set_eq:NN\l__timechart_tmpa_dim\l_tmpa_dim |
| 37 |
\cs_set_eq:NN\l__timechart_tmpb_dim\l_tmpb_dim |
| 38 |
\dim_new:N\l__timechart_tmpc_dim |
| 39 |
\dim_new:N\l__timechart_tmpd_dim |
| 40 |
\cs_new:Npn\__timechart_make_ref:NN #1#2 |
| 41 |
{ |
| 42 |
\str_if_empty:NTF #1 |
| 43 |
{ #2 } |
| 44 |
{ \hyperref[#1]{#2} } |
| 45 |
} |
| 46 |
\cs_new:Npn\__timechart_pgfmathsetbool:nn #1#2 |
| 47 |
{ |
| 48 |
\pgfmathsetmacro{#1}{ifthenelse(#2,"\c_true_bool","\c_false_bool")} |
| 49 |
} |
| 50 |
\cs_new:Npn\__timechart_if_equal:nnF #1#2#3 |
| 51 |
{ |
| 52 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool}{#1==#2} |
| 53 |
\bool_if:NF\l__timechart_tmpa_bool{#3} |
| 54 |
} |
| 55 |
\cs_new:Npn\__timechart_pgfextractxy:nnn #1#2#3 |
| 56 |
{ |
| 57 |
\pgf@process{#3} |
| 58 |
#1=\pgf@x\relax |
| 59 |
#2=\pgf@y\relax |
| 60 |
} |
| 61 |
\cs_new:Npn\__timechart_hsmash_pgfnode:nnnnn #1#2#3#4#5 |
| 62 |
{ |
| 63 |
\pgfinterruptboundingbox |
| 64 |
\pgfnode{#1}{#2}{#3}{#4}{#5} |
| 65 |
\pgfcoordinate |
| 66 |
{__timechart_tmpa_coord} |
| 67 |
{\pgfpointanchor{current~bounding~box}{south}} |
| 68 |
\pgfcoordinate |
| 69 |
{__timechart_tmpb_coord} |
| 70 |
{\pgfpointanchor{current~bounding~box}{north}} |
| 71 |
\endpgfinterruptboundingbox |
| 72 |
\pgfextractx |
| 73 |
{\l__timechart_tmpa_dim} |
| 74 |
{\pgfpointanchor{__timechart_tmpa_coord}{center}} |
| 75 |
\pgfextractx |
| 76 |
{\l__timechart_tmpb_dim} |
| 77 |
{\pgfpointanchor{__timechart_tmpb_coord}{center}} |
| 78 |
\pgfpathmoveto{\pgfpoint{\l__timechart_tmpa_dim}{0}} |
| 79 |
\pgfpathmoveto{\pgfpoint{\l__timechart_tmpb_dim}{0}} |
| 80 |
\pgfusepath{discard} |
| 81 |
} |
| 82 |
\cs_new:Npn\__timechart_make_rectangle_node:nnnn #1#2#3#4 |
| 83 |
{ |
| 84 |
\group_begin: |
| 85 |
\__timechart_pgfextractxy:nnn |
| 86 |
{\l__timechart_tmpa_dim}{\l__timechart_tmpb_dim}{#1} |
| 87 |
\__timechart_pgfextractxy:nnn |
| 88 |
{\l__timechart_tmpc_dim}{\l__timechart_tmpd_dim}{#2} |
| 89 |
\pgftransformshift{#1} |
| 90 |
\pgfset{ |
| 91 |
minimum~width=\l__timechart_tmpc_dim-\l__timechart_tmpa_dim, |
| 92 |
minimum~height=\l__timechart_tmpd_dim-\l__timechart_tmpb_dim, |
| 93 |
inner~sep=0, |
| 94 |
outer~sep=0, |
| 95 |
} |
| 96 |
\bool_if:NTF #4 |
| 97 |
{ \pgfnode{rectangle}{south~west}{}{#3}{\pgfusepath{draw}} } |
| 98 |
{ \pgfnode{rectangle}{south~west}{}{#3}{\pgfusepath{discard}} } |
| 99 |
\group_end: |
| 100 |
} |
| 101 |
\cs_new:Npn\__timechart_set_style_line_width:nn #1#2 |
| 102 |
{ |
| 103 |
\begingroup |
| 104 |
\tikzset{#2} |
| 105 |
\pgfmathsetlengthmacro{#1}{\pgflinewidth} |
| 106 |
\pgfmathsmuggle #1 |
| 107 |
\endgroup |
| 108 |
} |
| 109 |
\pgfkeys{ |
| 110 |
/timechart/.cd, |
| 111 |
debug/.code = { |
| 112 |
\cs_set_eq:NN\__timechart_debug:n\__timechart_debug_real:n |
| 113 |
}, |
| 114 |
no~debug/.code = { |
| 115 |
\cs_set_eq:NN\__timechart_debug:n\use_none:n |
| 116 |
}, |
| 117 |
width/.initial=\textwidth, |
| 118 |
ystep/.initial=-10pt, |
| 119 |
minor~tick~interval/.initial=10, |
| 120 |
major~tick~interval/.initial=50, |
| 121 |
tolerance~start/.initial=5pt, |
| 122 |
tolerance~finish/.initial=5pt, |
| 123 |
beyond~length~start/.initial=5pt, |
| 124 |
beyond~length~finish/.initial=5pt, |
| 125 |
beyond~x~radius~start/.initial=4pt, |
| 126 |
beyond~x~radius~finish/.initial=4pt, |
| 127 |
tolerance/.code = { |
| 128 |
\pgfkeyssetvalue{/timechart/tolerance~start}{#1} |
| 129 |
\pgfkeyssetvalue{/timechart/tolerance~finish}{#1} |
| 130 |
}, |
| 131 |
beyond~length/.code = { |
| 132 |
\pgfkeyssetvalue{/timechart/beyond~length~start}{#1} |
| 133 |
\pgfkeyssetvalue{/timechart/beyond~length~finish}{#1} |
| 134 |
}, |
| 135 |
beyond~x~radius/.code = { |
| 136 |
\pgfkeyssetvalue{/timechart/beyond~x~radius~start}{#1} |
| 137 |
\pgfkeyssetvalue{/timechart/beyond~x~radius~finish}{#1} |
| 138 |
}, |
| 139 |
no~grid/.code = { \bool_set_false:N\l__timechart_grid_bool }, |
| 140 |
grid~top~ysep/.initial={3pt}, |
| 141 |
grid~bottom~ysep/.initial={3pt}, |
| 142 |
grid/.style={}, |
| 143 |
axis~line/.style={ |
| 144 |
line~cap=rect, |
| 145 |
}, |
| 146 |
axis~ysep/.initial=3pt, |
| 147 |
axis/.is~choice, |
| 148 |
axis/none/.code |
| 149 |
= { \int_set:Nn\l__timechart_axis_int{0} }, |
| 150 |
axis/above/.code |
| 151 |
= { \int_set:Nn\l__timechart_axis_int{1} }, |
| 152 |
axis/below/.code |
| 153 |
= { \int_set:Nn\l__timechart_axis_int{2} }, |
| 154 |
no~axis/.code = { \int_set:Nn\l__timechart_axis_int{0} }, |
| 155 |
minor~tick/.style={}, |
| 156 |
minor~tick~length/.initial=1.5mm, |
| 157 |
major~tick/.style={}, |
| 158 |
major~tick~length/.initial=3mm, |
| 159 |
major~tick~label/.style={ |
| 160 |
inner~sep=0, |
| 161 |
outer~sep=0, |
| 162 |
anchor=mid~west, |
| 163 |
rotate=90, |
| 164 |
}, |
| 165 |
major~tick~eras/.is~choice, |
| 166 |
major~tick~eras/none/.code |
| 167 |
= { \int_set:Nn\l__timechart_major_tick_eras_int{0} }, |
| 168 |
major~tick~eras/all/.code |
| 169 |
= { \int_set:Nn\l__timechart_major_tick_eras_int{1} }, |
| 170 |
major~tick~eras/outer/.code |
| 171 |
= { \int_set:Nn\l__timechart_major_tick_eras_int{2} }, |
| 172 |
no~autostep/.code = { \bool_set_false:Nz\l__timechart_autostep_bool }, |
| 173 |
ref/.initial={}, |
| 174 |
mark/.initial={}, |
| 175 |
marks/.forward~to=/timechart/mark, |
| 176 |
circa~uncertainty/.initial=3, |
| 177 |
interval~minimum~width/.initial=1pt, |
| 178 |
interval~bar~color/.initial=black, |
| 179 |
interval~bar~thickness/.initial=8pt, |
| 180 |
interval~bar~node~name/.initial = {bar~node}, |
| 181 |
interval~mark~color/.initial=gray, |
| 182 |
interval~label/.style={}, |
| 183 |
interval~label~centered/.style={/timechart/interval~label,text=white}, |
| 184 |
interval~label~centered~background/.style={/timechart/interval~label}, |
| 185 |
interval~label~baseline/.initial=-3pt, |
| 186 |
interval~label~pos/.is~choice, |
| 187 |
interval~label~pos/left/.code |
| 188 |
= { \int_set:Nn\l__timechart_label_pos_int{0} }, |
| 189 |
interval~label~pos/center/.code |
| 190 |
= { \int_set:Nn\l__timechart_label_pos_int{1} }, |
| 191 |
interval~label~pos/right/.code |
| 192 |
= { \int_set:Nn\l__timechart_label_pos_int{2} }, |
| 193 |
interval~label~node~name/.initial = {label~node}, |
| 194 |
start~range/.is~choice, |
| 195 |
start~range/fade/.code |
| 196 |
= { \int_set:Nn\l__timechart_start_range_type_int{0} }, |
| 197 |
start~range/slant/.code |
| 198 |
= { \int_set:Nn\l__timechart_start_range_type_int{1} }, |
| 199 |
finish~range/.is~choice, |
| 200 |
finish~range/fade/.code |
| 201 |
= { \int_set:Nn\l__timechart_finish_range_type_int{0} }, |
| 202 |
finish~range/slant/.code |
| 203 |
= { \int_set:Nn\l__timechart_finish_range_type_int{1} }, |
| 204 |
text~node~name/.initial = {text~node}, |
| 205 |
text/.style={}, |
| 206 |
text~baseline/.initial=-3pt, |
| 207 |
text~pos/.is~choice, |
| 208 |
text~pos/left/.code = { \int_set:Nn\l__timechart_text_pos_int{0} }, |
| 209 |
text~pos/center/.code = { \int_set:Nn\l__timechart_text_pos_int{1} }, |
| 210 |
text~pos/right/.code = { \int_set:Nn\l__timechart_text_pos_int{2} }, |
| 211 |
legend~item~width/.initial=9mm, |
| 212 |
legend~item~range~width/.initial=3mm, |
| 213 |
left/.code = { |
| 214 |
\int_set:Nn\l__timechart_label_pos_int{0} |
| 215 |
\int_set:Nn\l__timechart_text_pos_int{0} |
| 216 |
}, |
| 217 |
center/.code = { |
| 218 |
\int_set:Nn\l__timechart_label_pos_int{1} |
| 219 |
\int_set:Nn\l__timechart_text_pos_int{1} |
| 220 |
}, |
| 221 |
right/.code = { |
| 222 |
\int_set:Nn\l__timechart_label_pos_int{2} |
| 223 |
\int_set:Nn\l__timechart_text_pos_int{2} |
| 224 |
}, |
| 225 |
} |
| 226 |
\bool_new:N\l__timechart_grid_bool |
| 227 |
\bool_set_true:N\l__timechart_grid_bool |
| 228 |
\int_new:N\l__timechart_axis_int |
| 229 |
\int_set:Nn\l__timechart_axis_int{1} |
| 230 |
\int_new:N\l__timechart_major_tick_eras_int |
| 231 |
\int_set:Nn\l__timechart_major_tick_eras_int{2} |
| 232 |
\bool_new:N\l__timechart_autostep_bool |
| 233 |
\bool_set_true:N\l__timechart_autostep_bool |
| 234 |
\int_new:N \l__timechart_label_pos_int |
| 235 |
\int_new:N \l__timechart_text_pos_int |
| 236 |
\int_new:N \l__timechart_start_range_type_int |
| 237 |
\int_new:N \l__timechart_finish_range_type_int |
| 238 |
\NewDocumentEnvironment{timechart}{ O{} m m } |
| 239 |
{ \__timechart_main_begin:nnn{#1}{#2}{#3} } |
| 240 |
{ \__timechart_main_end: } |
| 241 |
\cs_new:Npn \__timechart_main_begin:nnn #1#2#3 |
| 242 |
{ |
| 243 |
\pgfkeys{ |
| 244 |
/timechart/.cd, |
| 245 |
#1, |
| 246 |
width/.get=\l__timechart_width_pgf, |
| 247 |
ystep/.get=\l__timechart_ystep_pgf, |
| 248 |
grid~top~ysep/.get=\l__timechart_grid_top_ysep_pgf, |
| 249 |
grid~bottom~ysep/.get=\l__timechart_grid_bottom_ysep_pgf, |
| 250 |
minor~tick~interval/.get=\l__timechart_minor_tick_interval_year, |
| 251 |
major~tick~interval/.get=\l__timechart_major_tick_interval_year, |
| 252 |
} |
| 253 |
\tikzpicture |
| 254 |
\pgfdeclarelayer{grid} |
| 255 |
\pgfdeclarelayer{labelbg} |
| 256 |
\pgfsetlayers{grid,labelbg,main} |
| 257 |
\bool_if:NTF\l__timechart_grid_bool |
| 258 |
{ |
| 259 |
\__timechart_set_style_line_width:nn |
| 260 |
{\l__timechart_grid_line_width} |
| 261 |
{/timechart/grid} |
| 262 |
} |
| 263 |
{ \pgfmathsetlengthmacro{\l__timechart_grid_line_width}{0} } |
| 264 |
\int_if_zero:nTF{ \l__timechart_axis_int } |
| 265 |
{ |
| 266 |
\pgfmathsetlengthmacro{\l__timechart_axis_line_width}{0} |
| 267 |
\pgfmathsetlengthmacro{\l__timechart_major_tick_line_width}{0} |
| 268 |
\pgfmathsetlengthmacro{\l__timechart_minor_tick_line_width}{0} |
| 269 |
} |
| 270 |
{ |
| 271 |
\__timechart_set_style_line_width:nn |
| 272 |
{\l__timechart_axis_line_width} |
| 273 |
{/timechart/axis~line} |
| 274 |
\__timechart_set_style_line_width:nn |
| 275 |
{\l__timechart_major_tick_line_width} |
| 276 |
{/timechart/major~tick} |
| 277 |
\__timechart_set_style_line_width:nn |
| 278 |
{\l__timechart_minor_tick_line_width} |
| 279 |
{/timechart/minor~tick} |
| 280 |
} |
| 281 |
\__timechart_parse_date:NNn\l_tmpa_bool\l__timechart_start_year{#2} |
| 282 |
\__timechart_parse_date:NNn\l_tmpa_bool\l__timechart_finish_year{#3} |
| 283 |
\pgfmathsetmacro{\l__timechart_start_year} |
| 284 |
{floor(\l__timechart_start_year)} |
| 285 |
\pgfmathsetmacro{\l__timechart_finish_year} |
| 286 |
{floor(\l__timechart_finish_year)} |
| 287 |
\pgfmathsetmacro{\l__timechart_x} |
| 288 |
{ |
| 289 |
( |
| 290 |
\l__timechart_width_pgf |
| 291 |
- max( |
| 292 |
\l__timechart_grid_line_width, |
| 293 |
\l__timechart_axis_line_width, |
| 294 |
\l__timechart_major_tick_line_width, |
| 295 |
\l__timechart_minor_tick_line_width |
| 296 |
) |
| 297 |
)/(\l__timechart_finish_year-\l__timechart_start_year) |
| 298 |
} |
| 299 |
\pgfkeys{ |
| 300 |
/pgf/declare~function={ |
| 301 |
yeartox(\n)=\l__timechart_x*(\n-\l__timechart_start_year); |
| 302 |
}, |
| 303 |
} |
| 304 |
\pgfmathsetmacro{\l__timechart_start_x} |
| 305 |
{yeartox(\l__timechart_start_year)} |
| 306 |
\pgfmathsetmacro{\l__timechart_finish_x} |
| 307 |
{yeartox(\l__timechart_finish_year)} |
| 308 |
\pgfmathsetmacro{\l__timechart_current_y}{0} |
| 309 |
\pgfmathsetmacro{\l__timechart_saved_y}{0} |
| 310 |
\pgfmathsetmacro{\l__timechart_auto_reset_minimum_y}{-16000pt} |
| 311 |
\pgfmathsetmacro{\l__timechart_auto_reset_maximum_y}{16000pt} |
| 312 |
\pgfmathsetmacro{\l__timechart_start_plus_year}{ |
| 313 |
\l__timechart_start_year+\l__timechart_minor_tick_interval_year |
| 314 |
} |
| 315 |
\pgfmathsetmacro{\l__timechart_start_plusplus_year}{ |
| 316 |
\l__timechart_start_year+(2*\l__timechart_minor_tick_interval_year) |
| 317 |
} |
| 318 |
\pgfmathsetmacro{\l__timechart_end_minus_year}{ |
| 319 |
\l__timechart_finish_year-\l__timechart_minor_tick_interval_year |
| 320 |
} |
| 321 |
\group_begin: |
| 322 |
\cs_set_eq:NN\timechartinterval\__timechart_interval_user:Ommm |
| 323 |
\cs_set_eq:NN\timecharttext\__timechart_text_user:Omm |
| 324 |
\cs_set_eq:NN\timechartspace\__timechart_space_user:O |
| 325 |
\cs_set_eq:NN\timechartsety\__timechart_set_y_user:m |
| 326 |
\cs_set_eq:NN\timechartsavey\__timechart_save_y_user: |
| 327 |
\cs_set_eq:NN\timechartresety\__timechart_reset_y_user: |
| 328 |
\cs_set_eq:NN\timechartsetyminimumautoreset |
| 329 |
\__timechart_set_y_minimum_auto_reset_user:m |
| 330 |
\cs_set_eq:NN\timechartsetymaximumautoreset |
| 331 |
\__timechart_set_y_maximum_auto_reset_user:m |
| 332 |
\cs_set_eq:NN\timechartstepy\__timechart_step_y_user:O |
| 333 |
\cs_set_eq:NN\timechartfinish\__timechart_main_end_user: |
| 334 |
} |
| 335 |
\cs_new:Npn\__timechart_main_end: |
| 336 |
{ |
| 337 |
\cs_if_eq:NNT\timechartfinish\__timechart_main_end_user: |
| 338 |
{ \__timechart_main_end_user: } |
| 339 |
\endtikzpicture |
| 340 |
} |
| 341 |
\cs_new:Npn\__timechart_main_end_user: |
| 342 |
{ |
| 343 |
\pgfextracty{\l__timechart_tmpa_dim} |
| 344 |
{ \pgfpointanchor{current~bounding~box}{south} } |
| 345 |
\pgfextracty{\l__timechart_tmpb_dim} |
| 346 |
{ \pgfpointanchor{current~bounding~box}{north} } |
| 347 |
\pgfresetboundingbox |
| 348 |
\dim_compare:nNnTF{\l__timechart_tmpa_dim}>{\l__timechart_tmpb_dim} |
| 349 |
{ |
| 350 |
\pgfmathsetmacro{\l__timechart_content_bottom_y}{0pt} |
| 351 |
\pgfmathsetmacro{\l__timechart_content_top_y}{0pt} |
| 352 |
} |
| 353 |
{ |
| 354 |
\pgfmathsetmacro{\l__timechart_content_bottom_y} |
| 355 |
{\l__timechart_tmpa_dim} |
| 356 |
\pgfmathsetmacro{\l__timechart_content_top_y} |
| 357 |
{\l__timechart_tmpb_dim} |
| 358 |
} |
| 359 |
\bool_if:NTF{\l__timechart_grid_bool} |
| 360 |
{ \__timechart_grid_draw: } |
| 361 |
{ \__timechart_nogrid_bounding_box_set: } |
| 362 |
\__timechart_axis_draw: |
| 363 |
\group_end: |
| 364 |
} |
| 365 |
\cs_new:Npn\__timechart_grid_draw: |
| 366 |
{ |
| 367 |
\pgfmathsetmacro{\l__timechart_content_bottom_y}{ |
| 368 |
\l__timechart_content_bottom_y-\l__timechart_grid_bottom_ysep_pgf |
| 369 |
} |
| 370 |
\pgfmathsetmacro{\l__timechart_content_top_y}{ |
| 371 |
\l__timechart_content_top_y+\l__timechart_grid_top_ysep_pgf |
| 372 |
} |
| 373 |
\pgfonlayer{ grid } |
| 374 |
\scope[/timechart/grid] |
| 375 |
\foreach \year in { |
| 376 |
\l__timechart_start_plus_year, |
| 377 |
\l__timechart_start_plusplus_year, |
| 378 |
..., |
| 379 |
\l__timechart_end_minus_year |
| 380 |
} { |
| 381 |
\group_begin: |
| 382 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool} |
| 383 |
{ Mod(\year,\l__timechart_major_tick_interval_year)==0 } |
| 384 |
\bool_if:NT\l__timechart_tmpa_bool |
| 385 |
{ |
| 386 |
\pgftransformshift{ \pgfpoint{yeartox(\year)}{0} } |
| 387 |
\pgfpathmoveto{ \pgfpoint{0}{\l__timechart_content_top_y} } |
| 388 |
\pgfpathlineto{ \pgfpoint{0}{\l__timechart_content_bottom_y} } |
| 389 |
\pgfusepath{ draw } |
| 390 |
} |
| 391 |
\group_end: |
| 392 |
} |
| 393 |
\__timechart_make_rectangle_node:nnnn |
| 394 |
{ \pgfpoint{\l__timechart_start_x}{\l__timechart_content_bottom_y} } |
| 395 |
{ \pgfpoint{\l__timechart_finish_x}{\l__timechart_content_top_y} } |
| 396 |
{ grid } |
| 397 |
{ \c_true_bool } |
| 398 |
\endscope |
| 399 |
\endpgfonlayer |
| 400 |
} |
| 401 |
\cs_new:Npn\__timechart_axis_draw: |
| 402 |
{ |
| 403 |
\group_begin: |
| 404 |
\int_case:nn{ \l__timechart_axis_int } |
| 405 |
{ |
| 406 |
{0} |
| 407 |
{ \prg_do_nothing: } |
| 408 |
{1} |
| 409 |
{ |
| 410 |
\pgftransformshift{ |
| 411 |
\pgfpoint{0}{ |
| 412 |
\l__timechart_content_top_y |
| 413 |
+\pgfkeysvalueof{/timechart/axis~ysep} |
| 414 |
} |
| 415 |
} |
| 416 |
\pgfmathsetmacro{\l__timechart_tick_orientation_pgf}{1} |
| 417 |
\cs_set:Npn\l__timechart_tick_label_anchor_text |
| 418 |
{ mid~west } |
| 419 |
\cs_set:Npn\l__timechart_zero_tick_before_label_anchor_text |
| 420 |
{ base~west } |
| 421 |
\cs_set:Npn\l__timechart_zero_tick_after_label_anchor_text |
| 422 |
{ north~west } |
| 423 |
\__timechart_axis_draw_aux: |
| 424 |
} |
| 425 |
{2} |
| 426 |
{ |
| 427 |
\pgftransformshift{ |
| 428 |
\pgfpoint{0}{ |
| 429 |
\l__timechart_content_bottom_y |
| 430 |
-\pgfkeysvalueof{/timechart/axis~ysep} |
| 431 |
} |
| 432 |
} |
| 433 |
\pgfmathsetmacro{\l__timechart_tick_orientation_pgf}{-1} |
| 434 |
\cs_set:Npn\l__timechart_tick_label_anchor_text |
| 435 |
{ mid~east } |
| 436 |
\cs_set:Npn\l__timechart_zero_tick_before_label_anchor_text |
| 437 |
{ base~east } |
| 438 |
\cs_set:Npn\l__timechart_zero_tick_after_label_anchor_text |
| 439 |
{ north~east } |
| 440 |
\__timechart_axis_draw_aux: |
| 441 |
} |
| 442 |
} |
| 443 |
\group_end: |
| 444 |
} |
| 445 |
\cs_new:Npn\__timechart_axis_draw_aux: |
| 446 |
{ |
| 447 |
\pgfkeys{ |
| 448 |
/timechart/minor~tick~length/.get=\__timechart_minor_tick_length_pgf, |
| 449 |
/timechart/major~tick~length/.get=\__timechart_major_tick_length_pgf, |
| 450 |
} |
| 451 |
\pgfmathsetmacro{\l__timechart_start_major_tick_year} |
| 452 |
{ |
| 453 |
\l__timechart_start_year |
| 454 |
-Mod( |
| 455 |
\l__timechart_start_year, |
| 456 |
\l__timechart_major_tick_interval_year |
| 457 |
) |
| 458 |
} |
| 459 |
\pgfmathsetmacro{\l__timechart_start_major_tick_year} |
| 460 |
{ |
| 461 |
ifthenelse( |
| 462 |
\l__timechart_start_major_tick_year<\l__timechart_start_year, |
| 463 |
\l__timechart_start_major_tick_year |
| 464 |
+\l__timechart_major_tick_interval_year, |
| 465 |
\l__timechart_start_major_tick_year |
| 466 |
) |
| 467 |
} |
| 468 |
\pgfmathsetmacro{\l__timechart_start_plus_major_tick_year} |
| 469 |
{ |
| 470 |
\l__timechart_start_major_tick_year |
| 471 |
+\l__timechart_major_tick_interval_year |
| 472 |
} |
| 473 |
\pgfmathsetmacro{\l__timechart_finish_major_tick_year} |
| 474 |
{ |
| 475 |
\l__timechart_finish_year |
| 476 |
-Mod( |
| 477 |
\l__timechart_finish_year, |
| 478 |
\l__timechart_major_tick_interval_year |
| 479 |
) |
| 480 |
} |
| 481 |
\foreach \year in { |
| 482 |
\l__timechart_start_year, |
| 483 |
\l__timechart_start_plus_year, |
| 484 |
..., |
| 485 |
\l__timechart_finish_year |
| 486 |
} { |
| 487 |
\pgfmathsetmacro{\x}{yeartox(\year)} |
| 488 |
\__timechart_pgfmathsetbool:nn |
| 489 |
{\l__timechart_tmpa_bool} |
| 490 |
{ |
| 491 |
Mod( |
| 492 |
\year-\l__timechart_start_major_tick_year, |
| 493 |
\l__timechart_major_tick_interval_year |
| 494 |
)==0 |
| 495 |
} |
| 496 |
\bool_if:NF\l__timechart_tmpa_bool |
| 497 |
{ \__timechart_axis_draw_minor_tick:N\x } |
| 498 |
} |
| 499 |
\foreach \year in { |
| 500 |
\l__timechart_start_major_tick_year, |
| 501 |
\l__timechart_start_plus_major_tick_year, |
| 502 |
..., |
| 503 |
\l__timechart_finish_major_tick_year |
| 504 |
} { |
| 505 |
\pgfmathsetmacro{\x}{yeartox(\year)} |
| 506 |
\__timechart_axis_draw_labelled_major_tick:NN\x\year |
| 507 |
} |
| 508 |
\__timechart_draw_axis_line |
| 509 |
\int_case:nn{\l__timechart_axis_int} |
| 510 |
{ |
| 511 |
{1} |
| 512 |
{ |
| 513 |
\pgfextracty{\l__timechart_tmpa_dim} |
| 514 |
{ \pgfpointanchor{current~bounding~box}{north} } |
| 515 |
\pgfmathsetmacro{\l__timechart_axis_top_y}{\l__timechart_tmpa_dim} |
| 516 |
\pgfmathsetmacro{\l__timechart_axis_bottom_y}{0} |
| 517 |
} |
| 518 |
{2} |
| 519 |
{ |
| 520 |
\pgfextracty{\l__timechart_tmpa_dim} |
| 521 |
{ \pgfpointanchor{current~bounding~box}{south} } |
| 522 |
\pgfmathsetmacro{\l__timechart_axis_top_y}{0} |
| 523 |
\pgfmathsetmacro{\l__timechart_axis_bottom_y}{\l__timechart_tmpa_dim} |
| 524 |
} |
| 525 |
} |
| 526 |
\__timechart_make_rectangle_node:nnnn |
| 527 |
{ \pgfpoint{\l__timechart_start_x}{\l__timechart_axis_bottom_y} } |
| 528 |
{ \pgfpoint{\l__timechart_finish_x}{\l__timechart_axis_top_y} } |
| 529 |
{ axis } |
| 530 |
{ \c_false_bool } |
| 531 |
} |
| 532 |
\cs_new:Npn\__timechart_axis_draw_minor_tick:N #1 |
| 533 |
{ |
| 534 |
\scope[/timechart/minor~tick] |
| 535 |
\pgfpathmoveto{ \pgfpoint{#1}{0} } |
| 536 |
\pgfpathlineto{ |
| 537 |
\pgfpoint{#1}{ |
| 538 |
\l__timechart_tick_orientation_pgf |
| 539 |
*\__timechart_minor_tick_length_pgf |
| 540 |
} |
| 541 |
} |
| 542 |
\pgfusepath{draw} |
| 543 |
\endscope |
| 544 |
} |
| 545 |
\cs_new:Npn\__timechart_axis_draw_labelled_major_tick:NN #1#2 |
| 546 |
{ |
| 547 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool}{#2==0} |
| 548 |
\bool_if:NTF \l__timechart_tmpa_bool |
| 549 |
{ \__timechart_axis_draw_zero_tick:N #1 } |
| 550 |
{ |
| 551 |
\int_case:nn { \l__timechart_major_tick_eras_int } |
| 552 |
{ |
| 553 |
{0}{ \bool_set_false:N\l__timechart_tmpd_bool } |
| 554 |
{1}{ \bool_set_true:N\l__timechart_tmpd_bool } |
| 555 |
{2} |
| 556 |
{ |
| 557 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpb_bool} |
| 558 |
{ #2==\l__timechart_start_major_tick_year } |
| 559 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpc_bool} |
| 560 |
{ #2==\l__timechart_finish_major_tick_year } |
| 561 |
\bool_set:Nn\l__timechart_tmpd_bool |
| 562 |
{ \l__timechart_tmpb_bool || \l__timechart_tmpc_bool } |
| 563 |
} |
| 564 |
} |
| 565 |
\__timechart_axis_draw_major_tick:N #1 |
| 566 |
\__timechart_axis_draw_year_label:nnnnnn |
| 567 |
{ #1 } |
| 568 |
{ #2 } |
| 569 |
{ \l__timechart_tmpd_bool } |
| 570 |
{ \l__timechart_tick_label_anchor_text } |
| 571 |
{ 0 } |
| 572 |
{ |
| 573 |
\l__timechart_tick_orientation_pgf |
| 574 |
*(\__timechart_major_tick_length_pgf+1mm) |
| 575 |
} |
| 576 |
} |
| 577 |
} |
| 578 |
\cs_new:Npn\__timechart_axis_draw_major_tick:N #1 |
| 579 |
{ |
| 580 |
\scope[/timechart/major~tick] |
| 581 |
\pgfpathmoveto{ \pgfpoint{#1}{0} } |
| 582 |
\pgfpathlineto{ |
| 583 |
\pgfpoint{#1}{ |
| 584 |
\l__timechart_tick_orientation_pgf |
| 585 |
*\__timechart_major_tick_length_pgf |
| 586 |
} |
| 587 |
} |
| 588 |
\pgfusepath{draw} |
| 589 |
\endscope |
| 590 |
} |
| 591 |
\cs_new:Npn\__timechart_axis_draw_zero_tick:N #1 |
| 592 |
{ |
| 593 |
\group_begin: |
| 594 |
\pgftransformshift{ \pgfpoint{#1}{0} } |
| 595 |
\pgfmathsetmacro{\a}{5} |
| 596 |
\pgfmathsetlengthmacro{\r}{1mm} |
| 597 |
\pgfmathsetlengthmacro{\t}{\r*(cos(\a)-cos(90-\a))/(1-cos(90-\a))} |
| 598 |
\scope[/timechart/major~tick,line~join=miter] |
| 599 |
\group_begin: |
| 600 |
\pgftransformyscale{\l__timechart_tick_orientation_pgf} |
| 601 |
\pgfpathmoveto{\pgfpointorigin} |
| 602 |
\pgfpathlineto{\pgfpoint{0}{\__timechart_major_tick_length_pgf}} |
| 603 |
\pgfpatharc{0}{90-\a}{\t~and~\r} |
| 604 |
\pgfpatharc{270+\a}{360-\a}{\r} |
| 605 |
\pgfpatharc{180+\a}{270-\a}{\r} |
| 606 |
\pgfpatharc{90+\a}{180-\a}{\t~and~\r} |
| 607 |
\pgfpathlineto{\pgfpoint{0}{\__timechart_major_tick_length_pgf-1pt}} |
| 608 |
\pgfusepath{draw} |
| 609 |
\group_end: |
| 610 |
\endscope |
| 611 |
\__timechart_axis_draw_year_label:nnnnnn |
| 612 |
{ 0 } |
| 613 |
{ -1 } |
| 614 |
{ \c_true_bool } |
| 615 |
{ \l__timechart_zero_tick_before_label_anchor_text } |
| 616 |
{ -.5mm } |
| 617 |
{ \l__timechart_tick_orientation_pgf*5.5mm } |
| 618 |
\__timechart_axis_draw_year_label:nnnnnn |
| 619 |
{ 0 } |
| 620 |
{ 1 } |
| 621 |
{ \c_true_bool } |
| 622 |
{ \l__timechart_zero_tick_after_label_anchor_text } |
| 623 |
{ .5mm } |
| 624 |
{ \l__timechart_tick_orientation_pgf*5.5mm } |
| 625 |
\group_end: |
| 626 |
} |
| 627 |
\cs_new:Npn\__timechart_draw_axis_line |
| 628 |
{ |
| 629 |
\scope[/timechart/axis~line] |
| 630 |
\pgfpathmoveto{ \pgfpoint{\l__timechart_start_x}{0} } |
| 631 |
\pgfpathlineto{ \pgfpoint{\l__timechart_finish_x}{0} } |
| 632 |
\pgfusepath{draw} |
| 633 |
\endscope |
| 634 |
} |
| 635 |
\cs_new:Npn\__timechart_axis_draw_year_label:nnnnnn #1#2#3#4#5#6 |
| 636 |
{ |
| 637 |
\group_begin: |
| 638 |
\pgftransformshift{ \pgfpoint{#1+#5}{#6} } |
| 639 |
\pgfmathtruncatemacro{\absyear}{ abs(#2) } |
| 640 |
\scope[/timechart/major~tick~label] |
| 641 |
\bool_if:NTF #3 |
| 642 |
{ |
| 643 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool}{#2<0} |
| 644 |
\bool_if:NTF\l__timechart_tmpa_bool |
| 645 |
{ \cs_set_eq:NN\__timechart_make_year:n\timechartmakebeforeyear } |
| 646 |
{ \cs_set_eq:NN\__timechart_make_year:n\timechartmakeafteryear } |
| 647 |
} |
| 648 |
{ \cs_set_eq:NN\__timechart_make_year:n\use:n } |
| 649 |
\__timechart_hsmash_pgfnode:nnnnn |
| 650 |
{rectangle} |
| 651 |
{#4} |
| 652 |
{\__timechart_make_year:n{\absyear}} |
| 653 |
{} |
| 654 |
{} |
| 655 |
\endscope |
| 656 |
\group_end: |
| 657 |
} |
| 658 |
\cs_new:Npn\timechartmakebeforeyear #1 |
| 659 |
{ |
| 660 |
#1\nobreakspace\textsc{bce} |
| 661 |
} |
| 662 |
\cs_new:Npn\timechartmakeafteryear #1 |
| 663 |
{ |
| 664 |
#1\nobreakspace\textsc{ce} |
| 665 |
} |
| 666 |
\cs_new:Npn\__timechart_nogrid_bounding_box_set: |
| 667 |
{ |
| 668 |
\pgfpathmoveto |
| 669 |
{ \pgfpoint{\l__timechart_start_x}{\l__timechart_content_bottom_y} } |
| 670 |
\pgfpathmoveto |
| 671 |
{ \pgfpoint{\l__timechart_finish_x}{\l__timechart_content_top_y} } |
| 672 |
\pgfusepath{discard} |
| 673 |
} |
| 674 |
\cs_new:Npn\__timechart_set_y_user:m #1 |
| 675 |
{ |
| 676 |
\pgfmathsetmacro{\l__timechart_current_y}{#1} |
| 677 |
} |
| 678 |
\cs_new:Npn\__timechart_save_y_user: |
| 679 |
{ |
| 680 |
\pgfmathsetmacro{\l__timechart_saved_y}{\l__timechart_current_y} |
| 681 |
} |
| 682 |
\cs_new:Npn\__timechart_reset_y_user: |
| 683 |
{ |
| 684 |
\pgfmathsetmacro{\l__timechart_current_y}{\l__timechart_saved_y} |
| 685 |
} |
| 686 |
\cs_new:Npn\__timechart_set_y_minimum_auto_reset_user:m #1 |
| 687 |
{ |
| 688 |
\pgfmathsetmacro{\l__timechart_auto_reset_minimum_y}{#1} |
| 689 |
} |
| 690 |
\cs_new:Npn\__timechart_set_y_maximum_auto_reset_user:m #1 |
| 691 |
{ |
| 692 |
\pgfmathsetmacro{\l__timechart_auto_reset_maximum_y}{#1} |
| 693 |
} |
| 694 |
\NewDocumentCommand{\__timechart_step_y_user:O}{ O{1} } |
| 695 |
{ |
| 696 |
\pgfmathsetmacro{\l__timechart_current_y} |
| 697 |
{\l__timechart_current_y+#1*\l__timechart_ystep_pgf} |
| 698 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool} |
| 699 |
{ |
| 700 |
or( |
| 701 |
\l__timechart_current_y<\l__timechart_auto_reset_minimum_y, |
| 702 |
\l__timechart_current_y>\l__timechart_auto_reset_maximum_y |
| 703 |
) |
| 704 |
} |
| 705 |
\bool_if:nT{\l__timechart_tmpa_bool} |
| 706 |
{ \pgfmathsetmacro{\l__timechart_current_y}{\l__timechart_saved_y)} } |
| 707 |
} |
| 708 |
\cs_new:Npn\__timechart_if_x_in_bounds:nT #1#2 |
| 709 |
{ |
| 710 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool}{ |
| 711 |
and( |
| 712 |
#1>=\l__timechart_start_x, |
| 713 |
#1<=\l__timechart_finish_x |
| 714 |
) |
| 715 |
} |
| 716 |
\bool_if:NT\l__timechart_tmpa_bool |
| 717 |
{#2} |
| 718 |
} |
| 719 |
|
| 720 |
\cs_new:Npn\__timechart_if_x_range_intersect_bounds:nnT #1#2#3 |
| 721 |
{ |
| 722 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool}{ |
| 723 |
or( |
| 724 |
or( |
| 725 |
and( |
| 726 |
#2>=\l__timechart_start_x, |
| 727 |
#2<=\l__timechart_finish_x |
| 728 |
), |
| 729 |
and( |
| 730 |
#1>=\l__timechart_start_x, |
| 731 |
#1<=\l__timechart_finish_x |
| 732 |
) |
| 733 |
), |
| 734 |
and( |
| 735 |
#1<\l__timechart_start_x, |
| 736 |
#2>\l__timechart_finish_x |
| 737 |
) |
| 738 |
) |
| 739 |
} |
| 740 |
\bool_if:NT\l__timechart_tmpa_bool |
| 741 |
{#3} |
| 742 |
} |
| 743 |
\cs_new:Npn\__timechart_parse_date_or_daterange:NNNNNn #1#2#3#4#5#6 |
| 744 |
{ |
| 745 |
\bool_set:Nn #1 {\__timechart_is_nondaterange_p:w #6/\q_stop} |
| 746 |
\bool_set_inverse:N #1 |
| 747 |
\bool_if:nTF #1 |
| 748 |
{ \__timechart_parse_range:w #2#3#4#5\q_mark #6\q_stop } |
| 749 |
{ |
| 750 |
\__timechart_parse_date:NNn #2#3{#6} |
| 751 |
\bool_set_eq:NN #4#2 |
| 752 |
\pgfmathsetmacro{#5}{#3} |
| 753 |
} |
| 754 |
} |
| 755 |
\cs_new:Npn\__timechart_is_nondaterange_p:w #1/#2\q_stop |
| 756 |
{ |
| 757 |
\tl_if_empty_p:n{#2} |
| 758 |
} |
| 759 |
\cs_new:Npn\__timechart_parse_range:w #1#2#3#4\q_mark #5/#6\q_stop |
| 760 |
{ |
| 761 |
\__timechart_parse_date:NNn #1#2{#5} |
| 762 |
\__timechart_parse_date:NNn #3#4{#6} |
| 763 |
} |
| 764 |
\cs_new:Npn\__timechart_parse_date:NNn #1#2#3 |
| 765 |
{ |
| 766 |
\bool_set:Nn #1 { \__timechart_is_circa_p:w #3c\q_stop } |
| 767 |
\bool_if:NTF #1 |
| 768 |
{ \__timechart_parse_circa_date:w #2\q_mark #3\q_stop } |
| 769 |
{ \__timechart_parse_noncirca_date:Nn #2{#3} } |
| 770 |
} |
| 771 |
\cs_new:Npn\__timechart_is_circa_p:w #1c#2\q_stop |
| 772 |
{ |
| 773 |
\tl_if_empty_p:n{#1} |
| 774 |
} |
| 775 |
\cs_new:Npn\__timechart_parse_circa_date:w #1\q_mark c#2\q_stop |
| 776 |
{ |
| 777 |
\__timechart_parse_noncirca_date:Nn #1{#2} |
| 778 |
} |
| 779 |
\cs_new:Npn\__timechart_parse_noncirca_date:Nn #1#2 |
| 780 |
{ |
| 781 |
\bool_if:nTF { \__timechart_is_before_p:w #2-\q_stop } |
| 782 |
{ \__timechart_parse_before_date:w #1\q_mark #2\q_stop } |
| 783 |
{ \__timechart_parse_signed_date:w #1\q_mark #2-0-0\q_stop } |
| 784 |
} |
| 785 |
\cs_new:Npn\__timechart_is_before_p:w #1-#2\q_stop |
| 786 |
{ |
| 787 |
\tl_if_empty_p:n{#1} |
| 788 |
} |
| 789 |
\cs_new:Npn\__timechart_parse_before_date:w #1\q_mark-#2\q_stop |
| 790 |
{ |
| 791 |
\__timechart_parse_signed_date:w #1-\q_mark #2-0-0\q_stop |
| 792 |
} |
| 793 |
\cs_new:cpn{c__timechart_year_days_pgf}{365} |
| 794 |
\cs_new:cpn{c__timechart_month_days_1_pgf}{31} |
| 795 |
\cs_new:cpn{c__timechart_month_days_2_pgf}{28} |
| 796 |
\cs_new:cpn{c__timechart_month_days_3_pgf}{31} |
| 797 |
\cs_new:cpn{c__timechart_month_days_4_pgf}{30} |
| 798 |
\cs_new:cpn{c__timechart_month_days_5_pgf}{31} |
| 799 |
\cs_new:cpn{c__timechart_month_days_6_pgf}{30} |
| 800 |
\cs_new:cpn{c__timechart_month_days_7_pgf}{31} |
| 801 |
\cs_new:cpn{c__timechart_month_days_8_pgf}{31} |
| 802 |
\cs_new:cpn{c__timechart_month_days_9_pgf}{30} |
| 803 |
\cs_new:cpn{c__timechart_month_days_10_pgf}{31} |
| 804 |
\cs_new:cpn{c__timechart_month_days_11_pgf}{30} |
| 805 |
\cs_new:cpn{c__timechart_month_days_12_pgf}{31} |
| 806 |
\cs_new:cpn{c__timechart_cumulative_days_1_pgf}{0} |
| 807 |
\cs_new:cpn{c__timechart_cumulative_days_2_pgf}{31} |
| 808 |
\cs_new:cpn{c__timechart_cumulative_days_3_pgf}{59} |
| 809 |
\cs_new:cpn{c__timechart_cumulative_days_4_pgf}{90} |
| 810 |
\cs_new:cpn{c__timechart_cumulative_days_5_pgf}{120} |
| 811 |
\cs_new:cpn{c__timechart_cumulative_days_6_pgf}{151} |
| 812 |
\cs_new:cpn{c__timechart_cumulative_days_7_pgf}{181} |
| 813 |
\cs_new:cpn{c__timechart_cumulative_days_8_pgf}{212} |
| 814 |
\cs_new:cpn{c__timechart_cumulative_days_9_pgf}{243} |
| 815 |
\cs_new:cpn{c__timechart_cumulative_days_10_pgf}{273} |
| 816 |
\cs_new:cpn{c__timechart_cumulative_days_11_pgf}{304} |
| 817 |
\cs_new:cpn{c__timechart_cumulative_days_12_pgf}{334} |
| 818 |
\cs_new:Npn\__timechart_parse_signed_date:w #1#2\q_mark #3-#4-#5\q_stop |
| 819 |
{ |
| 820 |
\pgfmathtruncatemacro{\__timechart_parsed_year_pgf}{#2#3} |
| 821 |
\pgfmathtruncatemacro{\__timechart_parsed_month_pgf}{#4} |
| 822 |
\pgfmathtruncatemacro{\__timechart_parsed_day_pgf}{#5} |
| 823 |
\__timechart_pgfmathsetbool:nn{\l_tmpa_bool}{ |
| 824 |
or( |
| 825 |
\__timechart_parsed_month_pgf < 1, |
| 826 |
\__timechart_parsed_month_pgf > 12, |
| 827 |
) |
| 828 |
} |
| 829 |
\bool_if:NTF\l_tmpa_bool |
| 830 |
{ |
| 831 |
\pgfmathsetmacro{#1}{#2#3} |
| 832 |
} |
| 833 |
{ |
| 834 |
\cs_set_eq:NN\l__timechart_year_days_pgf\c__timechart_year_days_pgf |
| 835 |
\cs_set_eq:Nc\l__timechart_month_days_pgf |
| 836 |
{ c__timechart_month_days_\__timechart_parsed_month_pgf _pgf } |
| 837 |
\cs_set_eq:Nc\l__timechart_cumulative_days_pgf |
| 838 |
{ c__timechart_cumulative_days_\__timechart_parsed_month_pgf _pgf } |
| 839 |
\__timechart_pgfmathsetbool:nn{\l_tmpa_bool}{ |
| 840 |
or( |
| 841 |
Mod(\__timechart_parsed_year_pgf,400) == 0, |
| 842 |
and( |
| 843 |
Mod(\__timechart_parsed_year_pgf,4) == 0, |
| 844 |
Mod(\__timechart_parsed_year_pgf,100) != 0 |
| 845 |
) |
| 846 |
) |
| 847 |
} |
| 848 |
\bool_if:NT\l_tmpa_bool |
| 849 |
{ |
| 850 |
\pgfmathsetmacro{\l__timechart_year_days_pgf} |
| 851 |
{ \l__timechart_year_days_pgf+1 } |
| 852 |
\__timechart_pgfmathsetbool:nn{\l_tmpb_bool} |
| 853 |
{ \__timechart_parsed_month == 1 } |
| 854 |
\bool_if:NF\l_tmpb_bool |
| 855 |
{ |
| 856 |
\__timechart_pgfmathsetbool:nn{\l_tmpb_bool} |
| 857 |
{ \__timechart_parsed_month == 2 } |
| 858 |
\bool_if:NF\l_tmpb_bool |
| 859 |
{ |
| 860 |
\pgfmathsetmacro{\l__timechart_month_days_pgf} |
| 861 |
{ \l__timechart_month_days_pgf + 1 } |
| 862 |
} |
| 863 |
{ |
| 864 |
\pgfmathsetmacro{\l__timechart_cumulative_days_pgf} |
| 865 |
{ \l__timechart_cumulative_days_pgf + 1 } |
| 866 |
} |
| 867 |
} |
| 868 |
} |
| 869 |
\__timechart_pgfmathsetbool:nn{\l_tmpa_bool}{ |
| 870 |
or( |
| 871 |
\__timechart_parsed_day_pgf < 1, |
| 872 |
\__timechart_parsed_day_pgf > \l__timechart_month_days_pgf, |
| 873 |
) |
| 874 |
} |
| 875 |
\bool_if:NTF\l_tmpa_bool |
| 876 |
{ |
| 877 |
\pgfmathsetmacro{#1} |
| 878 |
{ |
| 879 |
#2#3 |
| 880 |
+ \l__timechart_cumulative_days_pgf/\l__timechart_year_days_pgf |
| 881 |
} |
| 882 |
} |
| 883 |
{ |
| 884 |
\pgfmathsetmacro{#1} |
| 885 |
{ |
| 886 |
#2#3 |
| 887 |
+ ( |
| 888 |
\l__timechart_cumulative_days_pgf |
| 889 |
+ \__timechart_parsed_day_pgf |
| 890 |
)/\l__timechart_year_days_pgf |
| 891 |
} |
| 892 |
} |
| 893 |
} |
| 894 |
} |
| 895 |
\bool_new:N\l__timechart_start_is_range_bool |
| 896 |
\bool_new:N\l__timechart_interval_start_min_circa_bool |
| 897 |
\bool_new:N\l__timechart_interval_start_max_circa_bool |
| 898 |
\bool_new:N\l__timechart_finish_is_range_bool |
| 899 |
\bool_new:N\l__timechart_interval_finish_min_circa_bool |
| 900 |
\bool_new:N\l__timechart_interval_finish_max_circa_bool |
| 901 |
\msg_new:nnn{timechart}{interval_dates_invalid} |
| 902 |
{ Invalid~interval~dates:~#1~to~#2 } |
| 903 |
\NewDocumentCommand{\__timechart_interval_user:Ommm}{ O{} m m m } |
| 904 |
{ |
| 905 |
\__timechart_interval:nnnn{#1}{#2}{#3}{#4} |
| 906 |
} |
| 907 |
\cs_new:Npn \__timechart_interval:nnnn #1#2#3#4 |
| 908 |
{ |
| 909 |
\__timechart_debug:n{ |
| 910 |
************************************************************ |
| 911 |
} |
| 912 |
\__timechart_debug:n{Interval~#2~to~#3~"#4"} |
| 913 |
\group_begin: |
| 914 |
\__timechart_parse_date_or_daterange:NNNNNn |
| 915 |
\l__timechart_start_is_range_bool |
| 916 |
\l__timechart_interval_start_min_circa_bool |
| 917 |
\l__timechart_interval_start_min_year |
| 918 |
\l__timechart_interval_start_max_circa_bool |
| 919 |
\l__timechart_interval_start_max_year |
| 920 |
{#2} |
| 921 |
\__timechart_parse_date_or_daterange:NNNNNn |
| 922 |
\l__timechart_finish_is_range_bool |
| 923 |
\l__timechart_interval_finish_min_circa_bool |
| 924 |
\l__timechart_interval_finish_min_year |
| 925 |
\l__timechart_interval_finish_max_circa_bool |
| 926 |
\l__timechart_interval_finish_max_year |
| 927 |
{#3} |
| 928 |
\__timechart_pgfmathsetbool:nn{\l_tmpa_bool}{ |
| 929 |
and( |
| 930 |
\l__timechart_interval_start_min_year |
| 931 |
<= \l__timechart_interval_start_max_year, |
| 932 |
and( |
| 933 |
\l__timechart_interval_start_max_year |
| 934 |
<= \l__timechart_interval_finish_min_year, |
| 935 |
\l__timechart_interval_finish_min_year |
| 936 |
<= \l__timechart_interval_finish_max_year |
| 937 |
) |
| 938 |
) |
| 939 |
} |
| 940 |
\bool_if:NTF\l_tmpa_bool |
| 941 |
{ |
| 942 |
\__timechart_interval_checked:nn{#1}{#4} |
| 943 |
\group_end: |
| 944 |
\bool_if:NT\l__timechart_autostep_bool |
| 945 |
{ \__timechart_step_y_user:O } |
| 946 |
} |
| 947 |
{ |
| 948 |
\msg_error:nnnn{timechart}{interval_dates_invalid}{#2}{#3} |
| 949 |
\group_end: |
| 950 |
} |
| 951 |
} |
| 952 |
\cs_new:Npn \__timechart_interval_checked:nn #1#2 |
| 953 |
{ |
| 954 |
\pgfqkeys{/timechart}{ |
| 955 |
#1, |
| 956 |
circa~uncertainty/.get=\l__timechart_circa_uncertainty_year |
| 957 |
} |
| 958 |
\bool_if:NTF\l__timechart_interval_start_min_circa_bool |
| 959 |
{ |
| 960 |
\pgfmathsetmacro{\l__timechart_interval_start_min_x} |
| 961 |
{ yeartox(\l__timechart_interval_start_min_year |
| 962 |
- \l__timechart_circa_uncertainty_year) } |
| 963 |
} |
| 964 |
{ |
| 965 |
\pgfmathsetmacro{\l__timechart_interval_start_min_x} |
| 966 |
{ yeartox(\l__timechart_interval_start_min_year) } |
| 967 |
} |
| 968 |
\bool_if:NTF\l__timechart_interval_finish_max_circa_bool |
| 969 |
{ |
| 970 |
\pgfmathsetmacro{\l__timechart_interval_finish_max_x} |
| 971 |
{ yeartox(\l__timechart_interval_finish_max_year |
| 972 |
+ \l__timechart_circa_uncertainty_year) } |
| 973 |
} |
| 974 |
{ |
| 975 |
\pgfmathsetmacro{\l__timechart_interval_finish_max_x} |
| 976 |
{ yeartox(\l__timechart_interval_finish_max_year) } |
| 977 |
} |
| 978 |
\__timechart_if_x_range_intersect_bounds:nnT |
| 979 |
{\l__timechart_interval_start_min_x} |
| 980 |
{\l__timechart_interval_finish_max_x} |
| 981 |
{ \__timechart_draw_visible_interval:nn{#1}{#2} } |
| 982 |
} |
| 983 |
\bool_new:N\l__timechart_interval_start_beyond_bool |
| 984 |
\bool_new:N\l__timechart_interval_finish_beyond_bool |
| 985 |
\cs_new:Npn\__timechart_draw_visible_interval:nn #1#2 |
| 986 |
{ |
| 987 |
\pgfqkeys{/timechart}{ |
| 988 |
tolerance~start/.get=\l__timechart_start_tolerance_pgf, |
| 989 |
tolerance~finish/.get=\l__timechart_finish_tolerance_pgf, |
| 990 |
beyond~length~start/.get=\l__timechart_start_beyond_length_pgf, |
| 991 |
beyond~length~finish/.get=\l__timechart_finish_beyond_length_pgf, |
| 992 |
beyond~x~radius~start/.get=\l__timechart_start_beyond_x_radius_pgf, |
| 993 |
beyond~x~radius~finish/.get=\l__timechart_finish_beyond_x_radius_pgf, |
| 994 |
ref/.get=\l__timechart_ref_text, |
| 995 |
mark/.get=\l__timechart_mark_text, |
| 996 |
interval~minimum~width/.get=\l__timechart_minimum_width_pgf, |
| 997 |
interval~bar~color/.get=\l__timechart_bar_color, |
| 998 |
interval~bar~thickness/.get=\l__timechart_bar_thickness_pgf, |
| 999 |
interval~mark~color/.get=\l__timechart_mark_color, |
| 1000 |
interval~label~baseline/.get=\l__timechart_text_baseline_pgf, |
| 1001 |
interval~label~node~name/.get=\l__timechart_interval_label_node_name, |
| 1002 |
} |
| 1003 |
\pgfmathsetmacro{\l__timechart_start_tolerance_x}{ |
| 1004 |
\l__timechart_start_x-(\l__timechart_start_tolerance_pgf) |
| 1005 |
} |
| 1006 |
\pgfmathsetmacro{\l__timechart_finish_tolerance_x}{ |
| 1007 |
\l__timechart_finish_x+(\l__timechart_finish_tolerance_pgf) |
| 1008 |
} |
| 1009 |
\pgfmathsetmacro{\l__timechart_start_beyond_x}{ |
| 1010 |
\l__timechart_start_x-(\l__timechart_start_beyond_length_pgf) |
| 1011 |
} |
| 1012 |
\pgfmathsetmacro{\l__timechart_finish_beyond_x}{ |
| 1013 |
\l__timechart_finish_x+(\l__timechart_finish_beyond_length_pgf) |
| 1014 |
} |
| 1015 |
\pgfmathsetlengthmacro{\l__timechart_bar_half_thickness_pgf} |
| 1016 |
{.5*\l__timechart_bar_thickness_pgf} |
| 1017 |
\cs_set:Npn\l__timechart_label_text{#2} |
| 1018 |
\bool_if:NTF\l__timechart_interval_start_max_circa_bool |
| 1019 |
{ |
| 1020 |
\pgfmathsetmacro{\l__timechart_interval_start_max_x} |
| 1021 |
{ yeartox(\l__timechart_interval_start_max_year |
| 1022 |
+ \l__timechart_circa_uncertainty_year) } |
| 1023 |
} |
| 1024 |
{ |
| 1025 |
\pgfmathsetmacro{\l__timechart_interval_start_max_x} |
| 1026 |
{ yeartox(\l__timechart_interval_start_max_year) } |
| 1027 |
} |
| 1028 |
\bool_if:NTF\l__timechart_interval_finish_min_circa_bool |
| 1029 |
{ |
| 1030 |
\pgfmathsetmacro{\l__timechart_interval_finish_min_x} |
| 1031 |
{ yeartox(\l__timechart_interval_finish_min_year |
| 1032 |
- \l__timechart_circa_uncertainty_year) } |
| 1033 |
} |
| 1034 |
{ |
| 1035 |
\pgfmathsetmacro{\l__timechart_interval_finish_min_x} |
| 1036 |
{ yeartox(\l__timechart_interval_finish_min_year) } |
| 1037 |
} |
| 1038 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool} |
| 1039 |
{ |
| 1040 |
\l__timechart_interval_start_max_x |
| 1041 |
> \l__timechart_interval_finish_min_x |
| 1042 |
} |
| 1043 |
\bool_if:NT\l__timechart_tmpa_bool |
| 1044 |
{ |
| 1045 |
\pgfmathsetmacro{\l__timechart_interval_start_max_x} |
| 1046 |
{ |
| 1047 |
.5*( |
| 1048 |
\l__timechart_interval_start_max_x |
| 1049 |
+ \l__timechart_interval_finish_min_x |
| 1050 |
) |
| 1051 |
} |
| 1052 |
\pgfmathsetmacro{\l__timechart_interval_finish_min_x} |
| 1053 |
{ \l__timechart_interval_start_max_x } |
| 1054 |
} |
| 1055 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool} |
| 1056 |
{ |
| 1057 |
(\l__timechart_interval_finish_max_x |
| 1058 |
-\l__timechart_interval_start_min_x) |
| 1059 |
> \l__timechart_minimum_width_pgf |
| 1060 |
} |
| 1061 |
\bool_if:NF \l__timechart_tmpa_bool |
| 1062 |
{ |
| 1063 |
\pgfmathsetmacro{\l__timechart_width_adjust} |
| 1064 |
{ .5*\l__timechart_minimum_width_pgf } |
| 1065 |
\pgfmathsetmacro{\l__timechart_interval_start_max_x} |
| 1066 |
{ \l__timechart_interval_start_max_x-\l__timechart_width_adjust } |
| 1067 |
\pgfmathsetmacro{\l__timechart_interval_finish_min_x} |
| 1068 |
{ \l__timechart_interval_finish_min_x+\l__timechart_width_adjust } |
| 1069 |
\pgfmathsetmacro{\l__timechart_interval_start_min_x} |
| 1070 |
{ |
| 1071 |
min( |
| 1072 |
\l__timechart_interval_start_min_x, |
| 1073 |
\l__timechart_interval_start_max_x |
| 1074 |
) |
| 1075 |
} |
| 1076 |
\pgfmathsetmacro{\l__timechart_interval_finish_max_x} |
| 1077 |
{ |
| 1078 |
max( |
| 1079 |
\l__timechart_interval_finish_max_x, |
| 1080 |
\l__timechart_interval_finish_min_x |
| 1081 |
) |
| 1082 |
} |
| 1083 |
} |
| 1084 |
\__timechart_debug:n{Calculated+adjusted~x~coords:} |
| 1085 |
\__timechart_debug:n{~ |
| 1086 |
\l__timechart_interval_start_min_x/\l__timechart_interval_start_max_x~ |
| 1087 |
to~ |
| 1088 |
\l__timechart_interval_finish_min_x/\l__timechart_interval_finish_max_x |
| 1089 |
} |
| 1090 |
\__timechart_pgfmathsetbool:nn{\l__timechart_interval_start_beyond_bool} |
| 1091 |
{\l__timechart_interval_start_min_x<=\l__timechart_start_tolerance_x} |
| 1092 |
\bool_if:NT\l__timechart_interval_start_beyond_bool |
| 1093 |
{ |
| 1094 |
\cs_set_eq:NN |
| 1095 |
\__timechart_interval_start_clip_path: |
| 1096 |
\__timechart_interval_start_clip_path_beyond: |
| 1097 |
} |
| 1098 |
\__timechart_pgfmathsetbool:nn{\l__timechart_interval_finish_beyond_bool} |
| 1099 |
{\l__timechart_interval_finish_max_x>=\l__timechart_finish_tolerance_x} |
| 1100 |
\bool_if:NT\l__timechart_interval_finish_beyond_bool |
| 1101 |
{ |
| 1102 |
\cs_set_eq:NN |
| 1103 |
\__timechart_interval_finish_clip_path: |
| 1104 |
\__timechart_interval_finish_clip_path_beyond: |
| 1105 |
} |
| 1106 |
\__timechart_interval_definite_compute: |
| 1107 |
\__timechart_interval_startrange_compute: |
| 1108 |
\__timechart_interval_finishrange_compute: |
| 1109 |
\pgftransformshift{ \pgfpoint{0}{\l__timechart_current_y} } |
| 1110 |
\pgfscope |
| 1111 |
\__timechart_interval_clip: |
| 1112 |
\__timechart_interval_startrange_draw: |
| 1113 |
\__timechart_interval_finishrange_draw: |
| 1114 |
\__timechart_interval_solid_draw: |
| 1115 |
\__timechart_interval_mark: |
| 1116 |
\__timechart_interval_define_bar_node: |
| 1117 |
\endpgfscope |
| 1118 |
\__timechart_interval_label: |
| 1119 |
} |
| 1120 |
\cs_new:Npn\__timechart_interval_definite_compute: |
| 1121 |
{ |
| 1122 |
\__timechart_debug:n{Computing:~definite~part} |
| 1123 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool} |
| 1124 |
{ \l__timechart_interval_finish_min_x < \l__timechart_start_x } |
| 1125 |
\bool_if:nTF{ |
| 1126 |
\l__timechart_tmpa_bool && \l__timechart_interval_start_beyond_bool |
| 1127 |
} |
| 1128 |
{ |
| 1129 |
\cs_set_eq:NN |
| 1130 |
\__timechart_interval_solid_draw:\prg_do_nothing: |
| 1131 |
\cs_set_eq:NN |
| 1132 |
\__timechart_interval_startrange_compute:\prg_do_nothing: |
| 1133 |
\cs_set_eq:NN |
| 1134 |
\__timechart_interval_startrange_draw:\prg_do_nothing: |
| 1135 |
} |
| 1136 |
{ |
| 1137 |
\__timechart_interval_definite_compute_ii: |
| 1138 |
} |
| 1139 |
} |
| 1140 |
\cs_new:Npn\__timechart_interval_definite_compute_ii: |
| 1141 |
{ |
| 1142 |
\__timechart_debug:n{~(Stage~II)} |
| 1143 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool} |
| 1144 |
{ \l__timechart_interval_start_max_x > \l__timechart_finish_x } |
| 1145 |
\bool_if:nTF{ |
| 1146 |
\l__timechart_tmpa_bool && \l__timechart_interval_finish_beyond_bool |
| 1147 |
} |
| 1148 |
{ |
| 1149 |
\cs_set_eq:NN |
| 1150 |
\__timechart_interval_solid_draw:\prg_do_nothing: |
| 1151 |
\cs_set_eq:NN |
| 1152 |
\__timechart_interval_finishrange_compute:\prg_do_nothing: |
| 1153 |
\cs_set_eq:NN |
| 1154 |
\__timechart_interval_finishrange_draw:\prg_do_nothing: |
| 1155 |
} |
| 1156 |
{ |
| 1157 |
\__timechart_interval_definite_compute_iii: |
| 1158 |
} |
| 1159 |
} |
| 1160 |
\cs_new:Npn\__timechart_interval_definite_compute_iii: |
| 1161 |
{ |
| 1162 |
\__timechart_debug:n{~(Stage~III)} |
| 1163 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool} |
| 1164 |
{ \l__timechart_interval_start_max_x <= \l__timechart_start_x } |
| 1165 |
\bool_if:nTF{ |
| 1166 |
\l__timechart_tmpa_bool && \l__timechart_interval_start_beyond_bool |
| 1167 |
} |
| 1168 |
{ |
| 1169 |
\cs_set_eq:NN |
| 1170 |
\l__timechart_interval_solid_start_x\l__timechart_start_beyond_x |
| 1171 |
\cs_set_eq:NN |
| 1172 |
\__timechart_interval_startrange_compute:\prg_do_nothing: |
| 1173 |
\cs_set_eq:NN |
| 1174 |
\__timechart_interval_startrange_draw:\prg_do_nothing: |
| 1175 |
} |
| 1176 |
{ |
| 1177 |
\cs_set_eq:NN |
| 1178 |
\l__timechart_interval_solid_start_x |
| 1179 |
\l__timechart_interval_start_max_x |
| 1180 |
} |
| 1181 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpb_bool} |
| 1182 |
{ \l__timechart_interval_finish_min_x >= \l__timechart_finish_x } |
| 1183 |
\bool_if:nTF{ |
| 1184 |
\l__timechart_tmpb_bool && \l__timechart_interval_finish_beyond_bool |
| 1185 |
} |
| 1186 |
{ |
| 1187 |
\cs_set_eq:NN |
| 1188 |
\l__timechart_interval_solid_finish_x\l__timechart_finish_beyond_x |
| 1189 |
\cs_set_eq:NN |
| 1190 |
\__timechart_interval_finishrange_compute:\prg_do_nothing: |
| 1191 |
\cs_set_eq:NN |
| 1192 |
\__timechart_interval_finishrange_draw:\prg_do_nothing: |
| 1193 |
} |
| 1194 |
{ |
| 1195 |
\cs_set_eq:NN |
| 1196 |
\l__timechart_interval_solid_finish_x |
| 1197 |
\l__timechart_interval_finish_min_x |
| 1198 |
} |
| 1199 |
} |
| 1200 |
\cs_new:Npn\__timechart_interval_startrange_compute: |
| 1201 |
{ |
| 1202 |
\__timechart_debug:n{Computing:~startrange} |
| 1203 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool} |
| 1204 |
{ |
| 1205 |
\l__timechart_interval_start_min_x |
| 1206 |
== \l__timechart_interval_start_max_x |
| 1207 |
} |
| 1208 |
\bool_if:NTF\l__timechart_tmpa_bool |
| 1209 |
{ |
| 1210 |
\cs_set_eq:NN\__timechart_interval_startrange_draw:\prg_do_nothing: |
| 1211 |
} |
| 1212 |
{ |
| 1213 |
\__timechart_interval_startrange_compute_ii: |
| 1214 |
} |
| 1215 |
} |
| 1216 |
\bool_new:N\l__timechart_interval_startrange_finish_beyond_bool |
| 1217 |
\cs_new:Npn\__timechart_interval_startrange_compute_ii: |
| 1218 |
{ |
| 1219 |
\__timechart_debug:n{~(Stage~II)} |
| 1220 |
\bool_if:NTF\l__timechart_interval_start_beyond_bool |
| 1221 |
{ |
| 1222 |
\cs_set_eq:NN |
| 1223 |
\l__timechart_interval_startrange_start_x\l__timechart_start_x |
| 1224 |
\pgfmathsetmacro{\l__timechart_interval_startrange_start_level_pgf} |
| 1225 |
{ |
| 1226 |
(\l__timechart_interval_startrange_start_x |
| 1227 |
-\l__timechart_interval_start_min_x) |
| 1228 |
/ |
| 1229 |
(\l__timechart_interval_start_max_x |
| 1230 |
-\l__timechart_interval_start_min_x) |
| 1231 |
} |
| 1232 |
} |
| 1233 |
{ |
| 1234 |
\cs_set_eq:NN |
| 1235 |
\l__timechart_interval_startrange_start_x |
| 1236 |
\l__timechart_interval_start_min_x |
| 1237 |
\pgfmathsetmacro |
| 1238 |
{\l__timechart_interval_startrange_start_level_pgf}{0} |
| 1239 |
} |
| 1240 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool} |
| 1241 |
{ \l__timechart_interval_start_max_x > \l__timechart_finish_x } |
| 1242 |
\bool_set:Nn\l__timechart_interval_startrange_finish_beyond_bool |
| 1243 |
{ |
| 1244 |
\l__timechart_tmpa_bool |
| 1245 |
&& \l__timechart_interval_finish_beyond_bool |
| 1246 |
} |
| 1247 |
\bool_if:NTF\l__timechart_interval_startrange_finish_beyond_bool |
| 1248 |
{ |
| 1249 |
\cs_set_eq:NN |
| 1250 |
\l__timechart_interval_startrange_finish_x |
| 1251 |
\l__timechart_finish_x |
| 1252 |
\pgfmathsetmacro{\l__timechart_interval_startrange_finish_level_pgf} |
| 1253 |
{ |
| 1254 |
(\l__timechart_interval_startrange_finish_x |
| 1255 |
-\l__timechart_interval_start_min_x) |
| 1256 |
/ |
| 1257 |
(\l__timechart_interval_start_max_x |
| 1258 |
-\l__timechart_interval_start_min_x) |
| 1259 |
} |
| 1260 |
} |
| 1261 |
{ |
| 1262 |
\cs_set_eq:NN |
| 1263 |
\l__timechart_interval_startrange_finish_x |
| 1264 |
\l__timechart_interval_start_max_x |
| 1265 |
\pgfmathsetmacro |
| 1266 |
{\l__timechart_interval_startrange_finish_level_pgf}{1} |
| 1267 |
} |
| 1268 |
\int_case:nn {\l__timechart_start_range_type_int} |
| 1269 |
{ |
| 1270 |
{0}{ |
| 1271 |
\cs_set_eq:NN |
| 1272 |
\__timechart_interval_startrange_draw: |
| 1273 |
\__timechart_interval_startrange_draw_pseudofade: |
| 1274 |
} |
| 1275 |
{1}{ |
| 1276 |
\__timechart_interval_startrange_slant_compute: |
| 1277 |
} |
| 1278 |
} |
| 1279 |
} |
| 1280 |
\cs_new:Npn \__timechart_interval_startrange_slant_compute: |
| 1281 |
{ |
| 1282 |
\__timechart_debug:n{~(Startrange~slant)} |
| 1283 |
\bool_if:NTF\l__timechart_interval_start_beyond_bool |
| 1284 |
{ |
| 1285 |
\bool_if:NTF\l__timechart_interval_startrange_finish_beyond_bool |
| 1286 |
{ |
| 1287 |
\cs_set_eq:NN |
| 1288 |
\__timechart_interval_both_clip_path: |
| 1289 |
\__timechart_interval_startrange_clip_path_beyond_both: |
| 1290 |
} |
| 1291 |
{ |
| 1292 |
\cs_set_eq:NN |
| 1293 |
\__timechart_interval_start_clip_path: |
| 1294 |
\__timechart_interval_startrange_clip_path_beyond_start: |
| 1295 |
} |
| 1296 |
} |
| 1297 |
{ |
| 1298 |
\bool_if:NTF\l__timechart_interval_startrange_finish_beyond_bool |
| 1299 |
{ |
| 1300 |
\cs_set_eq:NN |
| 1301 |
\__timechart_interval_both_clip_path: |
| 1302 |
\__timechart_interval_startrange_clip_path_beyond_finish: |
| 1303 |
} |
| 1304 |
{ |
| 1305 |
\cs_set_eq:NN |
| 1306 |
\__timechart_interval_start_clip_path: |
| 1307 |
\__timechart_interval_startrange_clip_path_start: |
| 1308 |
} |
| 1309 |
} |
| 1310 |
\cs_if_eq:NNTF\__timechart_interval_solid_draw:\prg_do_nothing: |
| 1311 |
{ |
| 1312 |
\cs_set_eq:NN |
| 1313 |
\__timechart_interval_startrange_draw: |
| 1314 |
\__timechart_interval_startfinishrange_draw_slant: |
| 1315 |
} |
| 1316 |
{ |
| 1317 |
\cs_set_eq:NN |
| 1318 |
\l__timechart_interval_solid_start_x |
| 1319 |
\l__timechart_start_beyond_x |
| 1320 |
\cs_set_eq:NN |
| 1321 |
\__timechart_interval_startrange_draw: |
| 1322 |
\prg_do_nothing: |
| 1323 |
} |
| 1324 |
} |
| 1325 |
\cs_new:Npn\__timechart_interval_finishrange_compute: |
| 1326 |
{ |
| 1327 |
\__timechart_debug:n{Computing:~finishrange} |
| 1328 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool} |
| 1329 |
{ |
| 1330 |
\l__timechart_interval_finish_max_x |
| 1331 |
== \l__timechart_interval_finish_min_x |
| 1332 |
} |
| 1333 |
\bool_if:NTF\l__timechart_tmpa_bool |
| 1334 |
{ |
| 1335 |
\cs_set_eq:NN\__timechart_interval_finishrange_draw:\prg_do_nothing: |
| 1336 |
} |
| 1337 |
{ |
| 1338 |
\__timechart_interval_finishrange_compute_ii: |
| 1339 |
} |
| 1340 |
} |
| 1341 |
\bool_new:N\l__timechart_interval_finishrange_start_beyond_bool |
| 1342 |
\cs_new:Npn\__timechart_interval_finishrange_compute_ii: |
| 1343 |
{ |
| 1344 |
\__timechart_debug:n{~(Stage~II)} |
| 1345 |
\bool_if:NTF\l__timechart_interval_finish_beyond_bool |
| 1346 |
{ |
| 1347 |
\cs_set_eq:NN |
| 1348 |
\l__timechart_interval_finishrange_finish_x |
| 1349 |
\l__timechart_finish_x |
| 1350 |
\pgfmathsetmacro{\l__timechart_interval_finishrange_finish_level_pgf} |
| 1351 |
{ |
| 1352 |
(\l__timechart_interval_finishrange_finish_x |
| 1353 |
-\l__timechart_interval_finish_max_x) |
| 1354 |
/ |
| 1355 |
(\l__timechart_interval_finish_min_x |
| 1356 |
-\l__timechart_interval_finish_max_x) |
| 1357 |
} |
| 1358 |
} |
| 1359 |
{ |
| 1360 |
\cs_set_eq:NN |
| 1361 |
\l__timechart_interval_finishrange_finish_x |
| 1362 |
\l__timechart_interval_finish_max_x |
| 1363 |
\pgfmathsetmacro |
| 1364 |
{\l__timechart_interval_finishrange_finish_level_pgf}{0} |
| 1365 |
} |
| 1366 |
|
| 1367 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool} |
| 1368 |
{ \l__timechart_interval_finish_min_x < \l__timechart_start_x } |
| 1369 |
\bool_set:Nn\l__timechart_interval_finishrange_start_beyond_bool |
| 1370 |
{ |
| 1371 |
\l__timechart_tmpa_bool |
| 1372 |
&& \l__timechart_interval_start_beyond_bool |
| 1373 |
} |
| 1374 |
\bool_if:NTF\l__timechart_interval_finishrange_start_beyond_bool |
| 1375 |
{ |
| 1376 |
\cs_set_eq:NN |
| 1377 |
\l__timechart_interval_finishrange_start_x |
| 1378 |
\l__timechart_start_x |
| 1379 |
\pgfmathsetmacro{\l__timechart_interval_finishrange_start_level_pgf} |
| 1380 |
{ |
| 1381 |
(\l__timechart_interval_finishrange_start_x |
| 1382 |
-\l__timechart_interval_finish_max_x) |
| 1383 |
/ |
| 1384 |
(\l__timechart_interval_finish_min_x |
| 1385 |
-\l__timechart_interval_finish_max_x) |
| 1386 |
} |
| 1387 |
} |
| 1388 |
{ |
| 1389 |
\cs_set_eq:NN |
| 1390 |
\l__timechart_interval_finishrange_start_x |
| 1391 |
\l__timechart_interval_finish_min_x |
| 1392 |
\pgfmathsetmacro |
| 1393 |
{\l__timechart_interval_finishrange_start_level_pgf}{1} |
| 1394 |
} |
| 1395 |
\int_case:nn {\l__timechart_finish_range_type_int} |
| 1396 |
{ |
| 1397 |
{0}{ |
| 1398 |
\cs_set_eq:NN |
| 1399 |
\__timechart_interval_finishrange_draw: |
| 1400 |
\__timechart_interval_finishrange_draw_pseudofade: |
| 1401 |
} |
| 1402 |
{1}{ |
| 1403 |
\__timechart_interval_finishrange_slant_compute: |
| 1404 |
} |
| 1405 |
} |
| 1406 |
} |
| 1407 |
\cs_new:Npn \__timechart_interval_finishrange_slant_compute: |
| 1408 |
{ |
| 1409 |
\__timechart_debug:n{~(Finishrange~slant)} |
| 1410 |
\bool_if:NTF\l__timechart_interval_finish_beyond_bool |
| 1411 |
{ |
| 1412 |
\bool_if:NTF\l__timechart_interval_finishrange_start_beyond_bool |
| 1413 |
{ |
| 1414 |
\cs_set_eq:NN |
| 1415 |
\__timechart_interval_both_clip_path: |
| 1416 |
\__timechart_interval_finishrange_clip_path_beyond_both: |
| 1417 |
} |
| 1418 |
{ |
| 1419 |
\cs_set_eq:NN |
| 1420 |
\__timechart_interval_finish_clip_path: |
| 1421 |
\__timechart_interval_finishrange_clip_path_beyond_finish: |
| 1422 |
} |
| 1423 |
} |
| 1424 |
{ |
| 1425 |
\bool_if:NTF\l__timechart_interval_finishrange_start_beyond_bool |
| 1426 |
{ |
| 1427 |
\cs_set_eq:NN |
| 1428 |
\__timechart_interval_both_clip_path: |
| 1429 |
\__timechart_interval_finishrange_clip_path_beyond_start: |
| 1430 |
} |
| 1431 |
{ |
| 1432 |
\cs_set_eq:NN |
| 1433 |
\__timechart_interval_finish_clip_path: |
| 1434 |
\__timechart_interval_finishrange_clip_path_finish: |
| 1435 |
} |
| 1436 |
} |
| 1437 |
\cs_if_eq:NNTF\__timechart_interval_solid_draw:\prg_do_nothing: |
| 1438 |
{ |
| 1439 |
\cs_set_eq:NN |
| 1440 |
\__timechart_interval_finishrange_draw: |
| 1441 |
\__timechart_interval_startfinishrange_draw_slant: |
| 1442 |
} |
| 1443 |
{ |
| 1444 |
\cs_set_eq:NN |
| 1445 |
\l__timechart_interval_solid_finish_x |
| 1446 |
\l__timechart_finish_beyond_x |
| 1447 |
\cs_set_eq:NN |
| 1448 |
\__timechart_interval_finishrange_draw: |
| 1449 |
\prg_do_nothing: |
| 1450 |
} |
| 1451 |
} |
| 1452 |
\cs_new:Npn\__timechart_interval_solid_draw: |
| 1453 |
{ |
| 1454 |
\__timechart_debug:n{ |
| 1455 |
Drawing:~solid~\l__timechart_interval_solid_start_x~ |
| 1456 |
to~\l__timechart_interval_solid_finish_x |
| 1457 |
} |
| 1458 |
\pgfpathrectanglecorners{ |
| 1459 |
\pgfpoint |
| 1460 |
{\l__timechart_interval_solid_start_x} |
| 1461 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1462 |
}{ |
| 1463 |
\pgfpoint |
| 1464 |
{\l__timechart_interval_solid_finish_x} |
| 1465 |
{\l__timechart_bar_half_thickness_pgf} |
| 1466 |
} |
| 1467 |
\pgfsetfillcolor{\l__timechart_bar_color} |
| 1468 |
\pgfusepath{fill} |
| 1469 |
} |
| 1470 |
\cs_new:Npn\__timechart_interval_startrange_draw_pseudofade: |
| 1471 |
{ |
| 1472 |
\__timechart_debug:n{Drawing:~startrange,~pseudofade} |
| 1473 |
\__timechart_debug:n{~ |
| 1474 |
\l__timechart_interval_startrange_start_x~ |
| 1475 |
(\l__timechart_interval_startrange_start_level_pgf)~ |
| 1476 |
to~\l__timechart_interval_startrange_finish_x~ |
| 1477 |
(\l__timechart_interval_startrange_finish_level_pgf) |
| 1478 |
} |
| 1479 |
\__timechart_interval_draw_pseudofade:nnnnn |
| 1480 |
{\l__timechart_interval_startrange_start_x} |
| 1481 |
{\l__timechart_interval_startrange_finish_x} |
| 1482 |
{\l__timechart_bar_color} |
| 1483 |
{\l__timechart_interval_startrange_start_level_pgf} |
| 1484 |
{\l__timechart_interval_startrange_finish_level_pgf} |
| 1485 |
\bool_if:NT\l__timechart_interval_start_beyond_bool |
| 1486 |
{ \__timechart_interval_startrange_start_beyond_draw_fade: } |
| 1487 |
\bool_if:NT\l__timechart_interval_startrange_finish_beyond_bool |
| 1488 |
{ \__timechart_interval_startrange_finish_beyond_draw_fade: } |
| 1489 |
} |
| 1490 |
\cs_new:Npn\__timechart_interval_startrange_start_beyond_draw_fade: |
| 1491 |
{ |
| 1492 |
\__timechart_debug:n{Drawing:~startrange,~pseudofade~beyond~start} |
| 1493 |
\__timechart_debug:n{~ |
| 1494 |
\l__timechart_start_beyond_x~to~\l__timechart_start_x |
| 1495 |
} |
| 1496 |
\pgfscope |
| 1497 |
\pgfpathrectanglecorners{ |
| 1498 |
\pgfpoint |
| 1499 |
{\l__timechart_start_beyond_x} |
| 1500 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1501 |
}{ |
| 1502 |
\pgfpoint |
| 1503 |
{\l__timechart_start_x} |
| 1504 |
{\l__timechart_bar_half_thickness_pgf} |
| 1505 |
} |
| 1506 |
\pgfsetfillcolor{\l__timechart_bar_color} |
| 1507 |
\pgfsetfillopacity |
| 1508 |
{\l__timechart_interval_startrange_start_level_pgf} |
| 1509 |
\pgfusepath{fill} |
| 1510 |
\endpgfscope |
| 1511 |
} |
| 1512 |
\cs_new:Npn\__timechart_interval_startrange_finish_beyond_draw_fade: |
| 1513 |
{ |
| 1514 |
\__timechart_debug:n{Drawing:~startrange,~pseudofade~beyond~finish} |
| 1515 |
\__timechart_debug:n{~ |
| 1516 |
\l__timechart_finish_beyond_x~to~\l__timechart_finish_x |
| 1517 |
} |
| 1518 |
\pgfscope |
| 1519 |
\pgfpathrectanglecorners{ |
| 1520 |
\pgfpoint |
| 1521 |
{\l__timechart_finish_x} |
| 1522 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1523 |
}{ |
| 1524 |
\pgfpoint |
| 1525 |
{\l__timechart_finish_beyond_x} |
| 1526 |
{\l__timechart_bar_half_thickness_pgf} |
| 1527 |
} |
| 1528 |
\pgfsetfillcolor{\l__timechart_bar_color} |
| 1529 |
\pgfsetfillopacity |
| 1530 |
{\l__timechart_interval_startrange_finish_level_pgf} |
| 1531 |
\pgfusepath{fill} |
| 1532 |
\endpgfscope |
| 1533 |
} |
| 1534 |
\cs_new:Npn\__timechart_interval_finishrange_draw_pseudofade: |
| 1535 |
{ |
| 1536 |
\__timechart_debug:n{Drawing:~finishrange,~pseudofade} |
| 1537 |
\__timechart_debug:n{~ |
| 1538 |
\l__timechart_interval_finishrange_start_x~ |
| 1539 |
(\l__timechart_interval_finishrange_start_level_pgf)~ |
| 1540 |
to~\l__timechart_interval_finishrange_finish_x~ |
| 1541 |
(\l__timechart_interval_finishrange_finish_level_pgf) |
| 1542 |
} |
| 1543 |
\__timechart_interval_draw_pseudofade:nnnnn |
| 1544 |
{\l__timechart_interval_finishrange_start_x} |
| 1545 |
{\l__timechart_interval_finishrange_finish_x} |
| 1546 |
{\l__timechart_bar_color} |
| 1547 |
{\l__timechart_interval_finishrange_start_level_pgf} |
| 1548 |
{\l__timechart_interval_finishrange_finish_level_pgf} |
| 1549 |
\bool_if:NT\l__timechart_interval_finish_beyond_bool |
| 1550 |
{ \__timechart_interval_finishrange_finish_beyond_draw_fade: } |
| 1551 |
\bool_if:NT\l__timechart_interval_finishrange_start_beyond_bool |
| 1552 |
{ \__timechart_interval_finishrange_start_beyond_draw_fade: } |
| 1553 |
} |
| 1554 |
|
| 1555 |
\cs_new:Npn\__timechart_interval_finishrange_finish_beyond_draw_fade: |
| 1556 |
{ |
| 1557 |
\__timechart_debug:n{Drawing:~finishrange,~pseudofade~beyond~finish} |
| 1558 |
\__timechart_debug:n{~ |
| 1559 |
\l__timechart_finish_beyond_x~to~\l__timechart_finish_x |
| 1560 |
} |
| 1561 |
\pgfscope |
| 1562 |
\pgfpathrectanglecorners{ |
| 1563 |
\pgfpoint |
| 1564 |
{\l__timechart_finish_beyond_x} |
| 1565 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1566 |
}{ |
| 1567 |
\pgfpoint |
| 1568 |
{\l__timechart_finish_x} |
| 1569 |
{\l__timechart_bar_half_thickness_pgf} |
| 1570 |
} |
| 1571 |
\pgfsetfillcolor{\l__timechart_bar_color} |
| 1572 |
\pgfsetfillopacity |
| 1573 |
{\l__timechart_interval_finishrange_finish_level_pgf} |
| 1574 |
\pgfusepath{fill} |
| 1575 |
\endpgfscope |
| 1576 |
} |
| 1577 |
\cs_new:Npn\__timechart_interval_finishrange_start_beyond_draw_fade: |
| 1578 |
{ |
| 1579 |
\__timechart_debug:n{Drawing:~finishrange,~pseudofade~beyond~start} |
| 1580 |
\__timechart_debug:n{~ |
| 1581 |
\l__timechart_start_beyond_x~to~\l__timechart_start_x |
| 1582 |
} |
| 1583 |
\pgfscope |
| 1584 |
\pgfpathrectanglecorners{ |
| 1585 |
\pgfpoint |
| 1586 |
{\l__timechart_start_x} |
| 1587 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1588 |
}{ |
| 1589 |
\pgfpoint |
| 1590 |
{\l__timechart_start_beyond_x} |
| 1591 |
{\l__timechart_bar_half_thickness_pgf} |
| 1592 |
} |
| 1593 |
\pgfsetfillcolor{\l__timechart_bar_color} |
| 1594 |
\pgfsetfillopacity |
| 1595 |
{\l__timechart_interval_finishrange_start_level_pgf} |
| 1596 |
\pgfusepath{fill} |
| 1597 |
\endpgfscope |
| 1598 |
} |
| 1599 |
\pgfmathsetmacro{\l__timechart_fadestep_pgf}{1} |
| 1600 |
\cs_new:Npn\__timechart_interval_draw_pseudofade:nnnnn #1#2#3#4#5 |
| 1601 |
{ |
| 1602 |
\__timechart_debug:n{Pseudofade:~#1~to~#2,~color~#3,~opacity~#4~to~#5} |
| 1603 |
\group_begin: |
| 1604 |
\pgfmathsetmacro{\start}{#1} |
| 1605 |
\pgfmathsetmacro{\stop}{#2} |
| 1606 |
\pgfmathsetmacro{\fadestep} |
| 1607 |
{(\stop-\start)/(floor((\stop-\start)/\l__timechart_fadestep_pgf)+1)} |
| 1608 |
\pgfmathsetmacro{\startnext}{\start+\fadestep} |
| 1609 |
\pgfmathsetmacro{\stopprev}{\stop-\fadestep} |
| 1610 |
\pgfmathsetmacro{\denominator}{abs(\stop-\start)+\fadestep} |
| 1611 |
\foreach \xa in {\start,\startnext,...,\stopprev} { |
| 1612 |
\pgfmathsetlengthmacro{\o} |
| 1613 |
{((\stop-\xa)*#4+(\xa-\start+\fadestep)*#5)/\denominator} |
| 1614 |
\pgfscope |
| 1615 |
\pgfpathrectanglecorners{ |
| 1616 |
\pgfpoint{\xa}{-\l__timechart_bar_half_thickness_pgf} |
| 1617 |
}{ |
| 1618 |
\pgfpoint{\xa+\fadestep}{\l__timechart_bar_half_thickness_pgf} |
| 1619 |
} |
| 1620 |
\pgfsetfillcolor{#3} |
| 1621 |
\pgfsetfillopacity{\o} |
| 1622 |
\pgfusepath{fill} |
| 1623 |
\endpgfscope |
| 1624 |
} |
| 1625 |
\group_end: |
| 1626 |
} |
| 1627 |
\cs_new:Npn\__timechart_interval_startfinishrange_draw_slant: |
| 1628 |
{ |
| 1629 |
\pgfpathrectanglecorners{ |
| 1630 |
\pgfpoint |
| 1631 |
{\l__timechart_start_beyond_x} |
| 1632 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1633 |
}{ |
| 1634 |
\pgfpoint |
| 1635 |
{\l__timechart_finish_beyond_x} |
| 1636 |
{\l__timechart_bar_half_thickness_pgf} |
| 1637 |
} |
| 1638 |
\pgfsetfillcolor{\l__timechart_bar_color} |
| 1639 |
\pgfusepath{fill} |
| 1640 |
} |
| 1641 |
\pgfmathsetmacro{\c__timechart_left_far_x}{-16000pt} |
| 1642 |
\pgfmathsetmacro{\c__timechart_right_far_x}{16000pt} |
| 1643 |
\cs_new:Npn\__timechart_interval_start_clip_path_none: |
| 1644 |
{ |
| 1645 |
\__timechart_debug:n{~Start~clip~path:~none} |
| 1646 |
\pgfpathlineto{ |
| 1647 |
\pgfpoint |
| 1648 |
{\c__timechart_left_far_x} |
| 1649 |
{-\l__timechart_bar_thickness_pgf} |
| 1650 |
} |
| 1651 |
\pgfpathlineto{ |
| 1652 |
\pgfpoint |
| 1653 |
{\c__timechart_left_far_x} |
| 1654 |
{\l__timechart_bar_thickness_pgf} |
| 1655 |
} |
| 1656 |
} |
| 1657 |
\cs_new:Npn\__timechart_interval_finish_clip_path_none: |
| 1658 |
{ |
| 1659 |
\__timechart_debug:n{~Finish~clip~path:~none} |
| 1660 |
\pgfpathmoveto{ |
| 1661 |
\pgfpoint |
| 1662 |
{\c__timechart_right_far_x} |
| 1663 |
{\l__timechart_bar_thickness_pgf} |
| 1664 |
} |
| 1665 |
\pgfpathlineto{ |
| 1666 |
\pgfpoint |
| 1667 |
{\c__timechart_right_far_x} |
| 1668 |
{-\l__timechart_bar_thickness_pgf} |
| 1669 |
} |
| 1670 |
} |
| 1671 |
\cs_new:Npn\__timechart_interval_start_clip_path_beyond: |
| 1672 |
{ |
| 1673 |
\__timechart_debug:n{~Start~clip~path:~beyond} |
| 1674 |
\pgfpathlineto{ |
| 1675 |
\pgfpoint |
| 1676 |
{\l__timechart_start_beyond_x} |
| 1677 |
{-\l__timechart_bar_thickness_pgf} |
| 1678 |
} |
| 1679 |
\pgfpathlineto{ |
| 1680 |
\pgfpoint |
| 1681 |
{\l__timechart_start_beyond_x} |
| 1682 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1683 |
} |
| 1684 |
\pgfpatharc |
| 1685 |
{-90} |
| 1686 |
{90} |
| 1687 |
{\l__timechart_start_beyond_x_radius_pgf |
| 1688 |
~and~\l__timechart_bar_half_thickness_pgf} |
| 1689 |
\pgfpathlineto{ |
| 1690 |
\pgfpoint |
| 1691 |
{\l__timechart_start_beyond_x} |
| 1692 |
{\l__timechart_bar_thickness_pgf} |
| 1693 |
} |
| 1694 |
} |
| 1695 |
\cs_new:Npn\__timechart_interval_finish_clip_path_beyond: |
| 1696 |
{ |
| 1697 |
\__timechart_debug:n{~Finish~clip~path:~beyond} |
| 1698 |
\pgfpathmoveto{ |
| 1699 |
\pgfpoint |
| 1700 |
{\l__timechart_finish_beyond_x} |
| 1701 |
{\l__timechart_bar_thickness_pgf} |
| 1702 |
} |
| 1703 |
\pgfpathlineto{ |
| 1704 |
\pgfpoint |
| 1705 |
{\l__timechart_finish_beyond_x} |
| 1706 |
{\l__timechart_bar_half_thickness_pgf} |
| 1707 |
} |
| 1708 |
\pgfpatharc |
| 1709 |
{90} |
| 1710 |
{270} |
| 1711 |
{\l__timechart_finish_beyond_x_radius_pgf |
| 1712 |
~and~\l__timechart_bar_half_thickness_pgf} |
| 1713 |
\pgfpathlineto{ |
| 1714 |
\pgfpoint |
| 1715 |
{\l__timechart_finish_beyond_x} |
| 1716 |
{-\l__timechart_bar_thickness_pgf} |
| 1717 |
} |
| 1718 |
} |
| 1719 |
\cs_new:Npn\__timechart_interval_startrange_clip_path_start: |
| 1720 |
{ |
| 1721 |
\__timechart_debug:n{~Start~clip~path:~startrange} |
| 1722 |
\pgfpathlineto{ |
| 1723 |
\pgfpoint |
| 1724 |
{\l__timechart_interval_startrange_start_x} |
| 1725 |
{-\l__timechart_bar_thickness_pgf} |
| 1726 |
} |
| 1727 |
\pgfpathlineto{ |
| 1728 |
\pgfpoint |
| 1729 |
{\l__timechart_interval_startrange_start_x} |
| 1730 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1731 |
} |
| 1732 |
\pgfpathlineto{ |
| 1733 |
\pgfpoint |
| 1734 |
{\l__timechart_interval_startrange_finish_x} |
| 1735 |
{\l__timechart_bar_half_thickness_pgf} |
| 1736 |
} |
| 1737 |
\pgfpathlineto{ |
| 1738 |
\pgfpoint |
| 1739 |
{\l__timechart_interval_startrange_finish_x} |
| 1740 |
{\l__timechart_bar_thickness_pgf} |
| 1741 |
} |
| 1742 |
} |
| 1743 |
\cs_new:Npn\__timechart_interval_finishrange_clip_path_finish: |
| 1744 |
{ |
| 1745 |
\__timechart_debug:n{~Finish~clip~path:~finishrange} |
| 1746 |
\pgfpathmoveto{ |
| 1747 |
\pgfpoint |
| 1748 |
{\l__timechart_interval_finishrange_finish_x} |
| 1749 |
{\l__timechart_bar_thickness_pgf} |
| 1750 |
} |
| 1751 |
\pgfpathlineto{ |
| 1752 |
\pgfpoint |
| 1753 |
{\l__timechart_interval_finishrange_finish_x} |
| 1754 |
{\l__timechart_bar_half_thickness_pgf} |
| 1755 |
} |
| 1756 |
\pgfpathlineto{ |
| 1757 |
\pgfpoint |
| 1758 |
{\l__timechart_interval_finishrange_start_x} |
| 1759 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1760 |
} |
| 1761 |
\pgfpathlineto{ |
| 1762 |
\pgfpoint |
| 1763 |
{\l__timechart_interval_finishrange_start_x} |
| 1764 |
{-\l__timechart_bar_thickness_pgf} |
| 1765 |
} |
| 1766 |
} |
| 1767 |
\cs_new:Npn \__timechart_interval_startrange_clip_path_beyond_start: |
| 1768 |
{ |
| 1769 |
\__timechart_debug:n{~Start~clip~path:~startrange,~beyond~start} |
| 1770 |
\pgfmathsetmacro{\l__timechart_tmpa_pgf}{ |
| 1771 |
\l__timechart_bar_thickness_pgf |
| 1772 |
*\l__timechart_interval_startrange_start_level_pgf |
| 1773 |
} |
| 1774 |
\pgfmathsetmacro{\l__timechart_tmpb_pgf}{ |
| 1775 |
.5*\l__timechart_tmpa_pgf |
| 1776 |
} |
| 1777 |
\pgfpathlineto{ |
| 1778 |
\pgfpoint |
| 1779 |
{\l__timechart_start_beyond_x} |
| 1780 |
{-\l__timechart_bar_thickness_pgf} |
| 1781 |
} |
| 1782 |
\pgfpathlineto{ |
| 1783 |
\pgfpoint |
| 1784 |
{\l__timechart_start_beyond_x} |
| 1785 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1786 |
} |
| 1787 |
\pgfpatharc |
| 1788 |
{-90} |
| 1789 |
{90} |
| 1790 |
{\l__timechart_start_beyond_x_radius_pgf |
| 1791 |
~and~\l__timechart_tmpb_pgf} |
| 1792 |
\pgfpathlineto{ |
| 1793 |
\pgfpointadd{ |
| 1794 |
\pgfpoint |
| 1795 |
{\l__timechart_start_x} |
| 1796 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1797 |
}{ |
| 1798 |
\pgfpoint{0}{\l__timechart_tmpa_pgf} |
| 1799 |
} |
| 1800 |
} |
| 1801 |
\pgfpathlineto{ |
| 1802 |
\pgfpoint |
| 1803 |
{\l__timechart_interval_start_max_x} |
| 1804 |
{\l__timechart_bar_half_thickness_pgf} |
| 1805 |
} |
| 1806 |
\pgfpathlineto{ |
| 1807 |
\pgfpoint |
| 1808 |
{\l__timechart_interval_start_max_x} |
| 1809 |
{\l__timechart_bar_thickness_pgf} |
| 1810 |
} |
| 1811 |
} |
| 1812 |
\cs_new:Npn\__timechart_interval_finishrange_clip_path_beyond_finish: |
| 1813 |
{ |
| 1814 |
\__timechart_debug:n{~Finish~clip~path:~finishrange,~beyond~finish} |
| 1815 |
\pgfmathsetmacro{\l__timechart_tmpa_pgf}{ |
| 1816 |
\l__timechart_bar_thickness_pgf |
| 1817 |
*\l__timechart_interval_finishrange_finish_level_pgf |
| 1818 |
} |
| 1819 |
\pgfmathsetmacro{\l__timechart_tmpb_pgf}{ |
| 1820 |
.5*\l__timechart_tmpa_pgf |
| 1821 |
} |
| 1822 |
\pgfpathmoveto{ |
| 1823 |
\pgfpoint |
| 1824 |
{\l__timechart_finish_beyond_x} |
| 1825 |
{\l__timechart_bar_thickness_pgf} |
| 1826 |
} |
| 1827 |
\pgfpathlineto{ |
| 1828 |
\pgfpoint |
| 1829 |
{\l__timechart_finish_beyond_x} |
| 1830 |
{\l__timechart_bar_half_thickness_pgf} |
| 1831 |
} |
| 1832 |
\pgfpatharc |
| 1833 |
{90} |
| 1834 |
{270} |
| 1835 |
{\l__timechart_finish_beyond_x_radius_pgf |
| 1836 |
~and~\l__timechart_tmpb_pgf} |
| 1837 |
\pgfpathlineto{ |
| 1838 |
\pgfpointadd{ |
| 1839 |
\pgfpoint |
| 1840 |
{\l__timechart_finish_x} |
| 1841 |
{\l__timechart_bar_half_thickness_pgf} |
| 1842 |
}{ |
| 1843 |
\pgfpoint{0}{-\l__timechart_tmpa_pgf} |
| 1844 |
} |
| 1845 |
} |
| 1846 |
\pgfpathlineto{ |
| 1847 |
\pgfpoint |
| 1848 |
{\l__timechart_interval_finish_min_x} |
| 1849 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1850 |
} |
| 1851 |
\pgfpathlineto{ |
| 1852 |
\pgfpoint |
| 1853 |
{\l__timechart_interval_finish_min_x} |
| 1854 |
{-\l__timechart_bar_thickness_pgf} |
| 1855 |
} |
| 1856 |
} |
| 1857 |
\cs_new:Npn\__timechart_interval_startrange_clip_path_beyond_finish: |
| 1858 |
{ |
| 1859 |
\__timechart_debug:n{~Two-sided~clip~path:~startrange,~beyond~finish} |
| 1860 |
\pgfmathsetmacro{\l__timechart_tmpc_pgf}{ |
| 1861 |
\l__timechart_bar_thickness_pgf |
| 1862 |
*\l__timechart_interval_startrange_finish_level_pgf |
| 1863 |
} |
| 1864 |
\pgfmathsetmacro{\l__timechart_tmpd_pgf}{ |
| 1865 |
.5*\l__timechart_tmpc_pgf |
| 1866 |
} |
| 1867 |
\pgfpathmoveto{ |
| 1868 |
\pgfpointadd{ |
| 1869 |
\pgfpoint |
| 1870 |
{\l__timechart_finish_beyond_x} |
| 1871 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1872 |
}{ |
| 1873 |
\pgfpoint{0}{\l__timechart_tmpc_pgf} |
| 1874 |
} |
| 1875 |
} |
| 1876 |
\pgfpatharc |
| 1877 |
{90} |
| 1878 |
{270} |
| 1879 |
{\l__timechart_start_beyond_x_radius_pgf |
| 1880 |
~and~\l__timechart_tmpd_pgf} |
| 1881 |
\pgfpathlineto{ |
| 1882 |
\pgfpoint |
| 1883 |
{\l__timechart_finish_beyond_x} |
| 1884 |
{-\l__timechart_bar_thickness_pgf} |
| 1885 |
} |
| 1886 |
\pgfpathlineto{ |
| 1887 |
\pgfpoint |
| 1888 |
{\l__timechart_interval_start_min_x} |
| 1889 |
{-\l__timechart_bar_thickness_pgf} |
| 1890 |
} |
| 1891 |
\pgfpathlineto{ |
| 1892 |
\pgfpoint |
| 1893 |
{\l__timechart_interval_start_min_x} |
| 1894 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1895 |
} |
| 1896 |
\pgfpathlineto{ |
| 1897 |
\pgfpointadd{ |
| 1898 |
\pgfpoint |
| 1899 |
{\l__timechart_finish_x} |
| 1900 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1901 |
}{ |
| 1902 |
\pgfpoint{0}{\l__timechart_tmpc_pgf} |
| 1903 |
} |
| 1904 |
} |
| 1905 |
} |
| 1906 |
\cs_new:Npn\__timechart_interval_finishrange_clip_path_beyond_start: |
| 1907 |
{ |
| 1908 |
\__timechart_debug:n{~Two-sided~clip~path:~finishrange,~beyond~start} |
| 1909 |
\pgfmathsetmacro{\l__timechart_tmpc_pgf}{ |
| 1910 |
\l__timechart_bar_thickness_pgf |
| 1911 |
*\l__timechart_interval_finishrange_start_level_pgf |
| 1912 |
} |
| 1913 |
\pgfmathsetmacro{\l__timechart_tmpd_pgf}{ |
| 1914 |
.5*\l__timechart_tmpc_pgf |
| 1915 |
} |
| 1916 |
\pgfpathmoveto{ |
| 1917 |
\pgfpointadd{ |
| 1918 |
\pgfpoint |
| 1919 |
{\l__timechart_start_beyond_x} |
| 1920 |
{\l__timechart_bar_half_thickness_pgf} |
| 1921 |
}{ |
| 1922 |
\pgfpoint{0}{-\l__timechart_tmpc_pgf} |
| 1923 |
} |
| 1924 |
} |
| 1925 |
\pgfpatharc |
| 1926 |
{-90} |
| 1927 |
{90} |
| 1928 |
{\l__timechart_start_beyond_x_radius_pgf |
| 1929 |
~and~\l__timechart_tmpd_pgf} |
| 1930 |
\pgfpathlineto{ |
| 1931 |
\pgfpoint |
| 1932 |
{\l__timechart_start_beyond_x} |
| 1933 |
{\l__timechart_bar_thickness_pgf} |
| 1934 |
} |
| 1935 |
\pgfpathlineto{ |
| 1936 |
\pgfpoint |
| 1937 |
{\l__timechart_interval_finish_max_x} |
| 1938 |
{\l__timechart_bar_thickness_pgf} |
| 1939 |
} |
| 1940 |
\pgfpathlineto{ |
| 1941 |
\pgfpoint |
| 1942 |
{\l__timechart_interval_finish_max_x} |
| 1943 |
{\l__timechart_bar_half_thickness_pgf} |
| 1944 |
} |
| 1945 |
\pgfpathlineto{ |
| 1946 |
\pgfpointadd{ |
| 1947 |
\pgfpoint |
| 1948 |
{\l__timechart_start_x} |
| 1949 |
{\l__timechart_bar_half_thickness_pgf} |
| 1950 |
}{ |
| 1951 |
\pgfpoint{0}{-\l__timechart_tmpc_pgf} |
| 1952 |
} |
| 1953 |
} |
| 1954 |
} |
| 1955 |
\cs_new:Npn\__timechart_interval_startrange_clip_path_beyond_both: |
| 1956 |
{ |
| 1957 |
\__timechart_debug:n{~Two-sided~clip~path:~startrange,~beyond~both} |
| 1958 |
\pgfmathsetmacro{\l__timechart_tmpa_pgf}{ |
| 1959 |
\l__timechart_bar_thickness_pgf |
| 1960 |
*\l__timechart_interval_startrange_start_level_pgf |
| 1961 |
} |
| 1962 |
\pgfmathsetmacro{\l__timechart_tmpb_pgf}{ |
| 1963 |
.5*\l__timechart_tmpa_pgf |
| 1964 |
} |
| 1965 |
\pgfmathsetmacro{\l__timechart_tmpc_pgf}{ |
| 1966 |
\l__timechart_bar_thickness_pgf |
| 1967 |
*\l__timechart_interval_startrange_finish_level_pgf |
| 1968 |
} |
| 1969 |
\pgfmathsetmacro{\l__timechart_tmpd_pgf}{ |
| 1970 |
.5*\l__timechart_tmpc_pgf |
| 1971 |
} |
| 1972 |
\pgfpathmoveto{ |
| 1973 |
\pgfpointadd{ |
| 1974 |
\pgfpoint |
| 1975 |
{\l__timechart_finish_beyond_x} |
| 1976 |
{-\l__timechart_bar_half_thickness_pgf} |
| 1977 |
}{ |
| 1978 |
\pgfpoint{0}{\l__timechart_tmpc_pgf} |
| 1979 |
} |
| 1980 |
} |
| 1981 |
\pgfpatharc |
| 1982 |
{90} |
| 1983 |
{270} |
| 1984 |
{\l__timechart_finish_beyond_x_radius_pgf |
| 1985 |
~and~\l__timechart_tmpd_pgf} |
| 1986 |
\pgfpathlineto{ |
| 1987 |
\pgfpoint |
| 1988 |
{\l__timechart_finish_beyond_x} |
| 1989 |
{-\l__timechart_bar_thickness_pgf} |
| 1990 |
} |
| 1991 |
\pgfpathlineto{ |
| 1992 |
\pgfpoint |
| 1993 |
{\l__timechart_start_beyond_x} |
| 1994 |
{-\l__timechart_bar_thickness_pgf} |
| 1995 |
} |
| 1996 |
\pgfpathlineto{ |
| 1997 |
\pgfpoint |
| 1998 |
{\l__timechart_start_beyond_x} |
| 1999 |
{-\l__timechart_bar_half_thickness_pgf} |
| 2000 |
} |
| 2001 |
\pgfpatharc |
| 2002 |
{-90} |
| 2003 |
{90} |
| 2004 |
{\l__timechart_start_beyond_x_radius_pgf |
| 2005 |
~and~\l__timechart_tmpb_pgf} |
| 2006 |
\pgfpathlineto{ |
| 2007 |
\pgfpointadd{ |
| 2008 |
\pgfpoint |
| 2009 |
{\l__timechart_start_x} |
| 2010 |
{-\l__timechart_bar_half_thickness_pgf} |
| 2011 |
}{ |
| 2012 |
\pgfpoint{0}{\l__timechart_tmpa_pgf} |
| 2013 |
} |
| 2014 |
} |
| 2015 |
\pgfpathlineto{ |
| 2016 |
\pgfpointadd{ |
| 2017 |
\pgfpoint |
| 2018 |
{\l__timechart_finish_x} |
| 2019 |
{-\l__timechart_bar_half_thickness_pgf} |
| 2020 |
}{ |
| 2021 |
\pgfpoint{0}{\l__timechart_tmpc_pgf} |
| 2022 |
} |
| 2023 |
} |
| 2024 |
} |
| 2025 |
\cs_new:Npn\__timechart_interval_finishrange_clip_path_beyond_both: |
| 2026 |
{ |
| 2027 |
\__timechart_debug:n{~Two-sided~clip~path:~finishrange,~beyond~both} |
| 2028 |
\pgfmathsetmacro{\l__timechart_tmpa_pgf}{ |
| 2029 |
\l__timechart_bar_thickness_pgf |
| 2030 |
*\l__timechart_interval_finishrange_finish_level_pgf |
| 2031 |
} |
| 2032 |
\pgfmathsetmacro{\l__timechart_tmpb_pgf}{ |
| 2033 |
.5*\l__timechart_tmpa_pgf |
| 2034 |
} |
| 2035 |
\pgfmathsetmacro{\l__timechart_tmpc_pgf}{ |
| 2036 |
\l__timechart_bar_thickness_pgf |
| 2037 |
*\l__timechart_interval_finishrange_start_level_pgf |
| 2038 |
} |
| 2039 |
\pgfmathsetmacro{\l__timechart_tmpd_pgf}{ |
| 2040 |
.5*\l__timechart_tmpc_pgf |
| 2041 |
} |
| 2042 |
\pgfpathmoveto{ |
| 2043 |
\pgfpointadd{ |
| 2044 |
\pgfpoint |
| 2045 |
{\l__timechart_start_beyond_x} |
| 2046 |
{\l__timechart_bar_half_thickness_pgf} |
| 2047 |
}{ |
| 2048 |
\pgfpoint{0}{-\l__timechart_tmpc_pgf} |
| 2049 |
} |
| 2050 |
} |
| 2051 |
\pgfpatharc |
| 2052 |
{-90} |
| 2053 |
{90} |
| 2054 |
{\l__timechart_start_beyond_x_radius_pgf |
| 2055 |
~and~\l__timechart_tmpd_pgf} |
| 2056 |
\pgfpathlineto{ |
| 2057 |
\pgfpoint |
| 2058 |
{\l__timechart_start_beyond_x} |
| 2059 |
{\l__timechart_bar_thickness_pgf} |
| 2060 |
} |
| 2061 |
\pgfpathlineto{ |
| 2062 |
\pgfpoint |
| 2063 |
{\l__timechart_finish_beyond_x} |
| 2064 |
{\l__timechart_bar_thickness_pgf} |
| 2065 |
} |
| 2066 |
\pgfpathlineto{ |
| 2067 |
\pgfpoint |
| 2068 |
{\l__timechart_finish_beyond_x} |
| 2069 |
{\l__timechart_bar_half_thickness_pgf} |
| 2070 |
} |
| 2071 |
\pgfpatharc |
| 2072 |
{90} |
| 2073 |
{270} |
| 2074 |
{\l__timechart_finish_beyond_x_radius_pgf |
| 2075 |
~and~\l__timechart_tmpb_pgf} |
| 2076 |
\pgfpathlineto{ |
| 2077 |
\pgfpointadd{ |
| 2078 |
\pgfpoint |
| 2079 |
{\l__timechart_finish_x} |
| 2080 |
{\l__timechart_bar_half_thickness_pgf} |
| 2081 |
}{ |
| 2082 |
\pgfpoint{0}{-\l__timechart_tmpa_pgf} |
| 2083 |
} |
| 2084 |
} |
| 2085 |
\pgfpathlineto{ |
| 2086 |
\pgfpointadd{ |
| 2087 |
\pgfpoint |
| 2088 |
{\l__timechart_start_x} |
| 2089 |
{\l__timechart_bar_half_thickness_pgf} |
| 2090 |
}{ |
| 2091 |
\pgfpoint{0}{-\l__timechart_tmpc_pgf} |
| 2092 |
} |
| 2093 |
} |
| 2094 |
} |
| 2095 |
\cs_new:Npn\__timechart_interval_clip: |
| 2096 |
{ |
| 2097 |
\__timechart_debug:n{Clipping:} |
| 2098 |
\pgfinterruptboundingbox |
| 2099 |
\__timechart_interval_both_clip_path: |
| 2100 |
\pgfpathclose |
| 2101 |
\pgfusepath{clip} |
| 2102 |
\endpgfinterruptboundingbox |
| 2103 |
} |
| 2104 |
\cs_new:Npn\__timechart_interval_both_clip_path: |
| 2105 |
{ |
| 2106 |
\cs_if_exist_use:NF\__timechart_interval_finish_clip_path: |
| 2107 |
{ \__timechart_interval_finish_clip_path_none: } |
| 2108 |
\cs_if_exist_use:NF\__timechart_interval_start_clip_path: |
| 2109 |
{ \__timechart_interval_start_clip_path_none: } |
| 2110 |
} |
| 2111 |
\msg_new:nnn{timechart}{interval_mark_outside} |
| 2112 |
{ Ignoring~mark~outside~interval~definite~part~at~date~#1 } |
| 2113 |
\cs_new:Npn\__timechart_interval_mark: |
| 2114 |
{ |
| 2115 |
\pgfscope |
| 2116 |
\bool_if:NTF\l__timechart_interval_start_beyond_bool |
| 2117 |
{ |
| 2118 |
\pgfmathsetmacro{\l__timechart_interval_mark_min_x} |
| 2119 |
{ max(\l__timechart_interval_start_max_x,\l__timechart_start_x) } |
| 2120 |
} |
| 2121 |
{ |
| 2122 |
\cs_set_eq:NN\l__timechart_interval_mark_min_x\l__timechart_interval_start_max_x |
| 2123 |
} |
| 2124 |
\bool_if:NTF\l__timechart_interval_finish_beyond_bool |
| 2125 |
{ |
| 2126 |
\pgfmathsetmacro{\l__timechart_interval_mark_max_x} |
| 2127 |
{ min(\l__timechart_interval_finish_min_x,\l__timechart_finish_x) } |
| 2128 |
} |
| 2129 |
{ |
| 2130 |
\cs_set_eq:NN\l__timechart_interval_mark_max_x\l__timechart_interval_finish_min_x |
| 2131 |
} |
| 2132 |
\pgfsetstrokecolor{\l__timechart_mark_color} |
| 2133 |
\foreach \year in \l__timechart_mark_text |
| 2134 |
{ |
| 2135 |
\pgfmathsetmacro{\l__timechart_mark_x}{yeartox(\year)} |
| 2136 |
\__timechart_pgfmathsetbool:nn{\l__timechart_tmpa_bool} |
| 2137 |
{ |
| 2138 |
and ( |
| 2139 |
\l__timechart_mark_x >= \l__timechart_interval_mark_min_x, |
| 2140 |
\l__timechart_mark_x <= \l__timechart_interval_mark_max_x |
| 2141 |
) |
| 2142 |
} |
| 2143 |
\bool_if:NTF\l__timechart_tmpa_bool |
| 2144 |
{ |
| 2145 |
\pgfpathmoveto{ |
| 2146 |
\pgfpoint |
| 2147 |
{\l__timechart_mark_x} |
| 2148 |
{-\l__timechart_bar_half_thickness_pgf} |
| 2149 |
} |
| 2150 |
\pgfpathlineto{ |
| 2151 |
\pgfpoint |
| 2152 |
{\l__timechart_mark_x} |
| 2153 |
{\l__timechart_bar_half_thickness_pgf} |
| 2154 |
} |
| 2155 |
\pgfusepath{draw} |
| 2156 |
} |
| 2157 |
{ \msg_warning:nne{timechart}{interval_mark_outside}{\year} } |
| 2158 |
} |
| 2159 |
\endpgfscope |
| 2160 |
} |
| 2161 |
\cs_new:Npn\__timechart_interval_define_bar_node: |
| 2162 |
{ |
| 2163 |
\__timechart_make_rectangle_node:nnnn |
| 2164 |
{ |
| 2165 |
\pgfpoint |
| 2166 |
{\l__timechart_interval_start_min_x} |
| 2167 |
{-\l__timechart_bar_half_thickness_pgf} |
| 2168 |
}{ |
| 2169 |
\pgfpoint |
| 2170 |
{\l__timechart_interval_finish_max_x} |
| 2171 |
{\l__timechart_bar_half_thickness_pgf} |
| 2172 |
} |
| 2173 |
{\pgfkeysvalueof{/timechart/interval~bar~node~name}} |
| 2174 |
{\c_false_bool} |
| 2175 |
} |
| 2176 |
\cs_new:Npn\__timechart_interval_label: |
| 2177 |
{ |
| 2178 |
\str_if_empty:NF \l__timechart_label_text |
| 2179 |
{ |
| 2180 |
\pgfinterruptboundingbox |
| 2181 |
\int_case:nn {\l__timechart_label_pos_int} |
| 2182 |
{ |
| 2183 |
{0}{ \__timechart_interval_label_left: } |
| 2184 |
{1}{ \__timechart_interval_label_center: } |
| 2185 |
{2}{ \__timechart_interval_label_right: } |
| 2186 |
} |
| 2187 |
\endpgfinterruptboundingbox |
| 2188 |
} |
| 2189 |
} |
| 2190 |
\cs_new:Npn\__timechart_interval_label_left: |
| 2191 |
{ |
| 2192 |
\__timechart_if_x_in_bounds:nT{\l__timechart_interval_start_min_x} |
| 2193 |
{ |
| 2194 |
\group_begin: |
| 2195 |
\pgftransformshift{ |
| 2196 |
\pgfpoint |
| 2197 |
{\l__timechart_interval_start_min_x} |
| 2198 |
{\l__timechart_text_baseline_pgf} |
| 2199 |
} |
| 2200 |
\node[/timechart/interval~label,anchor=base~east] |
| 2201 |
(\l__timechart_interval_label_node_name) |
| 2202 |
at (0,0) |
| 2203 |
{ |
| 2204 |
\__timechart_make_ref:NN |
| 2205 |
\l__timechart_ref_text |
| 2206 |
\l__timechart_label_text |
| 2207 |
}; |
| 2208 |
\group_end: |
| 2209 |
} |
| 2210 |
} |
| 2211 |
\cs_new:Npn\__timechart_interval_label_right: |
| 2212 |
{ |
| 2213 |
\__timechart_if_x_in_bounds:nT{\l__timechart_interval_finish_max_x} |
| 2214 |
{ |
| 2215 |
\group_begin: |
| 2216 |
\pgftransformshift{ |
| 2217 |
\pgfpoint |
| 2218 |
{\l__timechart_interval_finish_max_x} |
| 2219 |
{\l__timechart_text_baseline_pgf} |
| 2220 |
} |
| 2221 |
\node[/timechart/interval~label,anchor=base~west] |
| 2222 |
(\l__timechart_interval_label_node_name) |
| 2223 |
at (0,0) |
| 2224 |
{ |
| 2225 |
\__timechart_make_ref:NN |
| 2226 |
\l__timechart_ref_text |
| 2227 |
\l__timechart_label_text |
| 2228 |
}; |
| 2229 |
\group_end: |
| 2230 |
} |
| 2231 |
} |
| 2232 |
\cs_new:Npn\__timechart_interval_label_center: |
| 2233 |
{ |
| 2234 |
\pgfmathsetlengthmacro{\l__timechart_label_anchor_x} |
| 2235 |
{ |
| 2236 |
.5*max(\l__timechart_interval_start_max_x,\l__timechart_start_x) |
| 2237 |
+ .5*min(\l__timechart_interval_finish_min_x,\l__timechart_finish_x) |
| 2238 |
} |
| 2239 |
\group_begin: |
| 2240 |
\pgftransformshift{ |
| 2241 |
\pgfpoint |
| 2242 |
{\l__timechart_label_anchor_x} |
| 2243 |
{\l__timechart_text_baseline_pgf} |
| 2244 |
} |
| 2245 |
\pgfonlayer{labelbg} |
| 2246 |
\node[ |
| 2247 |
/timechart/interval~label~centered~background, |
| 2248 |
anchor=base |
| 2249 |
] |
| 2250 |
at (0,0) |
| 2251 |
{ \l__timechart_label_text }; |
| 2252 |
\endpgfonlayer |
| 2253 |
\group_end: |
| 2254 |
\pgfscope |
| 2255 |
\pgfpathrectanglecorners{ |
| 2256 |
\pgfpoint |
| 2257 |
{\l__timechart_interval_start_min_x} |
| 2258 |
{-\l__timechart_bar_half_thickness_pgf} |
| 2259 |
}{ |
| 2260 |
\pgfpoint |
| 2261 |
{\l__timechart_interval_finish_max_x} |
| 2262 |
{\l__timechart_bar_half_thickness_pgf} |
| 2263 |
} |
| 2264 |
\pgfusepath{clip} |
| 2265 |
\group_begin: |
| 2266 |
\pgftransformshift{ |
| 2267 |
\pgfpoint |
| 2268 |
{\l__timechart_label_anchor_x} |
| 2269 |
{\l__timechart_text_baseline_pgf} |
| 2270 |
} |
| 2271 |
\node[ |
| 2272 |
/timechart/interval~label~centered, |
| 2273 |
anchor=base |
| 2274 |
] |
| 2275 |
(\l__timechart_interval_label_node_name) |
| 2276 |
at (0,0) |
| 2277 |
{ |
| 2278 |
\__timechart_make_ref:NN |
| 2279 |
\l__timechart_ref_text |
| 2280 |
\l__timechart_label_text |
| 2281 |
}; |
| 2282 |
\group_end: |
| 2283 |
\endpgfscope |
| 2284 |
} |
| 2285 |
\NewDocumentCommand{\__timechart_text_user:Omm}{ O{} m m } |
| 2286 |
{ |
| 2287 |
\str_if_empty:nF{#3}{ |
| 2288 |
\group_begin: |
| 2289 |
\pgfmathsetmacro{\l__timechart_text_x}{yeartox(#2)} |
| 2290 |
\pgfqkeys{/timechart}{ |
| 2291 |
#1, |
| 2292 |
tolerance~start/.get=\l__timechart_start_tolerance_pgf, |
| 2293 |
tolerance~finish/.get=\l__timechart_finish_tolerance_pgf, |
| 2294 |
} |
| 2295 |
\__timechart_if_x_in_bounds:nT{\l__timechart_text_x} |
| 2296 |
{ |
| 2297 |
\pgfqkeys{/timechart}{ |
| 2298 |
ref/.get=\l__timechart_ref_text, |
| 2299 |
text~node~name/.get=\l__timechart_node_name_text, |
| 2300 |
text~baseline/.get=\l__timechart_text_baseline_pgf, |
| 2301 |
} |
| 2302 |
\pgftransformshift{ |
| 2303 |
\pgfpoint{0}{\l__timechart_current_y} |
| 2304 |
} |
| 2305 |
\pgfinterruptboundingbox |
| 2306 |
\group_begin: |
| 2307 |
\pgftransformshift{ |
| 2308 |
\pgfpoint{\l__timechart_text_x}{\l__timechart_text_baseline_pgf} |
| 2309 |
} |
| 2310 |
\cs_set:Npn\l__timechart_text{#3} |
| 2311 |
\int_case:nn {\l__timechart_text_pos_int} |
| 2312 |
{ |
| 2313 |
{0}{ \cs_set:Npn\l__timechart_node_anchor_text{base~east} } |
| 2314 |
{1}{ \cs_set:Npn\l__timechart_node_anchor_text{base} } |
| 2315 |
{2}{ \cs_set:Npn\l__timechart_node_anchor_text{base~west} } |
| 2316 |
} |
| 2317 |
\node[/timechart/text,anchor=\l__timechart_node_anchor_text] |
| 2318 |
(\l__timechart_node_name_text) |
| 2319 |
at (0,0) |
| 2320 |
{ |
| 2321 |
\__timechart_make_ref:NN |
| 2322 |
\l__timechart_ref_text |
| 2323 |
\l__timechart_text |
| 2324 |
}; |
| 2325 |
\group_end: |
| 2326 |
\endpgfinterruptboundingbox |
| 2327 |
} |
| 2328 |
\group_end: |
| 2329 |
} |
| 2330 |
\__timechart_space_user:O[#1] |
| 2331 |
} |
| 2332 |
\NewDocumentCommand{\__timechart_space_user:O}{ O{} } |
| 2333 |
{ |
| 2334 |
\group_begin: |
| 2335 |
|
| 2336 |
\pgfqkeys{/timechart}{ |
| 2337 |
#1, |
| 2338 |
interval~bar~thickness/.get=\l__timechart_bar_thickness_pgf, |
| 2339 |
} |
| 2340 |
\pgfmathsetlengthmacro{\l__timechart_bar_half_thickness_pgf} |
| 2341 |
{ .5*\l__timechart_bar_thickness_pgf } |
| 2342 |
\pgftransformshift{ |
| 2343 |
\pgfpoint{0}{\l__timechart_current_y} |
| 2344 |
} |
| 2345 |
\pgfpathmoveto{ |
| 2346 |
\pgfpoint{0}{-\l__timechart_bar_half_thickness_pgf} |
| 2347 |
} |
| 2348 |
\pgfpathmoveto{ |
| 2349 |
\pgfpoint{0}{\l__timechart_bar_half_thickness_pgf} |
| 2350 |
} |
| 2351 |
\pgfusepath{discard} |
| 2352 |
\group_end: |
| 2353 |
\bool_if:NT\l__timechart_autostep_bool{ |
| 2354 |
\__timechart_step_y_user:O |
| 2355 |
} |
| 2356 |
} |
| 2357 |
\NewDocumentCommand{\timechartlegenditem}{ O{} } |
| 2358 |
{ |
| 2359 |
\__timechart_legend_aux:nn{#1}{ |
| 2360 |
\pgfmathsetlengthmacro{\l__timechart_interval_solid_start_x}{0} |
| 2361 |
\pgfmathsetlengthmacro{\l__timechart_interval_solid_finish_x} |
| 2362 |
{\l__timechart_legenditem_width_pgf} |
| 2363 |
\__timechart_interval_solid_draw: |
| 2364 |
} |
| 2365 |
} |
| 2366 |
\NewDocumentCommand{\timechartlegendstartrange}{ O{} } |
| 2367 |
{ |
| 2368 |
\__timechart_legend_aux:nn{#1}{ |
| 2369 |
\pgfmathsetlengthmacro |
| 2370 |
{\l__timechart_interval_startrange_start_x}{0} |
| 2371 |
\pgfmathsetlengthmacro{\l__timechart_interval_startrange_finish_x} |
| 2372 |
{\l__timechart_legenditem_range_width_pgf} |
| 2373 |
\pgfmathsetlengthmacro |
| 2374 |
{\l__timechart_interval_startrange_start_level_pgf}{0} |
| 2375 |
\pgfmathsetlengthmacro |
| 2376 |
{\l__timechart_interval_startrange_finish_level_pgf}{1} |
| 2377 |
\pgfmathsetlengthmacro{\l__timechart_interval_solid_finish_x} |
| 2378 |
{\l__timechart_legenditem_width_pgf} |
| 2379 |
\int_case:nn {\l__timechart_start_range_type_int} |
| 2380 |
{ |
| 2381 |
{0}{ |
| 2382 |
\pgfmathsetlengthmacro{\l__timechart_interval_solid_start_x} |
| 2383 |
{\l__timechart_legenditem_range_width_pgf} |
| 2384 |
\__timechart_interval_startrange_draw_pseudofade: |
| 2385 |
} |
| 2386 |
{1}{ |
| 2387 |
\pgfmathsetlengthmacro{\l__timechart_interval_solid_start_x} |
| 2388 |
{\l__timechart_interval_startrange_start_x} |
| 2389 |
\pgfinterruptboundingbox |
| 2390 |
\__timechart_interval_finish_clip_path_none: |
| 2391 |
\__timechart_interval_startrange_clip_path_start: |
| 2392 |
\pgfpathclose |
| 2393 |
\pgfusepath{clip} |
| 2394 |
\endpgfinterruptboundingbox |
| 2395 |
} |
| 2396 |
} |
| 2397 |
\__timechart_interval_solid_draw: |
| 2398 |
} |
| 2399 |
} |
| 2400 |
\NewDocumentCommand{\timechartlegendfinishrange}{ O{} } |
| 2401 |
{ |
| 2402 |
\__timechart_legend_aux:nn{#1}{ |
| 2403 |
\pgfmathsetlengthmacro{\l__timechart_interval_finishrange_start_x} |
| 2404 |
{ |
| 2405 |
\l__timechart_legenditem_width_pgf |
| 2406 |
-\l__timechart_legenditem_range_width_pgf |
| 2407 |
} |
| 2408 |
\pgfmathsetlengthmacro{\l__timechart_interval_finishrange_finish_x} |
| 2409 |
{\l__timechart_legenditem_width_pgf} |
| 2410 |
\pgfmathsetlengthmacro |
| 2411 |
{\l__timechart_interval_finishrange_start_level_pgf}{1} |
| 2412 |
\pgfmathsetlengthmacro |
| 2413 |
{\l__timechart_interval_finishrange_finish_level_pgf}{0} |
| 2414 |
\pgfmathsetlengthmacro |
| 2415 |
{\l__timechart_interval_solid_start_x}{0} |
| 2416 |
\pgfmathsetlengthmacro{\l__timechart_interval_finish_max_x} |
| 2417 |
{\l__timechart_legenditem_width_pgf} |
| 2418 |
\int_case:nn {\l__timechart_finish_range_type_int} |
| 2419 |
{ |
| 2420 |
{0}{ |
| 2421 |
\pgfmathsetlengthmacro{\l__timechart_interval_solid_finish_x} |
| 2422 |
{ |
| 2423 |
\l__timechart_legenditem_width_pgf |
| 2424 |
-\l__timechart_legenditem_range_width_pgf |
| 2425 |
} |
| 2426 |
\__timechart_interval_finishrange_draw_pseudofade: |
| 2427 |
} |
| 2428 |
{1}{ |
| 2429 |
\pgfmathsetlengthmacro{\l__timechart_interval_solid_finish_x} |
| 2430 |
{\l__timechart_interval_finishrange_finish_x} |
| 2431 |
\pgfinterruptboundingbox |
| 2432 |
\__timechart_interval_finishrange_clip_path_finish: |
| 2433 |
\__timechart_interval_start_clip_path_none: |
| 2434 |
\pgfpathclose |
| 2435 |
\pgfusepath{clip} |
| 2436 |
\endpgfinterruptboundingbox |
| 2437 |
} |
| 2438 |
} |
| 2439 |
\__timechart_interval_solid_draw: |
| 2440 |
} |
| 2441 |
} |
| 2442 |
\cs_new:Npn\__timechart_legend_aux:nn #1#2 |
| 2443 |
{ |
| 2444 |
\__timechart_debug:n{Legend~auxiliary} |
| 2445 |
\tikzpicture |
| 2446 |
\pgfkeys{ |
| 2447 |
/timechart/.cd, |
| 2448 |
#1, |
| 2449 |
interval~bar~thickness/.get=\l__timechart_bar_thickness_pgf, |
| 2450 |
interval~bar~color/.get=\l__timechart_bar_color, |
| 2451 |
interval~minimum~width/.get=\l__timechart_minimum_width_pgf, |
| 2452 |
beyond~length~start/.get=\l__timechart_start_beyond_length_pgf, |
| 2453 |
beyond~length~finish/.get=\l__timechart_finish_beyond_length_pgf, |
| 2454 |
legend~item~width/.get=\l__timechart_legenditem_width_pgf, |
| 2455 |
legend~item~range~width/.get=\l__timechart_legenditem_range_width_pgf, |
| 2456 |
} |
| 2457 |
\pgfmathsetlengthmacro{\l__timechart_bar_half_thickness_pgf} |
| 2458 |
{.5*\l__timechart_bar_thickness_pgf} |
| 2459 |
\pgfmathsetmacro{\l__timechart_start_x}{0} |
| 2460 |
\pgfmathsetmacro{\l__timechart_finish_x} |
| 2461 |
{\l__timechart_legenditem_width_pgf} |
| 2462 |
\pgfmathsetlengthmacro{\l__timechart_start_beyond_x} |
| 2463 |
{\l__timechart_start_x-\l__timechart_start_beyond_length_pgf} |
| 2464 |
\pgfmathsetlengthmacro{\l__timechart_finish_beyond_x} |
| 2465 |
{\l__timechart_finish_x+\l__timechart_finish_beyond_length_pgf} |
| 2466 |
\pgfmathsetmacro{\l__timechart_current_y}{0} |
| 2467 |
\pgfmathsetmacro{\l__timechart_start_tolerance_x} |
| 2468 |
{\l__timechart_start_x-10mm} |
| 2469 |
\pgfmathsetmacro{\l__timechart_finish_tolerance_x} |
| 2470 |
{\l__timechart_finish_x+10mm} |
| 2471 |
\pgfscope |
| 2472 |
#2 |
| 2473 |
\endpgfscope |
| 2474 |
\endtikzpicture% |
| 2475 |
} |