d3.js - How do I change color of a bar in Vega-lite Bar Chart? -
i want change default blue color of bar in vega-lite bar chart. how can it? posting json specification below:
{ "data": { "values": [ {"a":"a", "b":28}, {"a":"b", "b":55}, {"a":"c", "b":43}, {"a":"d", "b":91}, {"a":"e", "b":81}, {"a":"f", "b":53}, {"a":"g", "b":19}, {"a":"h", "b":87}, {"a":"i", "b":52} ] }, "mark": "bar", "encoding": { "x": {bin:false, "type": "ordinal","field": "a"}, "y": {"type": "quantitative","field": "b"} } } thanks in advance.
i found answer own question. :) supposed add color key inside encoding block. please see updated code below:
{ "data": { "values": [ {"a":"a", "b":28}, {"a":"b", "b":55}, {"a":"c", "b":43}, {"a":"d", "b":91}, {"a":"e", "b":81}, {"a":"f", "b":53}, {"a":"g", "b":19}, {"a":"h", "b":87}, {"a":"i", "b":52} ] }, "mark": "bar", "encoding": { "x": {"type": "ordinal","field": "a"}, "y": {"type": "quantitative","field": "b"}, "color": {"value": "#ff9900"} } }
Comments
Post a Comment