Page 1 of 1

\documentclass[fontsize=16pt]{scrbook}
\usepackage[left=1.00cm, right=1.00cm, top=1.00cm, bottom=1.00cm]{geometry}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc}

\usepackage{fontspec}
\usepackage{polyglossia}

\setmainlanguage{english}
\setotherlanguage{arabic}


\newfontfamily\arabicfont[Script=Arabic]{Amiri}

\makeatletter
\renewcommand{\@makecaption}[2]{%
	\begin{center}
		\RTL{
		\textbf{\textarabic{وثيقة}~\arabic{figure}}~: #2%
	}
	\end{center}
}
\makeatother

\begin{document}

	\begin{figure}
		\centering
		\begin{tikzpicture}
			% Define data and colors
			\def\data{
				10/18/{\textarabic{فلاحة}}/red!20,
				20/36/{\textarabic{صناعة}}/green!45,
				30/54/{\textarabic{خدمات}}/green!20,
				40/72/{\textarabic{ضرائب}}/blue!30
			}
			\def\prevangle{0}
			\def\nextangle{0}
			\foreach \percent/\angle/\name/\col in \data {
				\global\edef\nextangle{\angle+\prevangle}
				\draw[fill=\col] (\prevangle:2) arc (\prevangle:\nextangle:2) -- (0,0) ;
				\global\edef\prevangle{\angle+\prevangle}
				\node[font=\tiny] at ({0.5*\nextangle}:1.5) {\percent\%};
			}
			\draw (-2,0) -- (2,0);
			%legend
			\coordinate (legendpos) at (3.5,0); % Define coordinate
			\foreach \percent/\angle/\name/\col in \data {
				\draw[fill=\col] (legendpos) rectangle ++(0.25,0.25);
				\node[right] at ($(legendpos) + (0.2,0.12)$) {\begin{Arabic}\name\end{Arabic}};
				\coordinate (legendpos) at ($(legendpos) + (0,0.5)$);
			}
		\end{tikzpicture}
		\caption{\textarabic{الناتج الداخلي الخام لسنة 2024}}
	\end{figure}

\end{document}

Leave a comment if you like this content أترك تعليقا إن أعجبك المحتوى

Class: Figures
Views:  458




0 Comments, Latest

No comments yet. Be the first to Comment

Most viewed courses: