편집을 취소할 수 있습니다. 이 편집을 되돌리려면 아래의 바뀐 내용을 확인한 후 게시해주세요.
최신판 | 당신의 편집 | ||
153번째 줄: | 153번째 줄: | ||
"width": 400, | "width": 400, | ||
"height": 200, | "height": 200, | ||
"padding": | "padding": 5, | ||
"data": [ | "data": [ | ||
{ | { | ||
"name": "table", | "name": "table", | ||
"values": [ | "values": [ | ||
{" | {"category": "A", "amount": 28}, | ||
{" | {"category": "B", "amount": 55}, | ||
{" | {"category": "C", "amount": 43}, | ||
{" | {"category": "D", "amount": 91}, | ||
{" | {"category": "E", "amount": 81}, | ||
{" | {"category": "F", "amount": 53}, | ||
{"category": "G", "amount": 19}, | |||
{" | {"category": "H", "amount": 87} | ||
{" | |||
] | ] | ||
} | } | ||
], | ], | ||
"signals": [ | |||
{ | |||
"name": "tooltip", | |||
"value": {}, | |||
"on": [ | |||
{"events": "rect:mouseover", "update": "datum"}, | |||
{"events": "rect:mouseout", "update": "{}"} | |||
] | |||
} | |||
], | |||
"scales": [ | "scales": [ | ||
{ | { | ||
"name": " | "name": "xscale", | ||
"type": " | "type": "band", | ||
"domain": {"data": "table", "field": "category"}, | |||
"range": "width", | "range": "width", | ||
" | "padding": 0.05, | ||
"round": true | |||
}, | }, | ||
{ | { | ||
"name": " | "name": "yscale", | ||
"domain": {"data": "table", "field": "amount"}, | |||
"nice": true, | |||
"domain": {"data": "table", "field": " | "range": "height" | ||
"nice": true | |||
} | } | ||
], | ], | ||
"axes": [ | "axes": [ | ||
{" | { "orient": "bottom", "scale": "xscale" }, | ||
{" | { "orient": "left", "scale": "yscale" } | ||
], | ], | ||
"marks": [ | "marks": [ | ||
{ | { | ||
"type": "rect", | "type": "rect", | ||
"from": {"data": "table"}, | "from": {"data":"table"}, | ||
" | "encode": { | ||
"enter": { | "enter": { | ||
"x": {"scale": " | "x": {"scale": "xscale", "field": "category"}, | ||
"width": {"scale": " | "width": {"scale": "xscale", "band": 1}, | ||
"y": {"scale": " | "y": {"scale": "yscale", "field": "amount"}, | ||
"y2": {"scale": " | "y2": {"scale": "yscale", "value": 0} | ||
}, | }, | ||
"update": { | "update": { | ||
206번째 줄: | 220번째 줄: | ||
"hover": { | "hover": { | ||
"fill": {"value": "red"} | "fill": {"value": "red"} | ||
} | |||
} | |||
}, | |||
{ | |||
"type": "text", | |||
"encode": { | |||
"enter": { | |||
"align": {"value": "center"}, | |||
"baseline": {"value": "bottom"}, | |||
"fill": {"value": "#333"} | |||
}, | |||
"update": { | |||
"x": {"scale": "xscale", "signal": "tooltip.category", "band": 0.5}, | |||
"y": {"scale": "yscale", "signal": "tooltip.amount", "offset": -2}, | |||
"text": {"signal": "tooltip.amount"}, | |||
"fillOpacity": [ | |||
{"test": "isNaN(tooltip.amount)", "value": 0}, | |||
{"value": 1} | |||
] | |||
} | } | ||
} | } | ||
211번째 줄: | 244번째 줄: | ||
] | ] | ||
} | } | ||
</graph> | </graph> |