Plr : Différence entre versions

De wiki
Aller à : navigation, rechercher
 
(5 révisions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
 
{{#tag:graph|
 
{{#tag:graph|
 
{
 
{
   "width": 600,
+
  "version": 2,
   "height": 1600,
+
   "width": 800,
   "padding": 5,
+
   "height": 200,
 +
   "padding": {"top": 10, "left": 65, "bottom": 20, "right": 10},
  
   "signals": [
+
   "data": [
 
     {
 
     {
       "name": "labels", "value": true,
+
       "name": "table",
      "bind": {"input": "checkbox"}
+
      "values": [
    },
+
        {"nom": "mich", "morts": 72 },
    {
+
        {"nom": "14-08", "morts": 63 },
      "name": "layout", "value": "tidy",
+
        {"nom": "14-09", "morts": 61 },
      "bind": {"input": "radio", "options": ["tidy", "cluster"]}
+
        {"nom": "14-10", "morts": 41 },
    },
+
        {"nom": "14-11", "morts": 93 },
    {
+
        {"nom": "14-12", "morts": 73 },
      "name": "links", "value": "diagonal",
+
        {"nom": "15-01", "morts": 62 },
      "bind": {
+
        {"nom": "15-02", "morts": 65 },
         "input": "select",
+
        {"nom": "15-03", "morts": 47 },
         "options": ["line", "curve", "diagonal", "orthogonal"]
+
        {"nom": "15-04", "morts": 52 },
       }
+
        {"nom": "15-05", "morts": 50 },
 +
        {"nom": "15-06", "morts": 39 },
 +
        {"nom": "15-07", "morts": 69 },
 +
        {"nom": "15-08", "morts": 49 },
 +
        {"nom": "15-09", "morts": 29 },
 +
         {"nom": "15-10", "morts": 32 },
 +
         {"nom": "15-11", "morts": 49 },
 +
        {"nom": "15-12", "morts": 34 },
 +
       ]
 
     }
 
     }
 
   ],
 
   ],
  
   "data": [
+
   "signals": [
 
     {
 
     {
       "name": "tree",
+
       "name": "tooltip",
       "url": "data/flare.json",
+
       "init": {},
       "transform": [
+
       "streams": [
         {
+
         {"type": "rect:mouseover", "expr": "datum"},
          "type": "stratify",
+
         {"type": "rect:mouseout", "expr": "{}"}
          "key": "id",
 
          "parentKey": "parent"
 
        },
 
         {
 
          "type": "tree",
 
          "method": {"signal": "layout"},
 
          "size": [{"signal": "height"}, {"signal": "width - 100"}],
 
          "as": ["y", "x", "depth", "children"]
 
        }
 
 
       ]
 
       ]
     },
+
     }
 +
  ],
 +
 
 +
  "predicates": [
 
     {
 
     {
       "name": "links",
+
       "name": "tooltip", "type": "==",  
      "source": "tree",
+
       "operands": [{"signal": "tooltip._id"}, {"arg": "id"}]
       "transform": [
 
        { "type": "treelinks" },
 
        {
 
          "type": "linkpath",
 
          "orient": "horizontal",
 
          "shape": {"signal": "links"}
 
        }
 
      ]
 
 
     }
 
     }
 
   ],
 
   ],
  
 
   "scales": [
 
   "scales": [
     {
+
     { "name": "xscale", "type": "ordinal", "range": "width",
      "name": "color",
+
       "domain": {"data": "table", "field": "nom"} },
      "type": "sequential",
+
    { "name": "yscale", "type": "linear", "range": "height", "nice": true,
       "range": {"scheme": "magma"},
+
       "domain": {"data": "table", "field": "morts"} }
       "domain": {"data": "tree", "field": "depth"},
+
  ],
      "zero": true
+
 
     }
+
  "axes": [
 +
    { "type": "x", "scale": "xscale" },
 +
     { "type": "y", "scale": "yscale" }
 
   ],
 
   ],
  
 
   "marks": [
 
   "marks": [
 
     {
 
     {
       "type": "path",
+
       "type": "rect",
       "from": {"data": "links"},
+
       "from": {"data":"table"},
       "encode": {
+
       "properties": {
        "update": {
 
          "path": {"field": "path"},
 
          "stroke": {"value": "#ccc"}
 
        }
 
      }
 
    },
 
    {
 
      "type": "symbol",
 
      "from": {"data": "tree"},
 
      "encode": {
 
 
         "enter": {
 
         "enter": {
           "size": {"value": 100},
+
           "x": {"scale": "xscale", "field": "nom"},
           "stroke": {"value": "#fff"}
+
           "width": {"scale": "xscale", "band": true, "offset": -1},
 +
          "y": {"scale": "yscale", "field": "morts"},
 +
          "y2": {"field": {"group": "height"} }
 
         },
 
         },
         "update": {
+
         "update": { "fill": {"value": "steelblue"} },
          "x": {"field": "x"},
+
        "hover": { "fill": {"value": "red"} }
          "y": {"field": "y"},
 
          "fill": {"scale": "color", "field": "depth"}
 
        }
 
 
       }
 
       }
 
     },
 
     },
 
     {
 
     {
 
       "type": "text",
 
       "type": "text",
       "from": {"data": "tree"},
+
       "properties": {
      "encode": {
 
 
         "enter": {
 
         "enter": {
           "text": {"field": "name"},
+
           "align": {"value": "center"},
           "fontSize": {"value": 9},
+
           "fill": {"value": "#333"}
          "baseline": {"value": "middle"}
 
 
         },
 
         },
 
         "update": {
 
         "update": {
           "x": {"field": "x"},
+
           "x": {"scale": "xscale", "signal": "tooltip.nom"},
           "y": {"field": "y"},
+
           "dx": {"scale": "xscale", "band": true, "mult": 0.5},
           "dx": {"signal": "datum.children ? -7 : 7"},
+
           "y": {"scale": "yscale", "signal": "tooltip.morts", "offset": -5},
           "align": {"signal": "datum.children ? 'right' : 'left'"},
+
           "text": {"signal": "tooltip.morts"},
           "opacity": {"signal": "labels ? 1 : 0"}
+
           "fillOpacity": {
 +
            "rule": [
 +
              {
 +
                "predicate": {"name": "tooltip", "id": {"value": null} },
 +
                "value": 0
 +
              },
 +
              {"value": 1}
 +
            ]
 +
          }
 
         }
 
         }
 
       }
 
       }
Ligne 111 : Ligne 103 :
 
   ]
 
   ]
 
}
 
}
 
+
| mode=interactive }}
}}
 
 
 
Creation de PLR
 
 
 
{| class="wikitable"
 
|-
 
! Phrase !! action !! emotion
 
|-
 
| Bon délire || dab dab || content
 
|-
 
| DANH ! || droite || pas content
 
|-
 
| nice nice || y sourit || très content
 
|}
 

Version actuelle datée du 1 avril 2019 à 13:57