Skip to content

Instantly share code, notes, and snippets.

@IhebCh
Created January 7, 2017 11:34
Show Gist options
  • Save IhebCh/be26e0856db84970987185745eb89e61 to your computer and use it in GitHub Desktop.
Save IhebCh/be26e0856db84970987185745eb89e61 to your computer and use it in GitHub Desktop.
treemap zoomable
license: mit
{"children":[{"pourcentage":0.8,"proprietaire":"Famille Lemoine","audience":374.0,"nomJournal":"Sud Ouest","etranger":"faux","type":"GPE"},{"pourcentage":0.8,"proprietaire":"Famille Lemoine","audience":376.0,"nomJournal":"Charente Libre","etranger":"faux","type":"GPE"},{"pourcentage":0.8,"proprietaire":"Famille Lemoine","audience":378.0,"nomJournal":"Dordogne Libre","etranger":"faux","type":"GPE"},{"pourcentage":0.8,"proprietaire":"Famille Lemoine","audience":380.0,"nomJournal":"Haute Saintonge","etranger":"faux","type":"GPE"},{"pourcentage":0.8,"proprietaire":"Famille Lemoine","audience":382.0,"nomJournal":"Haute Gironde","etranger":"faux","type":"GPE"},{"pourcentage":0.8,"proprietaire":"Famille Lemoine","audience":384.0,"nomJournal":"Le Résistant","etranger":"faux","type":"GPE"},{"pourcentage":0.8,"proprietaire":"Famille Lemoine","audience":386.0,"nomJournal":"L'Hebdo de Charente-Maritime","etranger":"faux","type":"GPE"},{"pourcentage":0.8,"proprietaire":"Famille Lemoine","audience":388.0,"nomJournal":"La Dépêche du Bassin","etranger":"faux","type":"GPE"},{"pourcentage":0.8,"proprietaire":"Famille Lemoine","audience":390.0,"nomJournal":"Le Journal du Médoc","etranger":"faux","type":"GPE"},{"pourcentage":0.8,"proprietaire":"Famille Lemoine","audience":392.0,"nomJournal":"La République des Pyrénées","etranger":"faux","type":"GPE"},{"pourcentage":0.8,"proprietaire":"Famille Lemoine","audience":394.0,"nomJournal":"L'Eclair","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Les Augustins de l'Assomption","audience":120.0,"nomJournal":"La Croix ","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Les Augustins de l'Assomption","audience":122.0,"nomJournal":"Pèlerin","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Les Augustins de l'Assomption","audience":124.0,"nomJournal":"Notre temps","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"République française","audience":182.0,"nomJournal":"La Chaîne parlementaire","etranger":"faux","type":"Télévision"},{"pourcentage":1.0,"proprietaire":"République française","audience":184.0,"nomJournal":"Public Sénat","etranger":"faux","type":"Télévision"},{"pourcentage":1.0,"proprietaire":"République française","audience":186.0,"nomJournal":"Monte Carlo Doualiya","etranger":"faux","type":"Radio"},{"pourcentage":1.0,"proprietaire":"République française","audience":188.0,"nomJournal":"Radio France International","etranger":"faux","type":"Radio"},{"pourcentage":1.0,"proprietaire":"République française","audience":190.0,"nomJournal":"France 24","etranger":"faux","type":"Télévision"},{"pourcentage":0.126,"proprietaire":"République française","audience":192.0,"nomJournal":"TV5 Monde","etranger":"faux","type":"Télévision"},{"pourcentage":0.49,"proprietaire":"République française","audience":194.0,"nomJournal":"TV5 Monde","etranger":"faux","type":"Télévision"},{"pourcentage":1.0,"proprietaire":"République française","audience":196.0,"nomJournal":"France 2","etranger":"faux","type":"Télévision"},{"pourcentage":1.0,"proprietaire":"République française","audience":198.0,"nomJournal":"France 3","etranger":"faux","type":"Télévision"},{"pourcentage":1.0,"proprietaire":"République française","audience":200.0,"nomJournal":"France 5","etranger":"faux","type":"Télévision"},{"pourcentage":1.0,"proprietaire":"République française","audience":202.0,"nomJournal":"France 4","etranger":"faux","type":"Télévision"},{"pourcentage":1.0,"proprietaire":"République française","audience":204.0,"nomJournal":"France Ô","etranger":"faux","type":"Télévision"},{"pourcentage":1.0,"proprietaire":"République française","audience":206.0,"nomJournal":"France Info","etranger":"faux","type":"Télévision"},{"pourcentage":1.0,"proprietaire":"République française","audience":208.0,"nomJournal":"France Info","etranger":"faux","type":"Radio"},{"pourcentage":1.0,"proprietaire":"République française","audience":210.0,"nomJournal":"France Inter","etranger":"faux","type":"Radio"},{"pourcentage":1.0,"proprietaire":"République française","audience":212.0,"nomJournal":"France Musique","etranger":"faux","type":"Radio"},{"pourcentage":1.0,"proprietaire":"République française","audience":214.0,"nomJournal":"France Culture","etranger":"faux","type":"Radio"},{"pourcentage":1.0,"proprietaire":"République française","audience":216.0,"nomJournal":"FIP","etranger":"faux","type":"Radio"},{"pourcentage":1.0,"proprietaire":"République française","audience":218.0,"nomJournal":"France Bleu","etranger":"faux","type":"Radio"},{"pourcentage":1.0,"proprietaire":"République française","audience":220.0,"nomJournal":"France Info","etranger":"faux","type":"Radio"},{"pourcentage":1.0,"proprietaire":"République française","audience":222.0,"nomJournal":"Mouv' ","etranger":"faux","type":"Radio"},{"pourcentage":0.5,"proprietaire":"République française","audience":224.0,"nomJournal":"Arte","etranger":"faux","type":"Télévision"},{"pourcentage":0.132,"proprietaire":"Prisa","audience":18.0,"nomJournal":"L'Obs (+Rue89)","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Trusted Media Brands, Inc","audience":162.0,"nomJournal":"Sélection Reader's Digest","etranger":"faux","type":"GPE"},{"pourcentage":0.675,"proprietaire":"Famille Baylet","audience":358.0,"nomJournal":"La Dépêche du midi","etranger":"faux","type":"GPE"},{"pourcentage":0.675,"proprietaire":"Famille Baylet","audience":360.0,"nomJournal":"Le Petit Bleu","etranger":"faux","type":"GPE"},{"pourcentage":0.675,"proprietaire":"Famille Baylet","audience":362.0,"nomJournal":"La Nouvelle République des Pyrénées","etranger":"faux","type":"GPE"},{"pourcentage":0.675,"proprietaire":"Famille Baylet","audience":364.0,"nomJournal":"Le Villefranchois","etranger":"faux","type":"GPE"},{"pourcentage":0.675,"proprietaire":"Famille Baylet","audience":366.0,"nomJournal":"La Gazette du Comminges","etranger":"faux","type":"GPE"},{"pourcentage":0.675,"proprietaire":"Famille Baylet","audience":368.0,"nomJournal":"Midi libre","etranger":"faux","type":"GPE"},{"pourcentage":0.223,"proprietaire":"Financière Viveris","audience":464.0,"nomJournal":"Slate.fr","etranger":"faux","type":"Site"},{"pourcentage":0.65,"proprietaire":"Gérard Lignac","audience":472.0,"nomJournal":"Atlantico.fr","etranger":"faux","type":"Site"},{"pourcentage":0.32051880000000005,"proprietaire":"Vincent Bolloré","audience":106.0,"nomJournal":"Direct matin","etranger":"faux","type":"GPE"},{"pourcentage":0.0653858352,"proprietaire":"Vincent Bolloré","audience":108.0,"nomJournal":"Canal +","etranger":"faux","type":"Télévision"},{"pourcentage":0.0653858352,"proprietaire":"Vincent Bolloré","audience":110.0,"nomJournal":"C8","etranger":"faux","type":"Télévision"},{"pourcentage":0.0653858352,"proprietaire":"Vincent Bolloré","audience":112.0,"nomJournal":"i>Télé","etranger":"faux","type":"Télévision"},{"pourcentage":0.0653858352,"proprietaire":"Vincent Bolloré","audience":114.0,"nomJournal":"CStar","etranger":"faux","type":"Télévision"},{"pourcentage":0.5,"proprietaire":"Bruno Ledoux","audience":116.0,"nomJournal":"Le Nouvel Économiste","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Famille Amaury","audience":240.0,"nomJournal":"L'Équipe 21","etranger":"faux","type":"Télévision"},{"pourcentage":0.15,"proprietaire":"Famille Saint-Cricq","audience":354.0,"nomJournal":"Centre Presse","etranger":"faux","type":"GPE"},{"pourcentage":0.06,"proprietaire":"Famille Saint-Cricq","audience":356.0,"nomJournal":"TV Tours","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Fédération anarchiste","audience":158.0,"nomJournal":"Le Monde libertaire","etranger":"faux","type":"GPE"},{"pourcentage":0.89,"proprietaire":"Bernard Tapie","audience":412.0,"nomJournal":"Corse Matin","etranger":"faux","type":"GPE"},{"pourcentage":0.89,"proprietaire":"Bernard Tapie","audience":414.0,"nomJournal":"La Provence","etranger":"faux","type":"GPE"},{"pourcentage":0.4071,"proprietaire":"Parti communiste français","audience":128.0,"nomJournal":"L'Humanité","etranger":"faux","type":"GPE"},{"pourcentage":0.4071,"proprietaire":"Parti communiste français","audience":130.0,"nomJournal":"L'Humanité Dimanche","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Société Nouvelle L'Echo La Marseillaise","audience":438.0,"nomJournal":"L'Echo du centre","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Société Nouvelle L'Echo La Marseillaise","audience":440.0,"nomJournal":"La Marseillaise","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Société Nouvelle L'Echo La Marseillaise","audience":442.0,"nomJournal":"L'Hérault du jour","etranger":"faux","type":"GPE"},{"pourcentage":0.754,"proprietaire":"Robert Monteux","audience":164.0,"nomJournal":"Le Revenu","etranger":"faux","type":"GPE"},{"pourcentage":0.35989,"proprietaire":"Groupe Rossel","audience":256.0,"nomJournal":"20 Minutes (11 éditions locales)","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":258.0,"nomJournal":"La Voix du Nord","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":260.0,"nomJournal":"Nord éclair","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":262.0,"nomJournal":"Nord Littoral","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":264.0,"nomJournal":"Courrier picard","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":266.0,"nomJournal":"L'aisne Nouvelle","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":268.0,"nomJournal":"L'Union - L'Ardennais","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":270.0,"nomJournal":"L'Est-éclair - Libération Champagne","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":272.0,"nomJournal":"L'Avenir de l'Artois","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":274.0,"nomJournal":"Les Echos du Touquet","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":276.0,"nomJournal":"Le Journal des Flandres","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":278.0,"nomJournal":"Le Messager","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":280.0,"nomJournal":"L'Essor savoyard","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":282.0,"nomJournal":"Le Pays gessien","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":284.0,"nomJournal":"La Tribune républicaine","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":286.0,"nomJournal":"La Savoie","etranger":"faux","type":"GPE"},{"pourcentage":0.7008,"proprietaire":"Groupe Rossel","audience":288.0,"nomJournal":"Le Phare Dunkerquois","etranger":"faux","type":"GPE"},{"pourcentage":0.5136000000000001,"proprietaire":"Pierre Bergé","audience":20.0,"nomJournal":"Le Monde diplomatique","etranger":"faux","type":"GPE"},{"pourcentage":0.5136000000000001,"proprietaire":"Pierre Bergé","audience":22.0,"nomJournal":"Manière de voir","etranger":"faux","type":"GPE"},{"pourcentage":0.5136000000000001,"proprietaire":"Pierre Bergé","audience":24.0,"nomJournal":"Le Monde","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Famille Mohn","audience":138.0,"nomJournal":"VSD","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Famille Mohn","audience":140.0,"nomJournal":"Capital","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Famille Mohn","audience":142.0,"nomJournal":"Management","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Famille Mohn","audience":144.0,"nomJournal":"Harvard Business Review","etranger":"faux","type":"GPE"},{"pourcentage":0.36273299999999997,"proprietaire":"Famille Mohn","audience":146.0,"nomJournal":"M6","etranger":"faux","type":"Télévision"},{"pourcentage":0.36273299999999997,"proprietaire":"Famille Mohn","audience":148.0,"nomJournal":"W9","etranger":"faux","type":"Télévision"},{"pourcentage":0.36273299999999997,"proprietaire":"Famille Mohn","audience":150.0,"nomJournal":"6ter","etranger":"faux","type":"Télévision"},{"pourcentage":0.751,"proprietaire":"Famille Mohn","audience":152.0,"nomJournal":"RTL","etranger":"faux","type":"Radio"},{"pourcentage":0.751,"proprietaire":"Famille Mohn","audience":154.0,"nomJournal":"RTL2","etranger":"faux","type":"Radio"},{"pourcentage":0.751,"proprietaire":"Famille Mohn","audience":156.0,"nomJournal":"Fun Radio","etranger":"faux","type":"Radio"},{"pourcentage":1.0,"proprietaire":"Société coopérative d'intérêt collectif des salariés de Nice-Matin","audience":420.0,"nomJournal":"Nice-Matin","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Société coopérative d'intérêt collectif des salariés de Nice-Matin","audience":422.0,"nomJournal":"Var-Matin","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Société coopérative d'intérêt collectif des salariés de Nice-Matin","audience":424.0,"nomJournal":"Monaco-Matin","etranger":"faux","type":"GPE"},{"pourcentage":0.08874,"proprietaire":"Martin & Olivier Bouygues","audience":172.0,"nomJournal":"TF1","etranger":"faux","type":"Télévision"},{"pourcentage":0.08874,"proprietaire":"Martin & Olivier Bouygues","audience":174.0,"nomJournal":"NT1","etranger":"faux","type":"Télévision"},{"pourcentage":0.08874,"proprietaire":"Martin & Olivier Bouygues","audience":176.0,"nomJournal":"LCI","etranger":"faux","type":"Télévision"},{"pourcentage":0.08874,"proprietaire":"Martin & Olivier Bouygues","audience":178.0,"nomJournal":"HD1","etranger":"faux","type":"Télévision"},{"pourcentage":0.08874,"proprietaire":"Martin & Olivier Bouygues","audience":180.0,"nomJournal":"TMC","etranger":"faux","type":"Télévision"},{"pourcentage":1.0,"proprietaire":"Crédit Mutuel","audience":300.0,"nomJournal":"L'Est républicain","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Crédit Mutuel","audience":302.0,"nomJournal":"Le Républicain lorrain","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Crédit Mutuel","audience":304.0,"nomJournal":"DNA ","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Crédit Mutuel","audience":306.0,"nomJournal":"Vosges Matin","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Crédit Mutuel","audience":308.0,"nomJournal":"L'Alsace","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Crédit Mutuel","audience":310.0,"nomJournal":"Le Bien public","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Crédit Mutuel","audience":312.0,"nomJournal":"Le Journal de Saône-et-Loire","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Crédit Mutuel","audience":314.0,"nomJournal":"Le Progrès","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Crédit Mutuel","audience":316.0,"nomJournal":"Le Dauphiné libéré","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Crédit Mutuel","audience":318.0,"nomJournal":"Vaucluse Matin","etranger":"faux","type":"GPE"},{"pourcentage":0.5,"proprietaire":"Crédit Mutuel","audience":320.0,"nomJournal":"Le Journal de la Haute-Marne","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Xavier Ellie","audience":426.0,"nomJournal":"Paris-Normandie","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Xavier Ellie","audience":428.0,"nomJournal":"Havre Libre","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Xavier Ellie","audience":430.0,"nomJournal":"Le Progrès de Fécamp","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Xavier Ellie","audience":432.0,"nomJournal":"Liberté Dimanche","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Xavier Ellie","audience":434.0,"nomJournal":"Havre Dimanche","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Xavier Ellie","audience":436.0,"nomJournal":"Normandie Dimanche","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Pierre Guyot","audience":470.0,"nomJournal":"Atlantico.fr","etranger":"faux","type":"Site"},{"pourcentage":1.0,"proprietaire":"Serge Dassault","audience":50.0,"nomJournal":"Le Figaro","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Serge Dassault","audience":52.0,"nomJournal":"Le Figaro Magazine","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Serge Dassault","audience":54.0,"nomJournal":"Le Particulier","etranger":"faux","type":"GPE"},{"pourcentage":0.5,"proprietaire":"Henri J. Nijdam","audience":118.0,"nomJournal":"Le Nouvel Économiste","etranger":"faux","type":"GPE"},{"pourcentage":0.7991,"proprietaire":"Jean-Paul Baudecroux","audience":228.0,"nomJournal":"NRJ 12","etranger":"faux","type":"Télévision"},{"pourcentage":0.7991,"proprietaire":"Jean-Paul Baudecroux","audience":230.0,"nomJournal":"Chérie 25","etranger":"faux","type":"Télévision"},{"pourcentage":0.7991,"proprietaire":"Jean-Paul Baudecroux","audience":232.0,"nomJournal":"NRJ","etranger":"faux","type":"Radio"},{"pourcentage":0.7991,"proprietaire":"Jean-Paul Baudecroux","audience":234.0,"nomJournal":"Rire et Chansons","etranger":"faux","type":"Radio"},{"pourcentage":0.7991,"proprietaire":"Jean-Paul Baudecroux","audience":236.0,"nomJournal":"Chérie FM","etranger":"faux","type":"Radio"},{"pourcentage":0.7991,"proprietaire":"Jean-Paul Baudecroux","audience":238.0,"nomJournal":"Nostalgie","etranger":"faux","type":"Radio"},{"pourcentage":0.65,"proprietaire":"Fondation Varenne","audience":322.0,"nomJournal":"La Montagne","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Fondation Varenne","audience":324.0,"nomJournal":"Le Populaire du centre","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Fondation Varenne","audience":326.0,"nomJournal":"Le Journal du centre","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Fondation Varenne","audience":328.0,"nomJournal":"Le Berry républicain","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Fondation Varenne","audience":330.0,"nomJournal":"L\u2019Yonne Républicaine","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Fondation Varenne","audience":332.0,"nomJournal":"L\u2019Echo Républicain","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Fondation Varenne","audience":334.0,"nomJournal":"Courrier du Loiret ","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Fondation Varenne","audience":336.0,"nomJournal":"L\u2019Eclaireur du Gâtinais","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Fondation Varenne","audience":338.0,"nomJournal":"Régional de Cosne","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Fondation Varenne","audience":340.0,"nomJournal":"L\u2019Echo Charitois","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Fondation Varenne","audience":342.0,"nomJournal":"Pays Roannais ","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Fondation Varenne","audience":344.0,"nomJournal":"La Liberté","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Fondation Varenne","audience":346.0,"nomJournal":"Journal de Gien","etranger":"faux","type":"GPE"},{"pourcentage":0.45499999999999996,"proprietaire":"Fondation Varenne","audience":348.0,"nomJournal":"La République du Centre","etranger":"faux","type":"GPE"},{"pourcentage":0.031200000000000002,"proprietaire":"Fondation Varenne","audience":350.0,"nomJournal":"La République du Centre","etranger":"faux","type":"GPE"},{"pourcentage":0.10400000000000001,"proprietaire":"Fondation Varenne","audience":352.0,"nomJournal":"Nouvelle République du Centre-Ouest","etranger":"faux","type":"GPE"},{"pourcentage":0.11,"proprietaire":"Nethys","audience":416.0,"nomJournal":"La Provence","etranger":"faux","type":"GPE"},{"pourcentage":0.2,"proprietaire":"Nethys","audience":418.0,"nomJournal":"Nice-Matin","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":" Iskandar Safa","audience":126.0,"nomJournal":"Valeurs actuelles","etranger":"faux","type":"GPE"},{"pourcentage":0.9,"proprietaire":"Édouard Coudurier","audience":396.0,"nomJournal":"Le Télégramme","etranger":"faux","type":"GPE"},{"pourcentage":0.9,"proprietaire":"Édouard Coudurier","audience":398.0,"nomJournal":"Le Poher","etranger":"faux","type":"GPE"},{"pourcentage":0.9,"proprietaire":"Édouard Coudurier","audience":400.0,"nomJournal":"Tébéo","etranger":"faux","type":"GPE"},{"pourcentage":0.9,"proprietaire":"Édouard Coudurier","audience":402.0,"nomJournal":"Tébésud","etranger":"faux","type":"GPE"},{"pourcentage":0.9,"proprietaire":"Édouard Coudurier","audience":404.0,"nomJournal":"Le Mensuel de Rennes","etranger":"faux","type":"GPE"},{"pourcentage":0.9,"proprietaire":"Édouard Coudurier","audience":406.0,"nomJournal":"Sept Jours à Brest","etranger":"faux","type":"GPE"},{"pourcentage":0.9,"proprietaire":"Édouard Coudurier","audience":408.0,"nomJournal":"Le Journal des entreprises","etranger":"faux","type":"GPE"},{"pourcentage":0.45,"proprietaire":"Édouard Coudurier","audience":410.0,"nomJournal":"Bretagne magazine","etranger":"faux","type":"GPE"},{"pourcentage":0.293,"proprietaire":"Benjamin de Rothschild","audience":462.0,"nomJournal":"Slate.fr","etranger":"faux","type":"Site"},{"pourcentage":0.65,"proprietaire":"Philippe Hersant","audience":444.0,"nomJournal":"La Côte (Nyon)","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Philippe Hersant","audience":446.0,"nomJournal":"L'Express (Neuchâtel)","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Philippe Hersant","audience":448.0,"nomJournal":"L'Impartial (La Chaux-de-Fonds)","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Philippe Hersant","audience":450.0,"nomJournal":"Le Nouvelliste","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Philippe Hersant","audience":452.0,"nomJournal":"La Gazette de Martigny","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Philippe Hersant","audience":454.0,"nomJournal":"Le Journal de Sierre","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Philippe Hersant","audience":456.0,"nomJournal":"France Antilles","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Philippe Hersant","audience":458.0,"nomJournal":"France Guyane","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Philippe Hersant","audience":460.0,"nomJournal":"Le Journal de l'Île de la Réunion","etranger":"faux","type":"GPE"},{"pourcentage":0.65,"proprietaire":"Jean-Sébastien Ferjou","audience":468.0,"nomJournal":"Atlantico.fr","etranger":"faux","type":"Site"},{"pourcentage":0.5136000000000001,"proprietaire":"Xavier Niel","audience":26.0,"nomJournal":"Télérama","etranger":"faux","type":"GPE"},{"pourcentage":0.5136000000000001,"proprietaire":"Xavier Niel","audience":28.0,"nomJournal":"Courrier international","etranger":"faux","type":"GPE"},{"pourcentage":0.5136000000000001,"proprietaire":"Xavier Niel","audience":30.0,"nomJournal":"Le Monde des religions","etranger":"faux","type":"GPE"},{"pourcentage":0.5136000000000001,"proprietaire":"Xavier Niel","audience":32.0,"nomJournal":"La Vie","etranger":"faux","type":"GPE"},{"pourcentage":0.3,"proprietaire":"Éric Portheault","audience":170.0,"nomJournal":"Charlie Hebdo","etranger":"faux","type":"GPE"},{"pourcentage":0.26193600000000006,"proprietaire":"Matthieu Pigasse","audience":34.0,"nomJournal":"Prier","etranger":"faux","type":"GPE"},{"pourcentage":0.26193600000000006,"proprietaire":"Matthieu Pigasse","audience":36.0,"nomJournal":"M, le magazine du Monde","etranger":"faux","type":"GPE"},{"pourcentage":0.17462400000000003,"proprietaire":"Matthieu Pigasse","audience":38.0,"nomJournal":"Huffingtonpost.fr","etranger":"faux","type":"Site"},{"pourcentage":0.08525,"proprietaire":"Matthieu Pigasse","audience":42.0,"nomJournal":"Huffingtonpost.fr","etranger":"faux","type":"Site"},{"pourcentage":0.775,"proprietaire":"Matthieu Pigasse","audience":44.0,"nomJournal":"Radio Nova","etranger":"faux","type":"Radio"},{"pourcentage":0.775,"proprietaire":"Matthieu Pigasse","audience":46.0,"nomJournal":"Les Inrockuptibles","etranger":"faux","type":"GPE"},{"pourcentage":0.27125,"proprietaire":"Matthieu Pigasse","audience":48.0,"nomJournal":"Vice.com","etranger":"faux","type":"Site"},{"pourcentage":0.7,"proprietaire":"Riss","audience":168.0,"nomJournal":"Charlie Hebdo","etranger":"faux","type":"GPE"},{"pourcentage":0.15,"proprietaire":"Lagardère Active","audience":370.0,"nomJournal":"L'Indépendant","etranger":"faux","type":"GPE"},{"pourcentage":0.15,"proprietaire":"Lagardère Active","audience":372.0,"nomJournal":"Centre Presse Aveyron","etranger":"faux","type":"GPE"},{"pourcentage":0.57,"proprietaire":"Yves de Chaisemartin","audience":136.0,"nomJournal":"Marianne","etranger":"faux","type":"GPE"},{"pourcentage":0.5,"proprietaire":"ARD \/ ZDF","audience":226.0,"nomJournal":"Arte","etranger":"faux","type":"Télévision"},{"pourcentage":0.466,"proprietaire":"Bernard Arnault","audience":56.0,"nomJournal":"Le Parisien","etranger":"faux","type":"GPE"},{"pourcentage":0.466,"proprietaire":"Bernard Arnault","audience":58.0,"nomJournal":"Le Parisien Magazine","etranger":"faux","type":"GPE"},{"pourcentage":0.466,"proprietaire":"Bernard Arnault","audience":60.0,"nomJournal":"Le Parisien économie","etranger":"faux","type":"GPE"},{"pourcentage":0.466,"proprietaire":"Bernard Arnault","audience":62.0,"nomJournal":"Aujourd'hui en France","etranger":"faux","type":"GPE"},{"pourcentage":0.466,"proprietaire":"Bernard Arnault","audience":64.0,"nomJournal":"Les Échos","etranger":"faux","type":"GPE"},{"pourcentage":0.466,"proprietaire":"Bernard Arnault","audience":66.0,"nomJournal":"Investir","etranger":"faux","type":"GPE"},{"pourcentage":0.466,"proprietaire":"Bernard Arnault","audience":68.0,"nomJournal":"Investir Magazine","etranger":"faux","type":"GPE"},{"pourcentage":0.466,"proprietaire":"Bernard Arnault","audience":70.0,"nomJournal":"Les Échos Week-End","etranger":"faux","type":"GPE"},{"pourcentage":0.466,"proprietaire":"Bernard Arnault","audience":72.0,"nomJournal":"Radio Classique","etranger":"faux","type":"Radio"},{"pourcentage":0.51,"proprietaire":"AOL","audience":40.0,"nomJournal":"Huffingtonpost.fr","etranger":"faux","type":"Site"},{"pourcentage":0.083,"proprietaire":"Famille Graham","audience":466.0,"nomJournal":"Slate.fr","etranger":"faux","type":"Site"},{"pourcentage":0.5,"proprietaire":"Claude Perdriel","audience":10.0,"nomJournal":"L'histoire","etranger":"faux","type":"GPE"},{"pourcentage":0.0,"proprietaire":"Claude Perdriel","audience":12.0,"nomJournal":"Historia","etranger":"faux","type":"GPE"},{"pourcentage":0.93,"proprietaire":"Claude Perdriel","audience":14.0,"nomJournal":"Challenges","etranger":"faux","type":"GPE"},{"pourcentage":0.31620000000000004,"proprietaire":"Claude Perdriel","audience":16.0,"nomJournal":"L'Obs (+Rue89)","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Famille Hutin","audience":242.0,"nomJournal":"Ouest France","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Famille Hutin","audience":244.0,"nomJournal":"Le Courrier de l'Ouest","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Famille Hutin","audience":246.0,"nomJournal":"Le Maine libre","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Famille Hutin","audience":248.0,"nomJournal":"Presse-Océan","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Famille Hutin","audience":250.0,"nomJournal":"La Presse de la Manche","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Famille Hutin","audience":252.0,"nomJournal":"Publi Hebdos (77 hebdomadaires régionaux payants, 15 gratuits, 1 quotidien)","etranger":"faux","type":"GPE"},{"pourcentage":0.2,"proprietaire":"Famille Hutin","audience":254.0,"nomJournal":"20 Minutes (11 éditions locales)","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"Groupe Revue Fiduciaire","audience":166.0,"nomJournal":"Intérêts Privés","etranger":"faux","type":"GPE"},{"pourcentage":0.0796,"proprietaire":"Arnaud Lagardère","audience":94.0,"nomJournal":"Le Journal du dimanche","etranger":"faux","type":"GPE"},{"pourcentage":0.0796,"proprietaire":"Arnaud Lagardère","audience":96.0,"nomJournal":"Paris Match","etranger":"faux","type":"GPE"},{"pourcentage":0.0796,"proprietaire":"Arnaud Lagardère","audience":98.0,"nomJournal":"Gulli","etranger":"faux","type":"Télévision"},{"pourcentage":0.486897,"proprietaire":"Alain Weill","audience":84.0,"nomJournal":"RMC Découverte","etranger":"faux","type":"Télévision"},{"pourcentage":0.486897,"proprietaire":"Alain Weill","audience":86.0,"nomJournal":"RMC","etranger":"faux","type":"Radio"},{"pourcentage":0.486897,"proprietaire":"Alain Weill","audience":88.0,"nomJournal":"BFM Business","etranger":"faux","type":"Radio"},{"pourcentage":0.18988983,"proprietaire":"Alain Weill","audience":90.0,"nomJournal":"Numéro 23","etranger":"faux","type":"Télévision"},{"pourcentage":0.47892,"proprietaire":"Patrick Drahi","audience":74.0,"nomJournal":"L'Express","etranger":"faux","type":"GPE"},{"pourcentage":0.47892,"proprietaire":"Patrick Drahi","audience":76.0,"nomJournal":"L'Express - L'Expansion","etranger":"faux","type":"GPE"},{"pourcentage":0.47892,"proprietaire":"Patrick Drahi","audience":78.0,"nomJournal":"Mieux vivre votre argent","etranger":"faux","type":"GPE"},{"pourcentage":0.47892,"proprietaire":"Patrick Drahi","audience":80.0,"nomJournal":"Libération","etranger":"faux","type":"GPE"},{"pourcentage":0.22404021276000002,"proprietaire":"Patrick Drahi","audience":82.0,"nomJournal":"BFM TV","etranger":"faux","type":"Télévision"},{"pourcentage":0.24,"proprietaire":"Crédit Agricole Nord de France","audience":290.0,"nomJournal":"La Semaine dans le Boulonnais","etranger":"faux","type":"GPE"},{"pourcentage":0.24,"proprietaire":"Crédit Agricole Nord de France","audience":292.0,"nomJournal":"Le Réveil de Berck","etranger":"faux","type":"GPE"},{"pourcentage":0.24,"proprietaire":"Crédit Agricole Nord de France","audience":294.0,"nomJournal":"Le Journal de Montreuil","etranger":"faux","type":"GPE"},{"pourcentage":0.24,"proprietaire":"Crédit Agricole Nord de France","audience":296.0,"nomJournal":"L'indicateur","etranger":"faux","type":"GPE"},{"pourcentage":0.24,"proprietaire":"Crédit Agricole Nord de France","audience":298.0,"nomJournal":"L'Echo de la Lys","etranger":"faux","type":"GPE"},{"pourcentage":0.1283,"proprietaire":"Qatar Investment Authority","audience":100.0,"nomJournal":"Europe 1","etranger":"vrai","type":"Radio"},{"pourcentage":0.1283,"proprietaire":"Qatar Investment Authority","audience":102.0,"nomJournal":"RFM","etranger":"vrai","type":"Radio"},{"pourcentage":0.1283,"proprietaire":"Qatar Investment Authority","audience":104.0,"nomJournal":"Virgin Radio","etranger":"vrai","type":"Radio"},{"pourcentage":0.61,"proprietaire":"Pascal Houzelot","audience":92.0,"nomJournal":"Numéro 23","etranger":"faux","type":"Télévision"},{"pourcentage":1.0,"proprietaire":"Centre royaliste d'Action française","audience":160.0,"nomJournal":"L'Action française 2000","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"François Pinault","audience":132.0,"nomJournal":"Le Point","etranger":"faux","type":"GPE"},{"pourcentage":1.0,"proprietaire":"François Pinault","audience":134.0,"nomJournal":"L'Agefi hebdo","etranger":"faux","type":"GPE"}]}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Influenceur sur les médias </title>
<style>
#chart {
background: #fff;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
float: left;
border-right: 1px solid #77af79;
}
.title {
font-weight: bold;
font-size: 20px;
text-align: center;
margin-top: 4px;
margin-bottom: 4px;
}
text {
pointer-events: none;
}
.grandparent text {
border: none;
fill: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.child {
fill: none;
stroke: #fff;
stroke-width: 1px;
}
.parent {
fill: none;
stroke: #fff;
stroke-width: 0px;
}
/* rect.parent,
.grandparent rect {
}
*/
rect.parent {
pointer-events: none;
}
.grandparent rect {
fill: #4CAF50;
}
.grandparent:hover rect {
fill: #266829;
}
.children rect.parent,
.grandparent rect {
cursor: pointer;
}
.children rect.parent {
/* fill: #bbb;*/
fill-opacity: 0.1;
}
#div_parent{
display: inline ;
}
#listeRanking{
overflow: scroll;
overflow-x: hidden;
}
#audience{
margin-top: 30px;
}
.ptext{
font-weight: bold;
background-color: #000 ;
}
/* .children:hover rect.child {
fill: #bbb;
}
*/
#listeRanking ul {
padding: 0px;
margin-right: 5px;
background-color: #4CAF50;
}
#listeRanking ul li {
text-decoration: none;
margin-bottom: 3px;
font-weight: 300;
font-size: .9rem;
padding: 10px 30px;
text-decoration: none;
list-style-type: none
}
#listeRanking ul li:hover {
cursor: pointer;
}
ul {
transform: rotate(180deg);
}
ul > li {
transform: rotate(-180deg);
}
button {
background-color: #4CAF50;
border: none;
color: white;
padding: 10px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
cursor: pointer;
}
#headListe {
background-color: #77af79;
border: none;
color: black;
padding-top: 10px ;
padding-bottom: 10px ;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin-top: 3px;
}
button:hover {
background-color: #266829;
}
*{
font-family:monospace
}
</style>
</head>
<body>
<div id="#div_parent">
<div id="chart">
</div>
<div id="sidebar">
<button type="checkbox" id="audience" checked >Audience </button>
<div id="headListe">Répartition par type de médias</div>
<div id="listeRanking">
</div>
</div>
</div>
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
/* window.addEventListener('message', function(e) {
var opts = e.data.opts,
data = e.data.data;
return main(opts, data);
});
*/
var array ;
var critere = "audience";
var liste ;
var iekei ;
var root ;
var svg ;
var WIDTH = window.innerWidth-20,
HEIGHT = window.innerHeight-20 ;
var defaults = {
margin: {top: 24, right: 20, bottom: 20, left: 20},
rootname: "TOP",
format: ",d",
title: "",
width: WIDTH*7/10,
height: HEIGHT
};
var liste_ordonnee;
var children ;
function main(o, data) {
var
opts = $.extend(true, {}, defaults, o),
formatNumber = d3.format(opts.format),
rname = opts.rootname,
margin = opts.margin,
theight = 36 + 16;
$('#chart').width(opts.width).height(opts.height);
var width = opts.width - margin.left - margin.right,
height = opts.height - margin.top - margin.bottom - theight,
transitioning;
console.log("mar "+width + " "+height);
var color = d3.scale.category20();
var x = d3.scale.linear()
.domain([0, width])
.range([0, width]);
var y = d3.scale.linear()
.domain([0, height])
.range([0, height]);
var treemap = d3.layout.treemap()
.children(function(d, depth) { return depth ? null : d._children; })
.sort(function(a, b) { return a.value-b.value })
.ratio(height / width * 0.5 * (1 + Math.sqrt(5)))
.round(false);
svg = d3.select("#chart").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.bottom + margin.top)
.style("margin-left", -margin.left + "px")
.style("margin.right", -margin.right + "px")
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.style("shape-rendering", "crispEdges");
//la liste du ranking sidebar
$('#listeRanking').width(WIDTH-width-60).height(height-65 );
// $('#legend').width(WIDTH-width-60).height(height/3 );
$('#audience').width(WIDTH-width-60)
$('#headListe').width(WIDTH-width-60)
liste_ordonnee = d3.select("#listeRanking").append('div')
.append('ul')
.attr('class', 'legend') ;
/* legend = d3.select("#legend").append("svg")
.attr("width", WIDTH-width-60)
.attr("height", height/3).style("padding-top", 2 + "px")
;*/
var grandparent = svg.append("g")
.attr("class", "grandparent");
grandparent.append("rect")
.attr("y", -margin.top)
.attr("width", width)
.attr("height", margin.top);
grandparent.append("text")
.attr("x", 6)
.attr("y", 6 - margin.top)
.attr("dy", ".75em");
if (opts.title) {
$("#chart").prepend("<p class='title'>" + opts.title + "</p>");
}
if (data instanceof Array) {
root = { key: rname, values: data };
} else {
root = data;
}
initialize(root);
display(root);
if (window.parent !== window) {
var myheight = document.documentElement.scrollHeight || document.body.scrollHeight;
window.parent.postMessage({height: myheight}, '*');
}
function initialize(root) {
root.x = root.y = 0;
root.dx = width;
root.dy = height;
root.depth = 0;
}
// Aggregate the values for internal nodes. This is normally done by the
// treemap layout, but not here because of our custom implementation.
// We also take a snapshot of the original children (_children) to avoid
// the children being overwritten when when layout is computed.
function accumulate(d) {
/// console.log("accum "+Object.keys(d));
if(critere=="audience")
return (d._children = d.values)
? d.value = d.values.reduce(function(p, v) { return p + accumulate(v); }, 0)
: d[critere]*d["pourcentage"]
else
return (d._children = d.values)
? d.value = d.values.reduce(function(p, v) { return p + accumulate(v); }, 0)
: d[critere]
}
function additionne(d) {
if(critere=="audience")
return (d._children = d.values)
? d._value = d.values.reduce(function(p, v) { return p + additionne(v); }, 0)
: d[critere]
else
return (d._children = d.values)
? d._value = d.values.reduce(function(p, v) { return p + additionne(v); }, 0)
: 1
}
// Compute the treemap layout recursively such that each group of siblings
// uses the same size (1×1) rather than the dimensions of the parent cell.
// This optimizes the layout for the current zoom state. Note that a wrapper
// object is created for the parent node for each group of siblings so that
// the parent’s dimensions are not discarded as we recurse. Since each group
// of sibling was laid out in 1×1, we must rescale to fit using absolute
// coordinates. This lets us use a viewport to zoom.
function layout(d) {
if (d._children) {
treemap.nodes({_children: d._children});
d._children.forEach(function(c) {
c.x = d.x + c.x * d.dx;
c.y = d.y + c.y * d.dy;
c.dx *= d.dx;
c.dy *= d.dy;
c.parent = d;
layout(c);
});
}
}
function scaleRect(d,object,scale){
var h = y(d.y + d.dy) - y(d.y);
var w = x(d.x + d.dx) - y(d.x) ;
var selection = d3.select(object);
var offsetX = parseFloat(x(d.x))+ parseFloat(d.dx/2.0);
var offsetY = parseFloat(y(d.y))+ parseFloat(d.dy/2.0);
selection.transition()
.duration(500).attr({
transform:"translate("+offsetX+ ","+offsetY+") "+
"scale("+scale+") "+
"translate(-"+offsetX+",-"+offsetY+ ")"
});
}
function display(root) {
// console.log("looooooooooooooo "+root._children[0]._children[0].key);
accumulate(root);
additionne(root);
layout(root);
console.log(root);
grandparent
.datum(root.parent)
.on("click", transition)
.select("text")
.text(name(root));
var g1 = svg.append("g", ".grandparent")
.datum(root)
.attr("class", "depth");
// liste_ordonnee.remove();
var g = g1.selectAll("g")
.data(root._children)
.enter().append("g");
g.filter(function(d) {
// console.log("looooooooooooooo "+d._children[0]._children);
if(typeof d._children[0]._children != "undefined")
return d._children;
else
return d ;
})
// .classed("children", function(d){return typeof d._children[0]._children != "undefined" ;})
.classed("children", function(d){return typeof d._children[0]._children != "undefined" ;})
.on("click", transition);
children = g.selectAll(".child")
.data(function(d) { return d._children || [d]; })
.enter().append("g").on('mouseover',MouseOverMap)
.on('mouseout',mouseOutMap );
children.append("rect")
.attr("class", "child")
.call(rect)
.append("title")
.text(function(d) {
if(critere=="audience")
return d.parent.key +" : "+ d.key + " (" + d3.format(".0f")(d.value) + ")";
else return d.parent.key +" : "+ d.key + " (" + d3.format(".0f")(d._value) + ")";
}).style("fill-opacity","1");
children.append("text")
.attr("class", "ctext")
.attr("font-size","x-small")
.text(function(d) { return d.key; })
.call(text2);
g.append("rect")
.attr("class", "parent")
.call(rect).style("stroke-width",function(d){
// console.log("drawn " + d._children[0]._children )
return typeof d._children[0]._children != "undefined" ? 0 : 1 });
d3.select('#audience').on('click', function () {
if(critere!="audience"){
critere = 'audience' ;
d3.select('#audience').text("Audience") ;
}else{
d3.select('#audience').text("Nombre Medias");
critere = 'pourcentage' ;
}
children.data(function(d) { return d._children || [d]; }).selectAll("g").on('mouseover',MouseOverMap)
.on('mouseout',mouseOutMap )
console.log(root.key+"++ "+root._children[0].key+" - "+root._children[0].value);
accumulate(root);
additionne(root);
console.log(root.key+"++ "+root._children[0].key+" - "+root._children[0].value);
//children.sort(function(b,b){return a.value-b.value})
// layout(racine);
layout(root);
children.selectAll("rect").attr("class","nothing")
children.selectAll(".children").attr("class","nothing")
g.selectAll("rect").call(rect)
children.selectAll("rect").call(rect);
g.selectAll(".ptext").call(text)
g.selectAll(".ctext").call(text2).text(function(d) { return d.key; })
children.selectAll("rect").attr("class","child")
children.selectAll(".children").attr("class","children");
grandparent.select("text").text(name(root));
g.selectAll("tspan").text(updateName)
liste_ordonnee.selectAll('li')
.data(root._children).enter()
liste_ordonnee.selectAll('li')
.call(listeStyle)
}) ;
var t = g.append("text")
.attr("class", "ptext")
.attr("display","inline")
.attr("font-size","small")
.attr("dy", ".75em").call(text)
t.append("tspan")
// .attr("dx", function(d){console.log("dx "+d.key); return d.key.length ;})
.text(updateName);
t.call(text);
g.selectAll("rect")
.style("fill", function(d) {
// console.log("dqsdksqpldksqlmkdsq "+ d.parent.parent );
if(typeof d.parent.parent != "undefined")
return color(d.parent.key); })
function transition(d) {
if (transitioning || !d) return;
transitioning = true;
if(typeof d.parent == "undefined")
d3.select("#headListe").text("Répartition par type de médias");
else if (typeof d._children[0]._children[0]._children == "undefined")
d3.select("#headListe").text("Les propriétées de "+d.key);
else d3.select("#headListe").text("Les propriétaires des médias");
var g2 = display(d),
t1 = g1.transition().duration(400),
t2 = g2.transition().duration(400);
// Update the domain only after entering new elements.
x.domain([d.x, d.x + d.dx]);
y.domain([d.y, d.y + d.dy]);
// Enable anti-aliasing during the transition.
svg.style("shape-rendering", null);
// Draw child nodes on top of parent nodes.
svg.selectAll(".depth").sort(function(a, b) {return a.value-b.value; });
svg.selectAll(".depth").style("fill",null) ;
// Fade-in entering text.
g2.selectAll("text").style("fill-opacity", 0);
// Transition to the new view.
t1.selectAll(".ptext").call(text).style("fill-opacity", 0);
t1.selectAll(".ctext").call(text2).style("fill-opacity", 0);
t2.selectAll(".ptext").call(text).style("fill-opacity", 1);
t2.selectAll(".ctext").call(text2).style("fill-opacity", 1);
t1.selectAll("rect").call(rect);
t2.selectAll("rect").call(rect);
// Remove the old node when the transition is finished.
t1.remove().each("end", function() {
svg.style("shape-rendering", "crispEdges");
transitioning = false;
});
}
d3.selectAll("li").remove();
/* traitement de la liste ordonnée */
/* liste_ordonnee.selectAll("li").data(root._children).enter().append("li")
.text(function(d,i){
return critere == "audience" ? d.key+" : "+d3.format(".0f")(d.value) : d.key+" : "+d._value+" ~ "
+ d3.format(".2f")(100*d.value/d._value) +"%" })
.sort(function(a, b) {return b.value-a.value; });
*/
liste_ordonnee.selectAll('ul')
.data(root._children)
.enter().append('li').call(listeStyle)
;
function updateName(d) {
var rate ="" ;
// liste=d._children[0] ;
if(d._children[0]._children==null){
if(critere=="audience")
{
var valeur = (d.value/d._value)*100 ;
rate = " (" + d3.format(".2f")(valeur) + "%)" ;
}
else
rate = " (" + d3.format(".2f")(100*d.value) + "%)" ;
}
// console.log("children "+ d.key+" "+rate);
if(critere=="audience")
return d.key + " : "+d3.format(".0f")(d.value) + rate ;
else
if(d._children[0]._children==null)
return d.key + " : "+rate ;
else
return d.key + " : "+d3.format(".0f")(d._value) +rate ;
}
function listeStyle(d){
d.style('background', '#fff')
.sort(function(a, b) {
return a.value-b.value; })
.text(function(d,i) {
return critere == "audience" ? d.parent._children.length-i+". "+d.key+" : "+d3.format(".0f")(d.value) :
d.parent._children.length-i+". "+d.key+" : "+d._value+" ~ "
+ d3.format(".2f")(100*d.value/d._value) +"%" }
)
/* .on('mouseover', onMouseover)
.on('mouseout', onMouseout)
*/
.append('svg')
.attr('width', 10)
.attr('height', 10)
.style('float', 'right')
.style('margin-top', 4)
.append('circle')
.attr("r", 5)
.attr('cx', 5)
.attr('cy', 5)
.style('fill', function(d, i) {
if(typeof d._children[0]._children != "undefined")
return color(d.key);
else
return color(d.parent.key) ;
})
}
function mouseOutMap(d,j,i) {
liste = children ;
d3.selectAll("rect").style("stroke-opacity",1);
for(var k =0 ; k< liste.length ; k ++){
var child = liste[k];
for(var z =0 ; z< child.length ; z ++){
var tmp = child[z] ;
d3.select(child[z]).selectAll("rect").style("fill-opacity","0.8");
d3.select(child[z]).selectAll("text").style("fill-opacity","1");
d3.select(child[z]).selectAll("rect").style("stroke",null);
d3.select(child[z]).selectAll("rect").style("stroke-opacity",1);
d3.select(child[z]).selectAll("text").style("font-weight","normal") ;
if(child[z].__data__.key==d.key) {
d3.select(child[z]).selectAll("rect").style("fill",function(d) {
if(typeof d.parent.parent != "undefined")
return color(d.parent.key); });
d3.select(child[z]).selectAll("rect").style("color","#000");
scaleRect(child[z].__data__,child[z],"1");
}
}
}
}
function MouseOverMap(d,j,i) {
// liste = root._children ;
liste = children ;
console.log("key "+d.key);
// d3.selectAll("rect").style("stroke-opacity",0);
for(var k =0 ; k< liste.length ; k ++){
var child = liste[k];
for(var z =0 ; z< child.length ; z ++){
var tmp = child[z] ;
// console.log("accum xx "+children[k][z]);
if(child[z].__data__.key==d.key)
{
console.log("k="+k+" z="+z+" child[z]= "+child[z].key+" === "+children[k][z].__data__.key)
scaleRect(child[z].__data__,child[z],"1.05");
d3.select(child[z]).selectAll("rect").style("fill-opacity","1");
d3.select(child[z]).selectAll("rect").style("stroke","#000");
d3.select(child[z]).selectAll("rect").style("stroke-opacity",1);
d3.select(child[z]).selectAll("text").style("font-weight","bolder") ;
d3.select(child[z]).selectAll("text").call(text2) ;
// d3.select(children[k][z]).selectAll("rect").style("fill","#000");
// d3.select(children[k][z]).selectAll("rect").style("color","#fff");
d3.select(child[z]).selectAll("text").style("fill-opacity","1");
}else{
d3.select(child[z]).selectAll("rect").style("stroke",null);
d3.select(child[z]).selectAll("rect").style("stroke-opacity",0);
d3.select(child[z]).selectAll("rect").style("fill-opacity","0.3");
d3.select(child[z]).selectAll("text").style("fill-opacity","0.2");
}
}
}
}
return g;
}
function listeTransition(text){
console.log("text "+text);
}
function text(text) {
/* text.selectAll("tspan")
.attr("x", function(d) { return x(d.x) + 6; })
*/
text.style("opacity",0);
text.transition()
.duration(600).attr("transform", function(d) {
return "translate(" + (x(d.x)+6) + "," + (y(d.y)+5) + ")"; })/*.attr("x", function(d) { return x(d.x) + 6; })
.attr("y", function(d) { return y(d.y) + 6; })
*/.style("opacity", function(d) {
return (this.getComputedTextLength() < x(d.x + d.dx) - x(d.x)) &&
parseInt(window.getComputedStyle(this).fontSize, 0) < y(d.y + d.dy) - y(d.y) ? 1 : 0; });
}
function text2(text) {
text.transition()
.duration(600).attr("x", function(d) { return x(d.x + d.dx) - this.getComputedTextLength() - 6; })
.attr("y", function(d) { return y(d.y + d.dy) - 2; })
.style("opacity", function(d) { return this.getComputedTextLength() < x(d.x + d.dx) - x(d.x) &&
parseInt(window.getComputedStyle(this).fontSize, 0) < y(d.y + d.dy) - y(d.y) ? 1 : 0; });
}
function rect(rect) {
rect.transition()
.duration(600).attr("transform", function(d) {
// console.log(d.key+"keys "+d.x)
return "translate(" + x(d.x) + "," + y(d.y) + ")"; })
// .attr("x", function(d) { return x(d.x); })
// .attr("y", function(d) { return y(d.y); })
.attr("width", function(d) { return x(d.x + d.dx) - x(d.x); })
.attr("height", function(d) { return y(d.y + d.dy) - y(d.y); })
;
}
function name(d) {
if(critere=="audience")
return d.parent
? name(d.parent) + " / " + d.key + " (" + d3.format(".0f")(d.value) + ")"
: d.key + " (" + d3.format(".0f")(d.value) + ")";
else
return d.parent
? name(d.parent) + " / " + d.key + " (" + d3.format(".0f")(d._value) + ")"
: d.key + " (" + d3.format(".0f")(d._value) + ")";
}
}
if (window.location.hash === "") {
d3.json("file1.json", function(err, res) {
if (!err) {
// console.log(res.children);
var data = d3.nest().key(function(d) { return d.type; }).key(function(d) {return d.proprietaire; }).key(function(d) {return d.nomJournal; }).entries(res.children);
main({title: "Influenceurs des médias"}, {key: "Médias", values: data});
}
});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment