Plr : Différence entre versions

De wiki
Aller à : navigation, rechercher
Ligne 1 : Ligne 1 :
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
 
|}
 
 
{{#tag:graph|
 
{{#tag:graph|
 
{
 
{
 
   "$schema": "https://vega.github.io/schema/vega/v4.json",
 
   "$schema": "https://vega.github.io/schema/vega/v4.json",
   "width": 500,
+
   "width": 600,
   "height": 200,
+
   "height": 1600,
 
   "padding": 5,
 
   "padding": 5,
  
 
   "signals": [
 
   "signals": [
 
     {
 
     {
       "name": "interpolate",
+
       "name": "labels", "value": true,
       "value": "linear",
+
       "bind": {"input": "checkbox"}
 +
    },
 +
    {
 +
      "name": "layout", "value": "tidy",
 +
      "bind": {"input": "radio", "options": ["tidy", "cluster"]}
 +
    },
 +
    {
 +
      "name": "links", "value": "diagonal",
 
       "bind": {
 
       "bind": {
 
         "input": "select",
 
         "input": "select",
         "options": [
+
         "options": ["line", "curve", "diagonal", "orthogonal"]
          "basis",
 
          "cardinal",
 
          "catmull-rom",
 
          "linear",
 
          "monotone",
 
          "natural",
 
          "step",
 
          "step-after",
 
          "step-before"
 
        ]
 
 
       }
 
       }
 
     }
 
     }
Ligne 41 : Ligne 26 :
 
   "data": [
 
   "data": [
 
     {
 
     {
       "name": "table",
+
       "name": "tree",
       "values": [
+
       "url": "data/flare.json",
        {"x": 0, "y": 28, "c":0}, {"x": 0, "y": 20, "c":1},
+
      "transform": [
         {"x": 1, "y": 43, "c":0}, {"x": 1, "y": 35, "c":1},
+
         {
         {"x": 2, "y": 81, "c":0}, {"x": 2, "y": 10, "c":1},
+
          "type": "stratify",
        {"x": 3, "y": 19, "c":0}, {"x": 3, "y": 15, "c":1},
+
          "key": "id",
        {"x": 4, "y": 52, "c":0}, {"x": 4, "y": 48, "c":1},
+
          "parentKey": "parent"
         {"x": 5, "y": 24, "c":0}, {"x": 5, "y": 28, "c":1},
+
        },
        {"x": 6, "y": 87, "c":0}, {"x": 6, "y": 66, "c":1},
+
         {
         {"x": 7, "y": 17, "c":0}, {"x": 7, "y": 27, "c":1},
+
          "type": "tree",
        {"x": 8, "y": 68, "c":0}, {"x": 8, "y": 16, "c":1},
+
          "method": {"signal": "layout"},
         {"x": 9, "y": 49, "c":0}, {"x": 9, "y": 25, "c":1}
+
          "size": [{"signal": "height"}, {"signal": "width - 100"}],
 +
          "as": ["y", "x", "depth", "children"]
 +
         }
 +
      ]
 +
    },
 +
    {
 +
      "name": "links",
 +
      "source": "tree",
 +
      "transform": [
 +
         { "type": "treelinks" },
 +
        {
 +
          "type": "linkpath",
 +
          "orient": "horizontal",
 +
          "shape": {"signal": "links"}
 +
         }
 
       ]
 
       ]
 
     }
 
     }
Ligne 58 : Ligne 57 :
  
 
   "scales": [
 
   "scales": [
    {
 
      "name": "x",
 
      "type": "point",
 
      "range": "width",
 
      "domain": {"data": "table", "field": "x"}
 
    },
 
    {
 
      "name": "y",
 
      "type": "linear",
 
      "range": "height",
 
      "nice": true,
 
      "zero": true,
 
      "domain": {"data": "table", "field": "y"}
 
    },
 
 
     {
 
     {
 
       "name": "color",
 
       "name": "color",
       "type": "ordinal",
+
       "type": "sequential",
       "range": "category",
+
       "range": {"scheme": "magma"},
       "domain": {"data": "table", "field": "c"}
+
       "domain": {"data": "tree", "field": "depth"},
 +
      "zero": true
 
     }
 
     }
  ],
 
 
  "axes": [
 
    {"orient": "bottom", "scale": "x"},
 
    {"orient": "left", "scale": "y"}
 
 
   ],
 
   ],
  
 
   "marks": [
 
   "marks": [
 
     {
 
     {
       "type": "group",
+
       "type": "path",
       "from": {
+
       "from": {"data": "links"},
         "facet": {
+
      "encode": {
           "name": "series",
+
         "update": {
           "data": "table",
+
           "path": {"field": "path"},
           "groupby": "c"
+
           "stroke": {"value": "#ccc"}
 +
        }
 +
      }
 +
    },
 +
    {
 +
      "type": "symbol",
 +
      "from": {"data": "tree"},
 +
      "encode": {
 +
        "enter": {
 +
           "size": {"value": 100},
 +
          "stroke": {"value": "#fff"}
 +
        },
 +
        "update": {
 +
          "x": {"field": "x"},
 +
          "y": {"field": "y"},
 +
          "fill": {"scale": "color", "field": "depth"}
 
         }
 
         }
       },
+
       }
      "marks": [
+
    },
        {
+
    {
          "type": "line",
+
      "type": "text",
          "from": {"data": "series"},
+
      "from": {"data": "tree"},
          "encode": {
+
      "encode": {
            "enter": {
+
        "enter": {
              "x": {"scale": "x", "field": "x"},
+
          "text": {"field": "name"},
              "y": {"scale": "y", "field": "y"},
+
          "fontSize": {"value": 9},
              "stroke": {"scale": "color", "field": "c"},
+
          "baseline": {"value": "middle"}
              "strokeWidth": {"value": 2}
+
        },
            },
+
        "update": {
            "update": {
+
          "x": {"field": "x"},
              "interpolate": {"signal": "interpolate"},
+
          "y": {"field": "y"},
              "fillOpacity": {"value": 1}
+
          "dx": {"signal": "datum.children ? -7 : 7"},
            },
+
          "align": {"signal": "datum.children ? 'right' : 'left'"},
            "hover": {
+
          "opacity": {"signal": "labels ? 1 : 0"}
              "fillOpacity": {"value": 0.5}
 
            }
 
          }
 
 
         }
 
         }
       ]
+
       }
 
     }
 
     }
 
   ]
 
   ]

Version du 18 janvier 2019 à 14:42