pie chart مخطط قطاعي

📅 April 02, 2024   |   👁️ Views: 13




Votre navigateur ne supporte pas les PDFs. Voir le Lien de Téléchargement au dessous .

\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}

\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}


Related Courses, Exams, and Exercises


Course PDF:

📥 Download pie chart مخطط قطاعي (PDF)