diff options
author | Karl Berry <karl@freefriends.org> | 2016-12-31 21:26:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-12-31 21:26:18 +0000 |
commit | 9b491767bcc27a0d41045c2ffad2530455d81763 (patch) | |
tree | df2c26d3f70d6bbf05322d8728ef905a3fa9602a /Master/texmf-dist/tex/latex | |
parent | ef3722646aa7f034d07d94074504a5c474692d32 (diff) |
sparklines (31dec16)
git-svn-id: svn://tug.org/texlive/trunk@42821 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/sparklines/sparklines.sty | 66 |
1 files changed, 56 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/latex/sparklines/sparklines.sty b/Master/texmf-dist/tex/latex/sparklines/sparklines.sty index 2eb864cfd16..78836d6c07b 100644 --- a/Master/texmf-dist/tex/latex/sparklines/sparklines.sty +++ b/Master/texmf-dist/tex/latex/sparklines/sparklines.sty @@ -1,4 +1,4 @@ -%%% sparklines.sty Version 1.6 +%%% sparklines.sty Version 1.7 %%% %%% What Are Sparklines? %%% Sparklines are intense, simple, wordlike graphics (so named by Edward Tufte). @@ -16,25 +16,45 @@ %%% al@wacc.de %%% %%% MODIFICATION HISTORY: +%%% +%%% Dec 26 2016: +%%% version 1.7: Boris Veytsman (borisv@lk.net): Adding optional clipping, +%%% extensible bottom lines, some bug fixing. +%%% %%% Oct 19, 2014 -%%% version 1.6: Emiel van Miltenburg (emiel.van.miltenburg@vu.nl) - Adding a bottom line (the x-axis, this is useful to visually separate different bar charts that are next to each other) and changing the color of the bottom line. +%%% version 1.6: Emiel van Miltenburg (emiel.van.miltenburg@vu.nl) - +%%% Adding a bottom line (the x-axis, this is useful to visually +%%% separate different bar charts that are next to each other) and +%%% changing the color of the bottom line. +%%% %%% Nov 21, 2009 -%%% version 1.5: Benno Puetz (puetz@mpipsykl.mpg.de) made change of colors possible. +%%% version 1.5: Benno Puetz (puetz@mpipsykl.mpg.de) made change of +%%% colors possible. +%%% %%% Apr 20, 2009 -%%% version 1.4: Alexander Kowalski (Alexander.Kowarik@statistik.gv.at) found an error concerning spark-rectangles +%%% version 1.4: Alexander Kowalski +%%% (Alexander.Kowarik@statistik.gv.at) found an error concerning +%%% spark-rectangles +%%% %%% Mar 21, 2007 %%% version 1.3: Dan Luecking (luecking@uark.edu) added user-changeable %%% parameters, and expanded documentation +%%% %%% Mar 19, 2007 -%%% version 1.2: Harlan Harris (harlan@harris.name) added positive-value-only bars +%%% version 1.2: Harlan Harris (harlan@harris.name) added +%%% positive-value-only bars +%%% %%% Apr 21, 2005 -%%% version 1.1: bug removed thanks to Mathias Hofmann <mathias.hofmann@web.de> +%%% version 1.1: bug removed thanks to Mathias Hofmann +%%% <mathias.hofmann@web.de> +%%% %%% Dec 12, 2004 %%% version 1.0: first version of sparklines +%%% \ProvidesPackage{sparklines} - [2014/10/19 v1.6 Sparklines (see more about sparklines at www.EdwardTufte.com)] - \typeout {Package: `sparklines' 1.6bp \space 2014/10/19} + [2016/12/26 v1.7 Sparklines (see more about sparklines at www.EdwardTufte.com)] + \typeout {Package: `sparklines' 1.7bp \space 2016/12/26} \RequirePackage{pgf} % We define the colors of two features: the background rectangle and @@ -48,24 +68,43 @@ % \sparkdotwidth -- diameter of the dot drawn by \sparkdot, % \sparkspikewidth -- width of bar drawn in \sparkspike, % \sparklineheight -- macro, number of ex for the height of picture. +% \sparkbottomlinewidth -- width of the bottom line % Defaults equal old hard-coded values. \newlength\sparklinethickness \newlength\sparkdotwidth \newlength\sparkspikewidth +\newlength\sparkbottomlinethickness +\newlength\sparklineclipsep \setlength\sparklinethickness{0.2pt} \setlength\sparkdotwidth{1.2pt} \setlength\sparkspikewidth{2pt} +\setlength\sparkbottomlinethickness{2pt} +\setlength\sparklineclipsep{2pt} \providecommand{\sparklineheight}{1.75} % defines sparkline environment % Replace hard coded line thickness and picture height with above % defined parameters. -\newenvironment{sparkline}[1]{\pgfpicture{0ex}{0ex}{#1 ex}{\sparklineheight ex} +\newenvironment{sparkline}[1]{\pgfpicture{0ex}{0ex}{#1 + ex}{\sparklineheight ex} \pgfsetlinewidth{\sparklinethickness} \pgfsetxvec{\pgfpoint{#1 ex}{0pt}} \pgfsetyvec{\pgfpoint{0pt}{\sparklineheight ex}} } {\pgfstroke \endpgfpicture} +\newenvironment{sparkline*}[1]{\pgfpicture{0ex}{0ex}{#1 + ex}{\sparklineheight ex} + \pgfpathrectanglecorners% + {\pgfpoint{-\sparklineclipsep}{-\sparklineclipsep}}% + {\pgfpointadd{\pgfpoint{#1 ex}{\sparklineheight ex}}% + {\pgfpoint{\sparklineclipsep}{\sparklineclipsep}}} + \pgfusepath{clip} + \pgfsetlinewidth{\sparklinethickness} + \pgfsetxvec{\pgfpoint{#1 ex}{0pt}} + \pgfsetyvec{\pgfpoint{0pt}{\sparklineheight ex}} +} {\pgfstroke \endpgfpicture} + + % defines sparkdot with color % Replace hard-coded diameter with previously defined parameter. \def\sparkdot #1 #2 #3 {% @@ -82,7 +121,13 @@ \pgfrect[fill]{\pgfxy(0, #1)}{\pgfxy(1, #2-#1)}}}% % defines sparkbottomline -\newcommand{\sparkbottomline}[1][1]{\color{sparkbottomlinecolor}\pgfline{\pgfxy(0,0)}{\pgfxy(#1,0)}\color{sparklinecolor}} +\newcommand{\sparkbottomline}[1][1]{\pgfsetlinewidth{\sparkbottomlinethickness}% + \color{sparkbottomlinecolor}% + \pgfline{\pgfxy(0,0)}{\pgfxy(#1,0)}\color{sparklinecolor}} +% defines sparkbottomlinex +\def\sparkbottomlinex #1 #2 {\pgfsetlinewidth{\sparkbottomlinethickness}% + \color{sparkbottomlinecolor} + \pgfline{\pgfxy(#1,0)}{\pgfxy(#2,0)}\color{sparklinecolor}} % defines sparkline-plot % Replace \@shouldIstop hack with equivalent \@ifnextchar code. @@ -90,6 +135,7 @@ \pgfmoveto{\pgfxy(#1,#2)} % \@SPARK} \def\@SPARK#1 #2 {% + \pgfsetlinewidth{\sparklinethickness}% \pgfsetstrokecolor{sparklinecolor}% \pgflineto{\pgfxy(#1,#2)} % \@ifnextchar/{\pgfstroke\ignorespaces}{\@SPARK}} |