Plr : Différence entre versions

De wiki
Aller à : navigation, rechercher
 
(8 révisions intermédiaires par le même utilisateur non affichées)
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",
+
   "version": 2,
   "width": 500,
+
   "width": 800,
 
   "height": 200,
 
   "height": 200,
   "padding": 5,
+
   "padding": {"top": 10, "left": 65, "bottom": 20, "right": 10},
  
   "signals": [
+
   "data": [
 
     {
 
     {
       "name": "interpolate",
+
       "name": "table",
       "value": "linear",
+
       "values": [
      "bind": {
+
        {"nom": "mich", "morts": 72 },
         "input": "select",
+
        {"nom": "14-08", "morts": 63 },
         "options": [
+
        {"nom": "14-09", "morts": 61 },
          "basis",
+
        {"nom": "14-10", "morts": 41 },
          "cardinal",
+
        {"nom": "14-11", "morts": 93 },
          "catmull-rom",
+
        {"nom": "14-12", "morts": 73 },
          "linear",
+
         {"nom": "15-01", "morts": 62 },
          "monotone",
+
         {"nom": "15-02", "morts": 65 },
          "natural",
+
        {"nom": "15-03", "morts": 47 },
          "step",
+
        {"nom": "15-04", "morts": 52 },
          "step-after",
+
        {"nom": "15-05", "morts": 50 },
          "step-before"
+
        {"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": "table",
+
       "name": "tooltip",
       "values": [
+
       "init": {},
        {"x": 0, "y": 28, "c":0}, {"x": 0, "y": 20, "c":1},
+
      "streams": [
        {"x": 1, "y": 43, "c":0}, {"x": 1, "y": 35, "c":1},
+
         {"type": "rect:mouseover", "expr": "datum"},
        {"x": 2, "y": 81, "c":0}, {"x": 2, "y": 10, "c":1},
+
         {"type": "rect:mouseout", "expr": "{}"}
        {"x": 3, "y": 19, "c":0}, {"x": 3, "y": 15, "c":1},
 
        {"x": 4, "y": 52, "c":0}, {"x": 4, "y": 48, "c":1},
 
        {"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},
 
         {"x": 8, "y": 68, "c":0}, {"x": 8, "y": 16, "c":1},
 
        {"x": 9, "y": 49, "c":0}, {"x": 9, "y": 25, "c":1}
 
 
       ]
 
       ]
 
     }
 
     }
 
   ],
 
   ],
  
   "scales": [
+
   "predicates": [
    {
 
      "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": "tooltip", "type": "==",  
      "type": "ordinal",
+
       "operands": [{"signal": "tooltip._id"}, {"arg": "id"}]
      "range": "category",
 
       "domain": {"data": "table", "field": "c"}
 
 
     }
 
     }
 +
  ],
 +
 +
  "scales": [
 +
    { "name": "xscale", "type": "ordinal", "range": "width",
 +
      "domain": {"data": "table", "field": "nom"} },
 +
    { "name": "yscale", "type": "linear", "range": "height", "nice": true,
 +
      "domain": {"data": "table", "field": "morts"} }
 
   ],
 
   ],
  
 
   "axes": [
 
   "axes": [
     {"orient": "bottom", "scale": "x"},
+
     { "type": "x", "scale": "xscale" },
     {"orient": "left", "scale": "y"}
+
     { "type": "y", "scale": "yscale" }
 
   ],
 
   ],
  
 
   "marks": [
 
   "marks": [
 
     {
 
     {
       "type": "group",
+
       "type": "rect",
       "from": {
+
       "from": {"data":"table"},
         "facet": {
+
      "properties": {
           "name": "series",
+
         "enter": {
           "data": "table",
+
           "x": {"scale": "xscale", "field": "nom"},
           "groupby": "c"
+
          "width": {"scale": "xscale", "band": true, "offset": -1},
         }
+
           "y": {"scale": "yscale", "field": "morts"},
      },
+
           "y2": {"field": {"group": "height"} }
      "marks": [
+
         },
        {
+
        "update": { "fill": {"value": "steelblue"} },
          "type": "line",
+
        "hover": { "fill": {"value": "red"} }
           "from": {"data": "series"},
+
      }
           "encode": {
+
    },
            "enter": {
+
    {
              "x": {"scale": "x", "field": "x"},
+
      "type": "text",
              "y": {"scale": "y", "field": "y"},
+
      "properties": {
              "stroke": {"scale": "color", "field": "c"},
+
        "enter": {
              "strokeWidth": {"value": 2}
+
           "align": {"value": "center"},
            },
+
           "fill": {"value": "#333"}
             "update": {
+
        },
              "interpolate": {"signal": "interpolate"},
+
        "update": {
              "fillOpacity": {"value": 1}
+
          "x": {"scale": "xscale", "signal": "tooltip.nom"},
            },
+
          "dx": {"scale": "xscale", "band": true, "mult": 0.5},
            "hover": {
+
          "y": {"scale": "yscale", "signal": "tooltip.morts", "offset": -5},
               "fillOpacity": {"value": 0.5}
+
          "text": {"signal": "tooltip.morts"},
             }
+
          "fillOpacity": {
 +
             "rule": [
 +
              {
 +
                "predicate": {"name": "tooltip", "id": {"value": null} },
 +
                "value": 0
 +
              },
 +
               {"value": 1}
 +
             ]
 
           }
 
           }
 
         }
 
         }
       ]
+
       }
 
     }
 
     }
 
   ]
 
   ]
 
}
 
}
 
+
| mode=interactive }}
}}
 

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