Plr : Différence entre versions

De wiki
Aller à : navigation, rechercher
Ligne 11 : Ligne 11 :
 
| nice nice || y sourit || très content
 
| nice nice || y sourit || très content
 
|}
 
|}
 
{{#tag:graph|width=400|height=100|xAxisTitle=X|yAxisTitle=Y
 
|type=rect|x=1,2,3,4,5,6,7,8|y=10,12,6,14,2,10,7,9}}
 
 
 
{{#tag:graph|
 
{{#tag:graph|
 
{
 
{
 
   "$schema": "https://vega.github.io/schema/vega/v4.json",
 
   "$schema": "https://vega.github.io/schema/vega/v4.json",
   "width": 400,
+
   "width": 500,
 
   "height": 200,
 
   "height": 200,
 
   "padding": 5,
 
   "padding": 5,
  
   "data": [
+
   "signals": [
 
     {
 
     {
       "name": "table",
+
       "name": "interpolate",
       "values": [
+
       "value": "linear",
        {"category": "A", "amount": 28},
+
      "bind": {
         {"category": "B", "amount": 55},
+
         "input": "select",
         {"category": "C", "amount": 43},
+
         "options": [
        {"category": "D", "amount": 91},
+
          "basis",
        {"category": "E", "amount": 81},
+
          "cardinal",
        {"category": "F", "amount": 53},
+
          "catmull-rom",
        {"category": "G", "amount": 19},
+
          "linear",
         {"category": "H", "amount": 87}
+
          "monotone",
       ]
+
          "natural",
 +
          "step",
 +
          "step-after",
 +
          "step-before"
 +
         ]
 +
       }
 
     }
 
     }
 
   ],
 
   ],
  
   "signals": [
+
   "data": [
 
     {
 
     {
       "name": "tooltip",
+
       "name": "table",
       "value": {},
+
       "values": [
      "on": [
+
        {"x": 0, "y": 28, "c":0}, {"x": 0, "y": 20, "c":1},
         {"events": "rect:mouseover", "update": "datum"},
+
        {"x": 1, "y": 43, "c":0}, {"x": 1, "y": 35, "c":1},
         {"events": "rect:mouseout", "update": "{}"}
+
        {"x": 2, "y": 81, "c":0}, {"x": 2, "y": 10, "c":1},
 +
        {"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}
 
       ]
 
       ]
 
     }
 
     }
Ligne 51 : Ligne 59 :
 
   "scales": [
 
   "scales": [
 
     {
 
     {
       "name": "xscale",
+
       "name": "x",
       "type": "band",
+
       "type": "point",
      "domain": {"data": "table", "field": "category"},
 
 
       "range": "width",
 
       "range": "width",
       "padding": 0.05,
+
       "domain": {"data": "table", "field": "x"}
      "round": true
 
 
     },
 
     },
 
     {
 
     {
       "name": "yscale",
+
       "name": "y",
       "domain": {"data": "table", "field": "amount"},
+
       "type": "linear",
 +
      "range": "height",
 
       "nice": true,
 
       "nice": true,
       "range": "height"
+
      "zero": true,
 +
      "domain": {"data": "table", "field": "y"}
 +
    },
 +
    {
 +
      "name": "color",
 +
      "type": "ordinal",
 +
       "range": "category",
 +
      "domain": {"data": "table", "field": "c"}
 
     }
 
     }
 
   ],
 
   ],
  
 
   "axes": [
 
   "axes": [
     { "orient": "bottom", "scale": "xscale" },
+
     {"orient": "bottom", "scale": "x"},
     { "orient": "left", "scale": "yscale" }
+
     {"orient": "left", "scale": "y"}
 
   ],
 
   ],
  
 
   "marks": [
 
   "marks": [
 
     {
 
     {
       "type": "rect",
+
       "type": "group",
       "from": {"data":"table"},
+
       "from": {
      "encode": {
+
         "facet": {
         "enter": {
+
           "name": "series",
           "x": {"scale": "xscale", "field": "category"},
+
           "data": "table",
           "width": {"scale": "xscale", "band": 1},
+
           "groupby": "c"
          "y": {"scale": "yscale", "field": "amount"},
 
          "y2": {"scale": "yscale", "value": 0}
 
        },
 
        "update": {
 
          "fill": {"value": "steelblue"}
 
        },
 
        "hover": {
 
           "fill": {"value": "red"}
 
 
         }
 
         }
       }
+
       },
    },
+
       "marks": [
    {
+
        {
       "type": "text",
+
          "type": "line",
      "encode": {
+
           "from": {"data": "series"},
        "enter": {
+
           "encode": {
           "align": {"value": "center"},
+
            "enter": {
           "baseline": {"value": "bottom"},
+
              "x": {"scale": "x", "field": "x"},
          "fill": {"value": "#333"}
+
              "y": {"scale": "y", "field": "y"},
        },
+
              "stroke": {"scale": "color", "field": "c"},
        "update": {
+
              "strokeWidth": {"value": 2}
          "x": {"scale": "xscale", "signal": "tooltip.category", "band": 0.5},
+
            },
          "y": {"scale": "yscale", "signal": "tooltip.amount", "offset": -2},
+
            "update": {
          "text": {"signal": "tooltip.amount"},
+
              "interpolate": {"signal": "interpolate"},
          "fillOpacity": [
+
              "fillOpacity": {"value": 1}
             {"test": "datum === tooltip", "value": 0},
+
            },
             {"value": 1}
+
             "hover": {
           ]
+
              "fillOpacity": {"value": 0.5}
 +
             }
 +
           }
 
         }
 
         }
       }
+
       ]
 
     }
 
     }
 
   ]
 
   ]
 
}
 
}
 +
 
}}
 
}}

Version du 18 janvier 2019 à 14:41

Creation de PLR

Phrase action emotion
Bon délire dab dab content
DANH ! droite pas content
nice nice y sourit très content