{"id":38,"date":"2024-07-06T19:36:53","date_gmt":"2024-07-06T17:36:53","guid":{"rendered":"https:\/\/huguesg.fr\/site\/?p=38"},"modified":"2024-07-06T19:49:20","modified_gmt":"2024-07-06T17:49:20","slug":"analyse-du-plf-2024","status":"publish","type":"post","link":"https:\/\/huguesg.fr\/site\/index.php\/2024\/07\/06\/analyse-du-plf-2024\/","title":{"rendered":"Analyse du PLF 2024"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">Visualisation des Cr\u00e9dits de Paiement<\/h1>\n\n\n\n<p>Bienvenue sur notre visualisation interactive du Projet de Loi de Finances Initial 2024. Ce graphique est con\u00e7u pour vous offrir une perspective claire et d\u00e9taill\u00e9e des montants allou\u00e9s \u00e0 diff\u00e9rents niveaux de notre budget national. Gr\u00e2ce \u00e0 une navigation intuitive, vous pouvez explorer les donn\u00e9es en profondeur, de mani\u00e8re \u00e0 mieux comprendre comment les fonds publics sont r\u00e9partis.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Utilisation du Graphique<\/h4>\n\n\n\n<p>Le graphique ci-dessous est interactif et permet une exploration progressive des cr\u00e9dits de paiement. En cliquant sur l\u2019une des barres, vous pouvez zoomer pour r\u00e9v\u00e9ler des informations plus d\u00e9taill\u00e9es sur les montants pr\u00e9vus. Le bouton &#8220;Retour&#8221; en haut de la page vous permet de revenir au niveau pr\u00e9c\u00e9dent.<\/p>\n\n\n\n<p>Les niveaux d&#8217;exploration sont organis\u00e9s comme suit :<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Mission<\/strong> : Les grandes cat\u00e9gories de d\u00e9penses publiques, telles que l\u2019\u00e9ducation, la sant\u00e9, la d\u00e9fense, etc.<\/li>\n\n\n\n<li><strong>Programme<\/strong> : Les sous-sections des missions, repr\u00e9sentant des projets ou des initiatives sp\u00e9cifiques.<\/li>\n\n\n\n<li><strong>Action<\/strong> : Les activit\u00e9s particuli\u00e8res financ\u00e9es au sein de chaque programme.<\/li>\n\n\n\n<li><strong>Sous-Action<\/strong> : Les divisions encore plus pr\u00e9cises, permettant de voir les allocations budg\u00e9taires jusqu\u2019aux moindres d\u00e9tails.<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">Pourquoi cette visualisation est importante<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Transparence<\/strong> : Permet aux citoyens de voir o\u00f9 et comment l&#8217;argent public est d\u00e9pens\u00e9.<\/li>\n\n\n\n<li><strong>Responsabilit\u00e9<\/strong> : Aide \u00e0 s&#8217;assurer que les ressources sont utilis\u00e9es efficacement et conform\u00e9ment aux priorit\u00e9s nationales.<\/li>\n\n\n\n<li><strong>Engagement<\/strong> : Encourage une participation citoyenne inform\u00e9e et active dans le processus budg\u00e9taire.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Comment naviguer dans le graphique<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Zoomer<\/strong> : Cliquez sur une barre pour voir les d\u00e9tails du niveau inf\u00e9rieur.<\/li>\n\n\n\n<li><strong>Retour<\/strong> : Utilisez le bouton &#8220;Retour&#8221; pour remonter au niveau sup\u00e9rieur.<\/li>\n\n\n\n<li><strong>Interpr\u00e9tation des valeurs<\/strong> : Les montants sont affich\u00e9s en milliards (B), millions (M), ou en valeur r\u00e9elle avec des arrondis \u00e0 trois chiffres significatifs pour une meilleure clart\u00e9.<\/li>\n<\/ul>\n\n\n\n<button id=\"backButton\" onclick=\"goBack()\">Retour<\/button>\n  <div id=\"chart\"><\/div>\n  <script>\n\n\/\/ URL du fichier CSV en ligne\nconst csvUrl = 'https:\/\/huguesg.fr\/docs\/plf24.csv';\n\n\/\/ Fonction pour parser les donn\u00e9es CSV\nfunction parseCSV(csv) {\n  const lines = csv.split('\\n');\n  const headers = lines[0].split(';');\n  const data = lines.slice(1).map(line => {\n    const values = line.split(';');\n    if (values.length === headers.length) {\n      let obj = {};\n      headers.forEach((header, index) => {\n        obj[header.trim()] = values[index] ? values[index].trim() : '';\n      });\n      return obj;\n    }\n    return null;\n  }).filter(line => line !== null);\n  return data;\n}\n\n\/\/ Charger Google Charts\ngoogle.charts.load('current', {packages: ['corechart']});\ngoogle.charts.setOnLoadCallback(loadCSV);\n\nlet rawData = [];\nlet currentLevel = 'mission';\nlet currentData = [];\nlet dataStack = [];\nlet breadcrumb = [];\n\nfunction loadCSV() {\n  fetch(csvUrl)\n    .then(response => response.text())\n    .then(csv => {\n      rawData = parseCSV(csv);\n      if (Array.isArray(rawData) && rawData.length > 0) {\n        currentData = rawData;\n        drawInitialChart();\n      } else {\n        console.error('Error: Parsed data is not a valid array.');\n      }\n    })\n    .catch(error => console.error('Error loading CSV:', error));\n}\n\nfunction drawInitialChart() {\n  breadcrumb = [];\n  drawChart('mission', rawData, 'Projet de Loi de Finances 2024');\n}\n\nfunction drawChart(level, data, title) {\n  if (dataStack.length === 0 || dataStack[dataStack.length - 1].level !== level) {\n    dataStack.push({level: level, data: data});\n  }\n  currentLevel = level;\n  currentData = data;\n\n  if (!Array.isArray(data)) {\n    console.error('Error: Data is not an array.');\n    return;\n  }\n\n\n  const groupedData = groupBy(data, level);\n  const chartData = new google.visualization.DataTable();\n  \n  const labelMapping = {\n    'libelle_action': 'Action',\n    'libelle_sousaction': 'Sous-Action',\n    'libelle_programme': 'Programme',\n    'cp_plf': 'Cr\u00e9dits de paiement'\n  };\n  const displayLabel = labelMapping[level] || level;\n  chartData.addColumn('string', displayLabel);\n  chartData.addColumn('number', 'Cr\u00e9dits de paiement');\n\n  const sortedData = Object.entries(groupedData).sort((a, b) => {\n  \tconst sumA = a[1].reduce((acc, row) => acc + parseFloat(row['cp_plf'] || 0), 0);\n  \tconst sumB = b[1].reduce((acc, row) => acc + parseFloat(row['cp_plf'] || 0), 0);\n  \treturn sumB - sumA; \/\/ tri d\u00e9croissant\n  });\n\n  chartData.addColumn({ type: 'string', role: 'annotation' });\n\n  for (let [key, group] of sortedData) {\n    const sum = group.reduce((acc, row) => acc + parseFloat(row['cp_plf'] || 0), 0);\n    chartData.addRow([key, {v: sum, f: formatValue(sum)}, formatValue(sum)]);\n  }\n\n  const options = {\n    title: title,\n    width: 800,\n    height: 800,\n    hAxis: { title: displayLabel, minValue: 0 },\n    vAxis: { title: 'Cr\u00e9dits de Paiement', format: 'short'},\n    legend: { position: 'none' },\n    annotations: {\n      alwaysOutside: true,\n      textStyle: {\n        fontSize: 12,\n        auraColor: 'none',\n        color: '#555'\n      }\n    }\n  };\n\n  const chart = new google.visualization.BarChart(document.getElementById('chart'));\n  chart.draw(chartData, options);\n\n  google.visualization.events.addListener(chart, 'select', () => {\n    const selection = chart.getSelection();\n    if (selection.length > 0) {\n      const selectedItem = chartData.getValue(selection[0].row, 0);\n      const nextLevel = getNextLevel(level);\n      if (nextLevel) {\n        breadcrumb.push(selectedItem);\n        currentData = groupedData[selectedItem];\n        drawChart(nextLevel, currentData, 'Projet de Loi de Finances 2024 - ' + breadcrumb.join(' > '));\n      }\n    }\n  });\n\n  if (dataStack.length > 1) {\n    document.getElementById('backButton').style.display = 'block';\n  } else {\n    document.getElementById('backButton').style.display = 'none';\n  }\n}\n\nfunction groupBy(data, key) {\n  if (!Array.isArray(data)) {\n    console.error('Error: Data is not an array.');\n    return {};\n  }\n\n  return data.reduce((result, currentValue) => {\n    (result[currentValue[key]] = result[currentValue[key]] || []).push(currentValue);\n    return result;\n  }, {});\n}\n\nfunction getNextLevel(currentLevel) {\n  switch (currentLevel) {\n    case 'mission': return 'libelle_programme';\n    case 'libelle_programme': return 'libelle_action';\n    case 'libelle_action': return 'libelle_sousaction';\n    default: return null;\n  }\n}\n\nfunction goBack() {\n  if (dataStack.length > 1) {\n    dataStack.pop(); \/\/ Remove current level\n    breadcrumb.pop(); \/\/ Remove last breadcrumb\n    const previous = dataStack.pop(); \/\/ Get previous level\n    currentLevel = previous.level;\n    currentData = previous.data;\n    drawChart(currentLevel, currentData, 'Projet de Loi de Finances 2024 - ' + breadcrumb.join(' > '));\n  }\n}\n\nfunction formatValue(value) {\n  if (value >= 1e9) {\n    return (value \/ 1e9).toPrecision(3) + 'B\u20ac';\n  } else if (value >= 1e6) {\n    return (value \/ 1e6).toPrecision(3) + 'M\u20ac';\n  } else {\n    return Number(value).toPrecision(3) + '\u20ac';\n  }\n}\n\n\n<\/script>\n\n\n\n<ul class=\"wp-block-list\">\n<li><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Visualisation des Cr\u00e9dits de Paiement Bienvenue sur notre visualisation interactive du Projet de Loi de Finances Initial 2024. Ce graphique est con\u00e7u pour vous offrir une perspective claire et d\u00e9taill\u00e9e des montants allou\u00e9s \u00e0 diff\u00e9rents niveaux de notre budget national. Gr\u00e2ce \u00e0 une navigation intuitive, vous pouvez explorer les donn\u00e9es en profondeur, de mani\u00e8re \u00e0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-38","post","type-post","status-publish","format-standard","hentry","category-non-classe","entry"],"_links":{"self":[{"href":"https:\/\/huguesg.fr\/site\/index.php\/wp-json\/wp\/v2\/posts\/38","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/huguesg.fr\/site\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/huguesg.fr\/site\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/huguesg.fr\/site\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/huguesg.fr\/site\/index.php\/wp-json\/wp\/v2\/comments?post=38"}],"version-history":[{"count":62,"href":"https:\/\/huguesg.fr\/site\/index.php\/wp-json\/wp\/v2\/posts\/38\/revisions"}],"predecessor-version":[{"id":109,"href":"https:\/\/huguesg.fr\/site\/index.php\/wp-json\/wp\/v2\/posts\/38\/revisions\/109"}],"wp:attachment":[{"href":"https:\/\/huguesg.fr\/site\/index.php\/wp-json\/wp\/v2\/media?parent=38"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/huguesg.fr\/site\/index.php\/wp-json\/wp\/v2\/categories?post=38"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/huguesg.fr\/site\/index.php\/wp-json\/wp\/v2\/tags?post=38"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}