Search code examples
vega-litevega

Changing the scale on a vega-lite waterfall


I would like to scale the y-axis of a vega-lite waterfall so that the y-axis does not start at 0 and the corresponding bars in the chart are formatted correctly with the right numbers.

I was able to format a vega-lite chart to change the scale, but I am having trouble formatting the bars to the correct size.

I made the following adjustment to the original: "scale": {"domain": [2000, 10000] But this changed the y-axis while keeping the bars their original size.

I get the following chart: Example


Solution

  • It sounds like you want to clip the bar at y = 2000.

    Try "clip": true along with "scale": {"domain": [2000, 10000]} .

    (Original Vega-lite waterfall chart example is found at https://vega.github.io/vega-lite/examples/waterfall_chart.html)

    enter image description here

    enter image description here