Vega plugin:Changing color and size of the labels

Hello,

Is it possible to change the laben size and/or color? I am using Vega plugin.
Here is the screenshot of my diagram.

and the query is

{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"description": "A bar chart that directly encodes color names in the data.",
"data": {
"values": [
{"customer":"A", "@timestamp": 7, "state": "red"},
{"customer":"A", "@timestamp": 5, "state": "green"},
{"customer":"B", "@timestamp": 6, "state": "green"},
{"customer":"B", "@timestamp": 4, "state": "red"},
{"customer":"B", "@timestamp": 3, "state": "green"},
{"customer":"C", "@timestamp": 2, "state": "green"},
{"customer":"C", "@timestamp": 1, "state": " yellow"}
]
},
"transform": [
{
"filter": {"field": "state", "oneOf":["red", "green"]}
}
],
"mark": "bar",
"encoding": {
"y": {
"field": "state",
"type": "nominal"
},
"x": {
"aggregate": "count",
"field": "@timestamp",
"type": "quantitative"
},
"color": {
"field": "state",
"type": "nominal",
"scale": null
}
}
}

Below is your vega example updated to specify axis label color and axis label font size. I found these at https://vega.github.io/vega-lite/docs/axis.html#labels-config

{
  "$schema": "https://vega.github.io/schema/vega-lite/v2.json",
  "description": "A bar chart that directly encodes color names in the data.",
  "data": {
    "values": [
      {"customer":"A", "@timestamp": 7, "state": "red"},
      {"customer":"A", "@timestamp": 5, "state": "green"},
      {"customer":"B", "@timestamp": 6, "state": "green"},
      {"customer":"B", "@timestamp": 4, "state": "red"},
      {"customer":"B", "@timestamp": 3, "state": "green"},
      {"customer":"C", "@timestamp": 2, "state": "green"},
      {"customer":"C", "@timestamp": 1, "state": " yellow"}
    ]
  },
  "config": {
    "axis": {
      "labelColor":"red",
      "labelFontSize":16
    }
  },
  "transform": [
    {
    "filter": {"field": "state", "oneOf":["red", "green"]}
    }
  ],
  "mark": "bar",
  "encoding": {
    "y": {
      "field": "state",
      "type": "nominal"
    },
    "x": {
      "aggregate": "count",
      "field": "@timestamp",
      "type": "quantitative",
    },
    "color": {
      "field": "state",
      "type": "nominal",
      "scale": null
    }
  }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.