cms/app-client/app/components/visu-langues.js
author nowmad@nowmads-macbook-pro.local
Tue, 15 Dec 2015 17:23:11 +0100
changeset 57 36dc51dd60e9
parent 51 70dff07a76ff
child 84 36f84e8f1ad5
permissions -rw-r--r--
clean console.log
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     1
import Ember from 'ember';
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     2
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     3
export default Ember.Component.extend({
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     4
  didInsertElement: function(){
51
70dff07a76ff add click event on visu-carto and visu-langue and update the url with the selected element as filter parameter
nowmad@nowmads-macbook-pro.local
parents: 45
diff changeset
     5
    var _this = this;
70dff07a76ff add click event on visu-carto and visu-langue and update the url with the selected element as filter parameter
nowmad@nowmads-macbook-pro.local
parents: 45
diff changeset
     6
39
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     7
    var data = google.visualization.arrayToDataTable([
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
     8
      ['Location', 'Parent', 'Market trade volume (size)', 'Market increase/decrease (color)'],
45
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
     9
      ['Global',    null,     0,    0],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    10
      ['Français',	'Global',	859,	859],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    11
      ['Alsacien',	'Global',	851,	851],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    12
      ['Breton',    'Global',	403,	403],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    13
      ['Occitan',	'Global',	344,	344],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    14
      ['Judéo-espagnol',	'Global',	77,	77],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    15
      ['Undetermined',	'Global',	45,	45],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    16
      ['Langues régionales',	'Global',	175,	175],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    17
      ['Langues non territoriales',	'Global',	48,	48],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    18
      ['Les Creoles',	'Global',	47,	47],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    19
      ['Guyane',	'Global',	59,	59],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    20
      ['Mayotte',	'Global',	20,	20],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    21
      ['Polynésie française',	'Global',	13,	13],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    22
      ['Wallis et Futuna',	'Global',	43,	43],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    23
      ['Nouvelle-Calédonie',	'Global',	68,	68],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    24
      ['Langues d’oïl', 'Langues régionales',	75,	75],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    25
      ['Francoprovençal',	'Langues régionales',	60,	60],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    26
      ['Corse',	'Langues régionales',	40,	40],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    27
      ['Langue des signes française (LSF)',	'Langues non territoriales',	40,	40],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    28
      ['Berbère',	'Langues non territoriales',	8,	8],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    29
      ['Creole de la Réunion',	'Les Creoles',	32,	32],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    30
      ['Creole de la Guadeloupe',	'Les Creoles',	15,	15],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    31
      ['Ndyuka-Trio Pidgin (njt)',	'Guyane',	31,	31],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    32
      ['Palikúr (plu)', 'Guyane',	6,	6],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    33
      ['Guianese Creole French (gcr)',	'Guyane',	4,	4],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    34
      ['Eastern Maroon Creole (djk)',	'Guyane',	16,	16],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    35
      ['Sranan Tongo (srn)',	'Guyane',	2,	2],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    36
      ['Maore Comorian (swb)',	'Mayotte',	2, 2],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    37
      ['Mauritian Sign Language (lsy)',	'Mayotte',	18,	18],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    38
      ['West Uvean (uve)',	'Polynésie française',	13,	13],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    39
      ['East Futuna (fud)',	'Wallis et Futuna',	23,	23],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    40
      ['Wallisian (wls)',	'Wallis et Futuna',	20,	20],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    41
      ['Nemi (nem)',	'Nouvelle-Calédonie',	15,	15],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    42
      ['Xârâcùù (ane)',	'Nouvelle-Calédonie',	12,	12],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    43
      ['Cemuhî (cam)',	'Nouvelle-Calédonie',	9,	9],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    44
      ['Xaragure (axx)',	'Nouvelle-Calédonie',	9,	9],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    45
      ['Iaai (iai)',	'Nouvelle-Calédonie',	8,	8],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    46
      ['Nêlêmwa-Nixumwak (nee)',	'Nouvelle-Calédonie',	4,	4],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    47
      ['Dehu (dhv)',	'Nouvelle-Calédonie',	2,	2],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    48
      ['Nengone (nen)',	'Nouvelle-Calédonie',	2,	2],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    49
      ['Ajië (aji)',	'Nouvelle-Calédonie',	1,	1],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    50
      ['Numee (kdk)',	'Nouvelle-Calédonie',	1,	1],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    51
      ['Yuaga (nua)',	'Nouvelle-Calédonie',	1,	1],
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    52
      ['Bwatoo (bwa)',	'Nouvelle-Calédonie',	4,	4]
39
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    53
    ]);
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    54
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    55
    var tree = new google.visualization.TreeMap(document.getElementById('chart_div'));
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    56
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    57
    tree.draw(data, {
45
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    58
      minColor: '#E0EEEF',
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    59
      midColor: '#7CACAE',
b9adc23abd01 update visualisation with sample values
nowmad@nowmads-macbook-pro.local
parents: 39
diff changeset
    60
      maxColor: '#2D7073',
39
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    61
      headerHeight: 15,
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    62
      fontColor: 'black',
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    63
      showScale: true
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    64
    });
51
70dff07a76ff add click event on visu-carto and visu-langue and update the url with the selected element as filter parameter
nowmad@nowmads-macbook-pro.local
parents: 45
diff changeset
    65
70dff07a76ff add click event on visu-carto and visu-langue and update the url with the selected element as filter parameter
nowmad@nowmads-macbook-pro.local
parents: 45
diff changeset
    66
    function selectHandler (){
70dff07a76ff add click event on visu-carto and visu-langue and update the url with the selected element as filter parameter
nowmad@nowmads-macbook-pro.local
parents: 45
diff changeset
    67
      _this.sendAction('action', data.getValue(tree.getSelection()[0].row, 0));
70dff07a76ff add click event on visu-carto and visu-langue and update the url with the selected element as filter parameter
nowmad@nowmads-macbook-pro.local
parents: 45
diff changeset
    68
    }
70dff07a76ff add click event on visu-carto and visu-langue and update the url with the selected element as filter parameter
nowmad@nowmads-macbook-pro.local
parents: 45
diff changeset
    69
70dff07a76ff add click event on visu-carto and visu-langue and update the url with the selected element as filter parameter
nowmad@nowmads-macbook-pro.local
parents: 45
diff changeset
    70
    google.visualization.events.addListener(tree, 'select', selectHandler);
70dff07a76ff add click event on visu-carto and visu-langue and update the url with the selected element as filter parameter
nowmad@nowmads-macbook-pro.local
parents: 45
diff changeset
    71
39
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    72
  }
c693e8673d5b add visu-langue with google treemap
nowmad@23.1.168.192.in-addr.arpa
parents:
diff changeset
    73
});