summaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-10-25 03:01:25 +0000
committerNorbert Preining <norbert@preining.info>2023-10-25 03:01:25 +0000
commit241082cbe6f4fe8c38e91c38418ca828ac8d2f7c (patch)
tree206f7f6660cf81875a12824d3f7f92939c63b757 /graphics
parent7fc03b60d145610ff8e62c3d3a0d5fe037f6597d (diff)
CTAN sync 202310250301
Diffstat (limited to 'graphics')
-rw-r--r--graphics/pgf/contrib/tikz-osci/doc/tikz-osci-doc.pdfbin154401 -> 178335 bytes
-rw-r--r--graphics/pgf/contrib/tikz-osci/doc/tikz-osci-doc.tex214
-rw-r--r--graphics/pgf/contrib/tikz-osci/doc/tikz-osci-example.pdfbin137767 -> 114395 bytes
-rw-r--r--graphics/pgf/contrib/tikz-osci/doc/tikz-osci-example.tex30
-rw-r--r--graphics/pgf/contrib/tikz-osci/tikz-osci.sty309
5 files changed, 398 insertions, 155 deletions
diff --git a/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-doc.pdf b/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-doc.pdf
index 3d35f6a353..83f2438d7f 100644
--- a/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-doc.pdf
+++ b/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-doc.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-doc.tex b/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-doc.tex
index 0449e3cfd6..35088179cf 100644
--- a/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-doc.tex
+++ b/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-doc.tex
@@ -8,7 +8,7 @@
\usepackage{hyperref}
\title{TikZ Oscilloscope Package}
\author{Thibault Giauffret}
-\def\version{0.3.0}
+\def\version{0.4.0}
% Use sans serif font
\renewcommand{\familydefault}{\sfdefault}
@@ -34,7 +34,7 @@
\vspace{0.3cm}
{\huge \textbf{TikZ Oscilloscope Package}}\\[0.3cm]
{\Large Thibault Giauffret}\\[0.3cm]
- \textit{Version \version\ of \today}
+ \textit{Version \version\ of \today}\\[0.3cm]
\vspace{0.3cm}
\end{center}
\end{tcolorbox}
@@ -44,7 +44,11 @@
\begin{minipage}{0.5\linewidth}
\begin{center}
\osci[%
- scale=0.7
+ scale=0.7,
+ sample rate=500,
+ func one=1.78*sin(2*180/0.020*x),
+ horizontal cursor one=-1.78,
+ horizontal cursor two=1.78,
]
\end{center}
\end{minipage}
@@ -52,21 +56,22 @@
\begin{center}
\osci[%
scale=0.7,
- rounded corners=0,
second channel=1,
screen offset one=2,
screen offset two=-2,
- time div=20,
+ time div=10,
voltage div one=4,
voltage div two=1,
- sample rate=200,
+ sample rate=400,
xy mode=0,
- func one=2*sin(2*180/0.020*x),
+ func one=(sin(2*180*x/0.02)>0?6:-6),
func two=1*sin(2*180/0.020*x)+0.2*sin(2*180/0.040*x),
indicators=0,
- color one=D62626,
- color two=1053AF,
- graph back color=777799,
+ color one=FAC356,
+ color two=C18FFA,
+ color text one = 000000,
+ color text two = 000000,
+ graph back color=3C4A66,
info back color=333333,
info text color=FFFFFF,
main axis color=DDDDDD,
@@ -116,23 +121,40 @@ The package is loaded with the command \verb|\usepackage{tikz-osci}|. It defines
\texttt{voltage div one} & Voltage division of the first channel (in V). & Default: \texttt{1} \\\hline
\texttt{voltage div two} & Voltage division of the second channel (in V). & Default: \texttt{1} \\\hline
\texttt{sample rate} & Sample rate. & Default: \texttt{200} \\\hline
- \texttt{xy mode} & 1 if the oscilloscope is in XY mode (Lissajou curve), 0 otherwise. & Default : 0 \\\hline
+ \texttt{xy mode} & 1 if the oscilloscope is in XY mode (Lissajous curve), 0 otherwise. & Default : 0 \\\hline
\texttt{math mode} & 1 for addition, 2 for subtraction, 3 for multiplication, 4 for division, 0 otherwise. xy mode option must be set to 0. & Default: \texttt{0} \\\hline
\texttt{math mode hide source} & 0 to display channels CH1 and CH2 with the third channel, 1 to hide them. & Default : \texttt{0} \\\hline
\texttt{func one} & Expression of the first channel (pgf maths format). Trigonometric functions are defined in degrees. & Default: \texttt{2*sin(2*180/0.020*x)} \\\hline
\texttt{func two} & Expression of the second channel (pgf maths format). Trigonometric functions are defined in degrees. & Default: \texttt{1*sin(2*180/0.020*x) + 0.2*sin(2*180/0.040*x)} \\\hline
\texttt{indicators} & 1 if the channel indicators are enabled, 0 otherwise. & Default: \texttt{1} \\\hline
+ \texttt{horizontal cursor one} & Horizontal position of the first cursor (between -4 and 4). \texttt{false} to disable. & Default: \texttt{false} \\\hline
+ \texttt{horizontal cursor two} & Horizontal position of the second cursor (between -4 and 4). \texttt{false} to disable. & Default: \texttt{false} \\\hline
+ \texttt{vertical cursor one} & Vertical position of the first cursor (between -4 and 4). \texttt{false} to disable. & Default: \texttt{false} \\\hline
+ \texttt{vertical cursor two} & Vertical position of the second cursor (between -4 and 4). \texttt{false} to disable. & Default: \texttt{false} \\\hline
+ \texttt{cursor precision} & Number of digits after the decimal point for the cursor values. & Default: \texttt{1} \\\hline
\texttt{color one} & Color of the first channel (in hexadecimal). & Default: \texttt{D62626} \\\hline
\texttt{color text one} & Text color of the first channel (in hexadecimal). & Default: \texttt{FFFFFF} \\\hline
\texttt{color two} & Color of the second channel (in hexadecimal). & Default: \texttt{1053AF} \\\hline
\texttt{color text two} & Text color of the second channel (in hexadecimal). & Default: \texttt{FFFFFF} \\\hline
- \texttt{color three} & Color of the XY mode and the math mode (in hexadecimal). & Default: \texttt{2E8B73} \\\hline
- \texttt{color text three} & Text color of the XY mode and the math mode (in hexadecimal). & Default: \texttt{FFFFFF} \\\hline
+ \texttt{color three} & Color of the XY mode and the math mode (in hexadecimal). & Default: \texttt{2E8B73} \\\hline
+ \texttt{color text three} & Text color of the XY mode and the math mode (in hexadecimal). & Default: \texttt{FFFFFF} \\\hline
\texttt{graph back color} & Background color of the graph (in hexadecimal). & Default: \texttt{FFFFFF} \\\hline
\texttt{info back color} & Background color of the information box (in hexadecimal). & Default: \texttt{D6D6D6} \\\hline
\texttt{info text color} & Text color of the information box (in hexadecimal). & Default: \texttt{000000} \\\hline
\texttt{main axis color} & Color of the main axis (in hexadecimal). & Default: \texttt{000000} \\\hline
- \texttt{grid color} & Color of the grid (in hexadecimal). & Default: \texttt{CCCCCC} \\
+ \texttt{grid color} & Color of the grid (in hexadecimal). & Default: \texttt{CCCCCC}
+ \end{tabular}
+\end{tcolorbox}
+
+
+\begin{tcolorbox}[enhanced,breakable,colback=white,colframe=black,width=\textwidth,left=0mm,right=0mm,top=0mm,bottom=0mm,boxsep=0mm]
+ \begin{tabular}{p{0.2\textwidth}|p{0.47\textwidth}|p{0.255\textwidth}}
+
+ \texttt{horizontal cursor color} & Color of the horizontal cursor (in hexadecimal). & Default: \texttt{FFA500} \\\hline
+ \texttt{vertical cursor color} & Color of the vertical cursor (in hexadecimal). & Default: \texttt{800080}\\\hline
+ \texttt{smooth one} & 1 to smooth the first channel, 0 otherwise. & Default: \texttt{0}\\\hline
+ \texttt{smooth two} & 1 to smooth the second channel, 0 otherwise. & Default: \texttt{0}\\\hline
+ \texttt{smooth three} & 1 to smooth the third channel, 0 otherwise. & Default: \texttt{0}
\end{tabular}
\end{tcolorbox}
@@ -143,78 +165,114 @@ A quick documentation in french is available here :
\url{https://www.ensciences.fr/read.php?article=1220}
\end{center}
-\newpage
\section{Examples}
For more examples, see the \texttt{tikz-osci-example.tex} file.
\begin{tcblisting}{enhanced,colback=white,colframe=black,width=\textwidth, title=\bfseries Two channels plot with custom background color, sidebyside}
- \osci[%
- scale=0.7,
- second channel=1,
- screen offset one=2,
- screen offset two=-2,
- time div=20,
- voltage div one=4,
- voltage div two=1,
- sample rate=200,
- xy mode=0,
- func one=2*sin(2*180/0.020*x),
- func two=1*sin(2*180/0.020*x) + 0.2*sin(2*180/0.040*x),
- color one=D62626,
- color two=1053AF,
- graph back color=669966,
- info back color=D6D6D6,
- info text color=000000,
- main axis color=000000,
- grid color=CCCCCC
- ]
+\osci[%
+ scale=0.7,
+ second channel=1,
+ screen offset one=2,
+ screen offset two=-2,
+ time div=20,
+ voltage div one=4,
+ voltage div two=1,
+ sample rate=200,
+ xy mode=0,
+ func one=2*sin(2*180/0.020*x),
+ func two=1*sin(2*180/0.020*x) + 0.2*sin(2*180/0.040*x),
+ color one=D62626,
+ color two=1053AF,
+ graph back color=669966,
+ info back color=D6D6D6,
+ grid color=CCCCCC
+]
\end{tcblisting}
-\begin{tcblisting}{enhanced,colback=white,colframe=black,width=\textwidth, title=\bfseries Lissajou curve (XY mode) and no rounded corner, sidebyside}
- \osci[%
- scale=0.7,
- rounded corners=0,
- second channel=1,
- time div=300,
- voltage div one=1,
- voltage div two=0.5,
- sample rate=500,
- xy mode=1,
- func one=sin(7*x),
- func two=sin(2*x),
- indicators=1,
- graph back color=FFFFFF,
- info back color=D6D6D6,
- info text color=000000,
- main axis color=000000,
- grid color=CCCCCC,
- ]
+\begin{tcblisting}{enhanced,colback=white,colframe=black,width=\textwidth, title=\bfseries Lissajous curve (XY mode) and no rounded corner, sidebyside}
+\osci[%
+ scale=0.7,
+ rounded corners=0,
+ second channel=1,
+ time div=300,
+ voltage div one=1,
+ voltage div two=0.5,
+ sample rate=500,
+ xy mode=1,
+ func one=sin(7*x),
+ func two=sin(2*x),
+ indicators=1,
+ graph back color=FFFFFF,
+ info back color=D6D6D6,
+ info text color=000000,
+ main axis color=000000,
+ grid color=CCCCCC,
+]
\end{tcblisting}
\begin{tcblisting}{enhanced,colback=white,colframe=black,width=\textwidth, title=\bfseries Math mode (multiply) with hidden sources and dark mode, sidebyside}
- \osci[%
- scale=0.7,
- second channel=1,
- time div=10,
- voltage div one=2,
- voltage div two=2,
- sample rate=500,
- xy mode=0,
- math mode=3,
- math mode hide source=1,
- func one=2*sin(2*180/0.040*x),
- func two=3*sin(2*180/0.005*x),
- indicators=0,
- color three=F0DE25,
- color text three=000000,
- graph back color=777799,
- info back color=333333,
- info text color=FFFFFF,
- main axis color=DDDDDD,
- grid color=CCCCCC,
- ]
+\osci[%
+ scale=0.7,
+ second channel=1,
+ time div=10,
+ voltage div one=2,
+ voltage div two=2,
+ sample rate=500,
+ xy mode=0,
+ math mode=3,
+ math mode hide source=1,
+ func one=2*sin(2*180/0.040*x),
+ func two=3*sin(2*180/0.005*x),
+ indicators=0,
+ color three=F0DE25,
+ color text three=000000,
+ graph back color=777799,
+ info back color=333333,
+ info text color=FFFFFF,
+ main axis color=DDDDDD,
+ grid color=CCCCCC,
+]
+\end{tcblisting}
+
+\begin{tcblisting}{enhanced,colback=white,colframe=black,width=\textwidth, title=\bfseries Common periodic signals,sidebyside}
+% Square wave function
+\pgfmathdeclarefunction{square}{4}{%
+\pgfmathparse{(sin(2*180*x/#2+#4) + #3>0?#1:-#1)}%
+}
+
+% Triangle wave function
+\pgfmathdeclarefunction{triangle}{4}{%
+\pgfmathparse{#1*asin(sin(2*180/#2*x + #4))/90}%
+}
+
+\osci[%
+ scale=0.7,
+ second channel=1,
+ sample rate=1000,
+ time div=100,
+ func one={triangle(2,0.2,0,0)},
+ func two={square(2,0.2,0,0)},
+ smooth one = 1,
+ smooth two = 0,
+]
+\end{tcblisting}
+
+\begin{tcblisting}{enhanced,colback=white,colframe=black,width=\textwidth, title=\bfseries Vertical and horizontal cursors (values displayed with two digits),sidebyside}
+\osci[%
+ scale=0.7,
+ second channel=0,
+ time div=100,
+ voltage div one=1,
+ sample rate=200,
+ func one={sin(2*180*x)},
+ vertical cursor one=-2.5,
+ vertical cursor two=2.5,
+ horizontal cursor one=1,
+ horizontal cursor two=-1,
+ cursor precision=2
+]
\end{tcblisting}
\section{License}
@@ -234,8 +292,12 @@ This package requires the following packages :
\section{Changelog}
\begin{itemize}
+ \item \textbf{0.4.0} (2023/10/24) :
+ \subitem Added cursor and smooth options.
+ \subitem Added square and triangle plot examples.
+ \subitem Fixed the pgf keys declaration.
\item \textbf{0.3.0} (2023/10/08) :
- \subitem Implemented XY mode and math (add, subtract, multiply, divide) functionality.
+ \subitem Implemented XY mode and math (add, subtract, multiply, divide) functionalities.
\item \textbf{0.2.0} (2023/10/07) :
\subitem Added \texttt{color text one}, \texttt{color text two} and \texttt{color text xy} options.
\subitem Added \texttt{indicators} option.
diff --git a/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-example.pdf b/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-example.pdf
index 0d698a8bf1..e10955a70d 100644
--- a/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-example.pdf
+++ b/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-example.pdf
Binary files differ
diff --git a/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-example.tex b/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-example.tex
index 182ef488ed..c1924ae736 100644
--- a/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-example.tex
+++ b/graphics/pgf/contrib/tikz-osci/doc/tikz-osci-example.tex
@@ -156,6 +156,36 @@
grid color=CCCCCC,
]
+ \vspace*{0.3cm}
+
+
+ % Square wave function
+ \pgfmathdeclarefunction{square}{4}{%
+ \pgfmathparse{(sin(2*180*x/#2+#4)+#3>0?#1:-#1)}%
+ }
+
+ % Triangle wave function
+ \pgfmathdeclarefunction{triangle}{4}{%
+ \pgfmathparse{#1*asin(sin(2*180/#2*x+#4))/90}%
+ }
+
+ \osci[%
+ scale=0.7,
+ second channel=1,
+ time div=50,
+ voltage div one=1,
+ voltage div two=1,
+ sample rate=1000,
+ func one={triangle(2,0.2,0,0)},
+ func two={square(2,0.2,0,-60)},
+ smooth one = 1,
+ smooth two = 0,
+ vertical cursor one = 2,
+ vertical cursor two = 2.67,
+ cursor precision = 1
+ ]
+
+
\end{center}
diff --git a/graphics/pgf/contrib/tikz-osci/tikz-osci.sty b/graphics/pgf/contrib/tikz-osci/tikz-osci.sty
index 73ab24f5da..4c83f6c743 100644
--- a/graphics/pgf/contrib/tikz-osci/tikz-osci.sty
+++ b/graphics/pgf/contrib/tikz-osci/tikz-osci.sty
@@ -8,92 +8,116 @@
% tained anymore.
%
% Author: Thibault Giauffret
-% Date: 2013/10/08
-% Version: 0.3.0
+% Date: 2023/10/24
+% Version: 0.4.0
% Licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf
% Not an expert... Just doing it for fun.
% -----------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tikz-osci}[2023/10/08 0.3.0 Tikz Osci package]
+\ProvidesPackage{tikz-osci}[2023/10/24 0.4.0 Tikz Osci package]
% Required packages
\RequirePackage[dvipsnames]{xcolor}
\RequirePackage{pgfkeys}
\RequirePackage{pgfplots}
\RequirePackage{tikz}
-\usetikzlibrary{arrows,shapes,positioning}
-\usetikzlibrary{decorations.markings,decorations.pathmorphing,
- decorations.pathreplacing}
-\usetikzlibrary{calc,patterns,shapes.geometric}
-
-
-% Init the keys and get the values
-\pgfkeys{
- /osci/.cd,
- scale/.store in=\scale,
- scale=1,
- rounded corners/.store in=\roundedCorners,
- rounded corners=10,
- second channel/.store in=\secondChannel,
- second channel=0,
- screen offset one/.store in=\screenOffsetOne,
- screen offset one=0,
- screen offset two/.store in=\screenOffsetTwo,
- screen offset two=-0,
- time div/.store in=\timeDiv,
- time div=20,
- voltage div one/.store in=\voltageDivOne,
- voltage div one=1,
- voltage div two/.store in=\voltageDivTwo,
- voltage div two=1,
- sample rate/.store in=\sampleRate,
- sample rate=200,
- xy mode/.store in=\xyMode,
- xy mode=0,
- math mode/.store in=\mathMode,
- math mode=0,
- math mode hide source/.store in=\mathModeHideSource,
- math mode hide source=0,
- func one/.store in=\funcOne,
- func one=2*sin(2*180/0.020*x),
- func two/.store in=\funcTwo,
- func two=0.6*sin(2*180/0.020*x)+0.2*sin(2*180/0.040*x),
- indicators/.store in=\indicators,
- indicators=1,
- color one/.store in=\colorOne,
- color one=D62626,
- color text one/.store in=\colorTextOne,
- color text one=FFFFFF,
- color two/.store in=\colorTwo,
- color two=1053AF,
- color text two/.store in=\colorTextTwo,
- color text two=FFFFFF,
- color three/.store in=\colorThree,
- color three=2E8B73,
- color text three/.store in=\colorTextThree,
- color text three=FFFFFF,
- graph back color/.store in=\graphBackColor,
- graph back color=FFFFFF,
- info back color/.store in=\infoBackColor,
- info back color=D6D6D6,
- info text color/.store in=\infoTextColor,
- info text color=000000,
- main axis color/.store in=\mainAxisColor,
- main axis color=000000,
- grid color/.store in=\gridColor,
- grid color=AAAAAA,
+\usetikzlibrary{arrows,shapes,positioning,decorations.markings,decorations.pathmorphing,
+ decorations.pathreplacing,calc,patterns,shapes.geometric}
+
+% Raised text
+\newcommand*{\raisedtext}[1]{%
+ \begingroup
+ \leavevmode
+ \rlap{\kern-.2pt\raise.2pt\hbox{\color{white}#1}}%
+ \rlap{\kern.2pt\raise-.2pt\hbox{\color{black!30}#1}}%
+ \hbox{#1}%
+ \endgroup
}
% The main command
\newcommand\osci[1][]{
- % Get the values
+ % Init the keys and get the values and add the user's values
\pgfkeys{
/osci/.cd,
- #1,
+ scale/.store in=\scale,
+ scale=1,
+ rounded corners/.store in=\roundedCorners,
+ rounded corners=10,
+ second channel/.store in=\secondChannel,
+ second channel=0,
+ screen offset one/.store in=\screenOffsetOne,
+ screen offset one=0,
+ screen offset two/.store in=\screenOffsetTwo,
+ screen offset two=-0,
+ time div/.store in=\timeDiv,
+ time div=20,
+ voltage div one/.store in=\voltageDivOne,
+ voltage div one=1,
+ voltage div two/.store in=\voltageDivTwo,
+ voltage div two=1,
+ sample rate/.store in=\sampleRate,
+ sample rate=200,
+ xy mode/.store in=\xyMode,
+ xy mode=0,
+ math mode/.store in=\mathMode,
+ math mode=0,
+ math mode hide source/.store in=\mathModeHideSource,
+ math mode hide source=0,
+ func one/.store in=\funcOne,
+ func one=2*sin(2*180/0.020*x),
+ func two/.store in=\funcTwo,
+ func two=0.6*sin(2*180/0.020*x)+0.2*sin(2*180/0.040*x),
+ indicators/.store in=\indicators,
+ indicators=1,
+ vertical cursor one/.store in=\verticalCursorOne,
+ vertical cursor one=false,
+ vertical cursor two/.store in=\verticalCursorTwo,
+ vertical cursor two=false,
+ horizontal cursor one/.store in=\horizontalCursorOne,
+ horizontal cursor one=false,
+ horizontal cursor two/.store in=\horizontalCursorTwo,
+ horizontal cursor two=false,
+ cursor precision/.store in=\cursorPrecision,
+ cursor precision=1,
+ color one/.store in=\colorOne,
+ color one=D62626,
+ color text one/.store in=\colorTextOne,
+ color text one=FFFFFF,
+ color two/.store in=\colorTwo,
+ color two=1053AF,
+ color text two/.store in=\colorTextTwo,
+ color text two=FFFFFF,
+ color three/.store in=\colorThree,
+ color three=2E8B73,
+ color text three/.store in=\colorTextThree,
+ color text three=FFFFFF,
+ graph back color/.store in=\graphBackColor,
+ graph back color=FFFFFF,
+ info back color/.store in=\infoBackColor,
+ info back color=D6D6D6,
+ info text color/.store in=\infoTextColor,
+ info text color=000000,
+ main axis color/.store in=\mainAxisColor,
+ main axis color=000000,
+ grid color/.store in=\gridColor,
+ grid color=AAAAAA,
+ horizontal cursor color/.store in=\horizontalCursorColor,
+ horizontal cursor color=FFA500,
+ vertical cursor color/.store in=\verticalCursorColor,
+ vertical cursor color=800080,
+ smooth one/.store in=\smoothOne,
+ smooth one=0,
+ smooth two/.store in=\smoothTwo,
+ smooth two=0,
+ smooth three/.store in=\smoothThree,
+ smooth three=0,
+ #1
}
+
+ % Set the scale of the picture
\scalebox{\scale}{
% Begin the picture
\begin{tikzpicture}
@@ -110,6 +134,8 @@
\definecolor{colorTextOne}{HTML}{\colorTextOne}
\definecolor{colorTextTwo}{HTML}{\colorTextTwo}
\definecolor{colorTextThree}{HTML}{\colorTextThree}
+ \definecolor{verticalCursorColor}{HTML}{\verticalCursorColor}
+ \definecolor{horizontalCursorColor}{HTML}{\horizontalCursorColor}
% Draw the info box
\draw[black,thick, fill= infoBackColor]
@@ -123,6 +149,33 @@
% Add time/div label
\draw (5,-0.15) node[anchor=north, color= infoTextColor] {\timeDiv\ ms/div};
+ % Test if smoothOne is enabled
+ \ifnum\smoothOne=1
+ % set \smoothOne to smooth
+ \def\smoothOne{smooth}
+ \else
+ % set \smoothOne to empty
+ \def\smoothOne{}
+ \fi
+
+ % Test if smoothTwo is enabled
+ \ifnum\smoothTwo=1
+ % set \smoothTwo to smooth
+ \def\smoothTwo{smooth}
+ \else
+ % set \smoothTwo to empty
+ \def\smoothTwo{}
+ \fi
+
+ % Test if smoothThree is enabled
+ \ifnum\smoothThree=1
+ % set \smoothThree to smooth
+ \def\smoothThree{smooth}
+ \else
+ % set \smoothThree to empty
+ \def\smoothThree{}
+ \fi
+
% Add XY mode indicator
% Lissajou mode
\ifnum\xyMode=1
@@ -218,28 +271,27 @@
\pgfplotsset{ every non boxed x axis/.append style={x axis line style=-},
every non boxed y axis/.append style={y axis line style=-}}
- % Lissajou mode
+ % Lissajous mode
\ifnum\xyMode=1
-
\addplot
[domain=0:360,variable=\x,
- samples=200,smooth,very thick,color=thirdcolor]
+ samples=200,very thick,color=thirdcolor, \smoothThree]
({(\funcOne)/\voltageDivOne},{(\funcTwo)/\voltageDivTwo});
\draw[thirdcolor,fill=thirdcolor] (4,-0.78) rectangle (6,-1.28);
\draw (5,-0.75) node[anchor=north, color=white] {XY mode};
\else
+ % Show source signals
\ifnum\mathModeHideSource=0
% Draw each channel separately
% First channel plot
- \addplot[color=firstcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000),
- smooth, samples=\sampleRate]{(\funcOne)/\voltageDivOne+\screenOffsetOne};
+ \addplot[color=firstcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000),samples=\sampleRate,\smoothOne]{(\funcOne)/\voltageDivOne+\screenOffsetOne};
% If the second channel is enabled, draw it
\ifnum\secondChannel=1
% Draw the second channel
- \addplot[color=secondcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000), smooth, samples=\sampleRate]{(\funcTwo)/\voltageDivTwo+\screenOffsetTwo};
+ \addplot[color=secondcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000), samples=\sampleRate,\smoothTwo]{(\funcTwo)/\voltageDivTwo+\screenOffsetTwo};
\fi
\fi
@@ -247,14 +299,13 @@
% Add mode
\ifnum\mathMode=1
\addplot[color=thirdcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000),
- smooth, samples=\sampleRate]{(\funcOne)/\voltageDivOne + (\funcTwo)/\voltageDivTwo};
+ smooth, samples=\sampleRate, \smoothThree]{(\funcOne)/\voltageDivOne + (\funcTwo)/\voltageDivTwo};
\else
% Substract mode
\ifnum\mathMode=2
- \addplot[color=thirdcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000),
- smooth, samples=\sampleRate]{(\funcOne)/\voltageDivOne - (\funcTwo)/\voltageDivTwo};
+ \addplot[color=thirdcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000), samples=\sampleRate, \smoothThree]{(\funcOne)/\voltageDivOne - (\funcTwo)/\voltageDivTwo};
\draw[thirdcolor,fill=thirdcolor] (4,-0.78) rectangle (6,-1.28);
\draw (5,-0.75) node[anchor=north, color=white] {Substract};
@@ -262,8 +313,7 @@
% Multiply mode
\ifnum\mathMode=3
- \addplot[color=thirdcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000),
- smooth, samples=\sampleRate]{(\funcOne)/\voltageDivOne * (\funcTwo)/\voltageDivTwo};
+ \addplot[color=thirdcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000) ,samples=\sampleRate, \smoothThree]{(\funcOne)/\voltageDivOne * (\funcTwo)/\voltageDivTwo};
\draw[thirdcolor,fill=thirdcolor] (4,-0.78) rectangle (6,-1.28);
\draw (5,-0.75) node[anchor=north, color=white] {Multiply};
@@ -271,8 +321,7 @@
% Divide mode
\ifnum\mathMode=4
- \addplot[color=thirdcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000),
- smooth, samples=\sampleRate]{(\funcOne)/\voltageDivOne / (\funcTwo)/\voltageDivTwo};
+ \addplot[color=thirdcolor,very thick,domain=-5*(\timeDiv/1000):5*(\timeDiv/1000), samples=\sampleRate, \smoothThree]{(\funcOne)/\voltageDivOne / (\funcTwo)/\voltageDivTwo};
\draw[thirdcolor,fill=thirdcolor] (4,-0.78) rectangle (6,-1.28);
\draw (5,-0.75) node[anchor=north, color=white] {Divide};
\fi
@@ -285,6 +334,7 @@
\ifnum\xyMode=1
\else
+ % Show the channel indicators
\ifnum\indicators=1
% Draw the first channel's screen marker
\draw[firstcolor,fill=firstcolor] (0.4, \screenOffsetOne+4) -- (0, \screenOffsetOne+4+0.3) -- (0, \screenOffsetOne+4-0.3) -- cycle;
@@ -297,6 +347,107 @@
\draw (-0.04, \screenOffsetTwo+4) node[anchor=west, color=colorTextTwo,font=\fontsize{8}{10}\selectfont] {2};
\fi
\fi
+
+
+ % Draw the vertical cursors
+
+ % Define the false value
+ \def\false{false}
+
+ % Set the value of \verticalCursorOne
+ \pgfmathsetmacro{\verticalCursorOneValue}{\verticalCursorOne*\timeDiv}
+
+
+ % If the first vertical cursor is enabled
+ \ifx\verticalCursorOne\false
+ \else
+ % Draw the first vertical cursor with \verticalCursorOne value
+ \draw[verticalCursorColor,very thick,dashed] (\verticalCursorOne+5,0) -- (\verticalCursorOne+5,8);
+ \draw[verticalCursorColor,very thick,fill=verticalCursorColor] (\verticalCursorOne+5-0.25,7.5) rectangle (\verticalCursorOne+5+0.25,8);
+
+ % Draw the indicator
+ \draw[white,very thick] (\verticalCursorOne+5,7.45) node[anchor=south, color=white,font=\fontsize{10}{12}\selectfont] {A};
+
+ % Draw the legend
+ \draw[verticalCursorColor,very thick] (0.25,0.5) node[anchor=west, color=verticalCursorColor,font=\fontsize{10}{12}\selectfont] {\raisedtext{CurA \pgfmathprintnumber[precision=\cursorPrecision, assume math mode=true,fixed zerofill]{\verticalCursorOneValue}\ ms}};
+
+ % If the second vertical cursor is enabled
+ \ifx\verticalCursorTwo\false
+ \else
+ % Draw the time difference between the two vertical cursors
+ \pgfmathsetmacro{\verticalCursorDiff}{\verticalCursorTwo-\verticalCursorOne}
+ \pgfmathsetmacro{\verticalCursorDiffValue}{\verticalCursorDiff*\timeDiv}
+ \draw[verticalCursorColor,very thick] (0.25,1.5) node[anchor=west, color=verticalCursorColor,font=\fontsize{10}{12}\selectfont] {\raisedtext{CurB - CurA \pgfmathprintnumber[precision=\cursorPrecision, assume math mode=true,fixed zerofill]{\verticalCursorDiffValue}\ ms}};
+ \fi
+
+ \fi
+
+ % Set the value of \verticalCursorTwo
+ \pgfmathsetmacro{\verticalCursorTwoValue}{\verticalCursorTwo*\timeDiv}
+
+ % If the second vertical cursor is enabled
+ \ifx\verticalCursorTwo\false
+ \else
+ % Draw the second vertical cursor with \verticalCursorTwo value
+ \draw[verticalCursorColor,very thick,dashed] (\verticalCursorTwo+5,0) -- (\verticalCursorTwo+5,8);
+ \draw[verticalCursorColor,very thick,fill=verticalCursorColor] (\verticalCursorTwo+5-0.25,7.5) rectangle (\verticalCursorTwo+5+0.25,8);
+
+ % Draw the indicator
+ \draw[white,very thick] (\verticalCursorTwo+5,7.45) node[anchor=south, color=white,font=\fontsize{10}{12}\selectfont] {B};
+
+ % Draw the legend
+ \draw[verticalCursorColor,very thick] (0.25,1) node[anchor=west, color=verticalCursorColor,font=\fontsize{10}{12}\selectfont] {\raisedtext{CurB \pgfmathprintnumber[precision=\cursorPrecision, assume math mode=true,fixed zerofill]{\verticalCursorTwoValue}\ ms}};
+
+ \fi
+
+
+ % Draw the horizontal cursors
+
+ % Set the value of \horizontalCursorOne
+ \pgfmathsetmacro{\horizontalCursorOneValue}{\horizontalCursorOne*\voltageDivOne}
+
+ % If the first horizontal cursor is enabled
+ \ifx\horizontalCursorOne\false
+ \else
+ % Draw the first horizontal cursor with \horizontalCursorOne value
+ \draw[horizontalCursorColor,very thick,dashed] (0,\horizontalCursorOne+4) -- (10,\horizontalCursorOne+4);
+ \draw[horizontalCursorColor,very thick,fill=horizontalCursorColor] (9.5,\horizontalCursorOne+4-0.25) rectangle (10.5,\horizontalCursorOne+4+0.25);
+
+ % Draw the indicator
+ \draw[white,very thick] (10,\horizontalCursorOne+4) node[anchor=east, color=white,font=\fontsize{10}{12}\selectfont] {A};
+
+ % Draw the legend
+ \draw[horizontalCursorColor,very thick] (5.25,0.5) node[anchor=west, color=horizontalCursorColor,font=\fontsize{10}{12}\selectfont] {\raisedtext{CurA \pgfmathprintnumber[precision=\cursorPrecision, assume math mode=true,fixed zerofill]{\horizontalCursorOneValue}\ V}};
+
+ % If the second horizontal cursor is enabled
+ \ifx\horizontalCursorTwo\false
+ \else
+ % Draw the voltage difference between the two horizontal cursors
+ \pgfmathsetmacro{\horizontalCursorDiff}{\horizontalCursorTwo-\horizontalCursorOne}
+ \pgfmathsetmacro{\horizontalCursorDiffValue}{\horizontalCursorDiff*\voltageDivOne}
+ \draw[horizontalCursorColor,very thick] (5.25,1.5) node[anchor=west, color=horizontalCursorColor,font=\fontsize{10}{12}\selectfont] {\raisedtext{CurB - CurA \pgfmathprintnumber[precision=\cursorPrecision, assume math mode=true,fixed zerofill]{\horizontalCursorDiffValue}\ V}};
+ \fi
+ \fi
+
+ % Set the value of \horizontalCursorTwo
+ \pgfmathsetmacro{\horizontalCursorTwoValue}{\horizontalCursorTwo*\voltageDivOne}
+
+ % If the second horizontal cursor is enabled
+ \ifx\horizontalCursorTwo\false
+ \else
+ % Draw the second horizontal cursor with \horizontalCursorTwo value
+ \draw[horizontalCursorColor,very thick,dashed] (0,\horizontalCursorTwo+4) -- (10,\horizontalCursorTwo+4);
+ \draw[horizontalCursorColor,very thick,fill=horizontalCursorColor] (9.5,\horizontalCursorTwo+4-0.25) rectangle (10.5,\horizontalCursorTwo+4+0.25);
+
+ % Draw the indicator
+ \draw[white,very thick] (10,\horizontalCursorTwo+4) node[anchor=east, color=white,font=\fontsize{10}{12}\selectfont] {B};
+
+ % Draw the legend
+ \draw[horizontalCursorColor,very thick] (5.25,1) node[anchor=west, color=horizontalCursorColor,font=\fontsize{10}{12}\selectfont] {\raisedtext{CurB \pgfmathprintnumber[precision=\cursorPrecision, assume math mode=true,fixed zerofill]{\horizontalCursorTwoValue}\ V}};
+
+ \fi
+
+ % End xyMode test
\fi
\end{scope}