vega-lite icon indicating copy to clipboard operation
vega-lite copied to clipboard

`resolve` conflict with `autosize`

Open PaleNeutron opened this issue 1 year ago • 2 comments

Please:

  • [x] Check for duplicate issues. Please file separate requests as separate issues.
  • [x] Describe how to reproduce the bug.
  • [x] Use the latest versions of Vega and Vega-Lite.
  • [x] Provide an minimal, reproducible example spec in JSON, wrapped by triple backticks like this:
{
  "config": {"view": {"continuousWidth": 400, "continuousHeight": 300}},
  "layer": [
    {
      "mark": "bar",
      "encoding": {
        "x": {"field": "wheat", "type": "quantitative"},
        "y": {"field": "year", "sort": "x", "type": "ordinal"}
      }
    },
    {
      "mark": {"type": "text", "align": "left", "dx": 3},
      "encoding": {
        "text": {"field": "wheat", "type": "quantitative"},
        "x": {"field": "wheat", "type": "quantitative"},
        "y": {"field": "year", "sort": "x", "type": "ordinal"}
      }
    }
  ],
  "resolve": {
        "scale": {
            "y": "independent"
        }
    },
  "autosize": {"contains": "padding", "type": "fit"},
  "data": {"name": "data-76d1ce26ea5761007c35827e1564d86c"},
  "datasets": {
    "data-76d1ce26ea5761007c35827e1564d86c": [
      {"year": 1565, "wheat": 41, "wages": 5},
      {"year": 1570, "wheat": 45, "wages": 5.05},
      {"year": 1575, "wheat": 42, "wages": 5.08},
      {"year": 1580, "wheat": 49, "wages": 5.12},
      {"year": 1585, "wheat": 41.5, "wages": 5.15},
      {"year": 1590, "wheat": 47, "wages": 5.25},
      {"year": 1595, "wheat": 64, "wages": 5.54},
      {"year": 1600, "wheat": 27, "wages": 5.61},
      {"year": 1605, "wheat": 33, "wages": 5.69},
      {"year": 1610, "wheat": 32, "wages": 5.78},
      {"year": 1615, "wheat": 33, "wages": 5.94},
      {"year": 1620, "wheat": 35, "wages": 6.01},
      {"year": 1625, "wheat": 33, "wages": 6.12},
      {"year": 1630, "wheat": 45, "wages": 6.22},
      {"year": 1635, "wheat": 33, "wages": 6.3},
      {"year": 1640, "wheat": 39, "wages": 6.37},
      {"year": 1645, "wheat": 53, "wages": 6.45},
      {"year": 1650, "wheat": 42, "wages": 6.5},
      {"year": 1655, "wheat": 40.5, "wages": 6.6},
      {"year": 1660, "wheat": 46.5, "wages": 6.75},
      {"year": 1665, "wheat": 32, "wages": 6.8},
      {"year": 1670, "wheat": 37, "wages": 6.9},
      {"year": 1675, "wheat": 43, "wages": 7},
      {"year": 1680, "wheat": 35, "wages": 7.3},
      {"year": 1685, "wheat": 27, "wages": 7.6},
      {"year": 1690, "wheat": 40, "wages": 8},
      {"year": 1695, "wheat": 50, "wages": 8.5},
      {"year": 1700, "wheat": 30, "wages": 9},
      {"year": 1705, "wheat": 32, "wages": 10},
      {"year": 1710, "wheat": 44, "wages": 11},
      {"year": 1715, "wheat": 33, "wages": 11.75},
      {"year": 1720, "wheat": 29, "wages": 12.5},
      {"year": 1725, "wheat": 39, "wages": 13},
      {"year": 1730, "wheat": 26, "wages": 13.3},
      {"year": 1735, "wheat": 32, "wages": 13.6},
      {"year": 1740, "wheat": 27, "wages": 14},
      {"year": 1745, "wheat": 27.5, "wages": 14.5},
      {"year": 1750, "wheat": 31, "wages": 15},
      {"year": 1755, "wheat": 35.5, "wages": 15.7},
      {"year": 1760, "wheat": 31, "wages": 16.5},
      {"year": 1765, "wheat": 43, "wages": 17.6},
      {"year": 1770, "wheat": 47, "wages": 18.5},
      {"year": 1775, "wheat": 44, "wages": 19.5},
      {"year": 1780, "wheat": 46, "wages": 21},
      {"year": 1785, "wheat": 42, "wages": 23},
      {"year": 1790, "wheat": 47.5, "wages": 25.5},
      {"year": 1795, "wheat": 76, "wages": 27.5},
      {"year": 1800, "wheat": 79, "wages": 28.5},
      {"year": 1805, "wheat": 81, "wages": 29.5},
      {"year": 1810, "wheat": 99, "wages": 30},
      {"year": 1815, "wheat": 78, "wages": null},
      {"year": 1820, "wheat": 54, "wages": null}
    ]
  }
}
  • [x] If applicable, include error messages and screenshots, GIF videos (e.g. using https://www.cockos.com/licecap/), or working examples (e.g. by clicking share in the Vega-Editor or https://bit.ly/vega-lite-blocks)

In this example editor shows [Info] No error, infos, or warnings with no image. After we remove "autosize": {"contains": "padding", "type": "fit"}, it works.

Editor

PaleNeutron avatar Aug 01 '22 14:08 PaleNeutron

I encountered the same issue while working with a heatmap

#altair-viz/altair#2665

XaviFar avatar Aug 04 '22 10:08 XaviFar

Is this not a contradictory spec? You have continousHeight for an axis that is not continuous. If you change it to height, it works fine.

Editor

PBI-David avatar Aug 04 '22 10:08 PBI-David