[
{"name": "one series over numbers: y stretched to zero and niced to 0-60, no legend", "args": [{"width": 300, "height": 200, "x": [0, 1, 2, 3, 4], "dates": null, "series": [{"name": "Sales", "values": [10, 30, 20, 40, 50]}], "curve": "linear", "yZero": true}], "expect": {"width": 300, "height": 200, "plot": {"x": 31, "y": 12, "width": 249, "height": 158}, "xAxis": {"orient": "bottom", "position": 170, "line": {"x1": 31, "y1": 170, "x2": 280, "y2": 170}, "ticks": [{"position": 31, "label": "0", "tick": {"x1": 31, "y1": 170, "x2": 31, "y2": 176}, "labelX": 31, "labelY": 179, "anchor": "middle", "baseline": "hanging"}, {"position": 93.25, "label": "1", "tick": {"x1": 93.25, "y1": 170, "x2": 93.25, "y2": 176}, "labelX": 93.25, "labelY": 179, "anchor": "middle", "baseline": "hanging"}, {"position": 155.5, "label": "2", "tick": {"x1": 155.5, "y1": 170, "x2": 155.5, "y2": 176}, "labelX": 155.5, "labelY": 179, "anchor": "middle", "baseline": "hanging"}, {"position": 217.75, "label": "3", "tick": {"x1": 217.75, "y1": 170, "x2": 217.75, "y2": 176}, "labelX": 217.75, "labelY": 179, "anchor": "middle", "baseline": "hanging"}, {"position": 280, "label": "4", "tick": {"x1": 280, "y1": 170, "x2": 280, "y2": 176}, "labelX": 280, "labelY": 179, "anchor": "middle", "baseline": "hanging"}]}, "yAxis": {"orient": "left", "position": 31, "line": {"x1": 31, "y1": 170, "x2": 31, "y2": 12}, "ticks": [{"position": 170, "label": "0", "tick": {"x1": 31, "y1": 170, "x2": 25, "y2": 170}, "labelX": 22, "labelY": 170, "anchor": "end", "baseline": "middle"}, {"position": 117.33, "label": "20", "tick": {"x1": 31, "y1": 117.33, "x2": 25, "y2": 117.33}, "labelX": 22, "labelY": 117.33, "anchor": "end", "baseline": "middle"}, {"position": 64.67, "label": "40", "tick": {"x1": 31, "y1": 64.67, "x2": 25, "y2": 64.67}, "labelX": 22, "labelY": 64.67, "anchor": "end", "baseline": "middle"}, {"position": 12, "label": "60", "tick": {"x1": 31, "y1": 12, "x2": 25, "y2": 12}, "labelX": 22, "labelY": 12, "anchor": "end", "baseline": "middle"}]}, "gridLines": [{"x1": 31, "y1": 170, "x2": 280, "y2": 170}, {"x1": 31, "y1": 117.33, "x2": 280, "y2": 117.33}, {"x1": 31, "y1": 64.67, "x2": 280, "y2": 64.67}, {"x1": 31, "y1": 12, "x2": 280, "y2": 12}], "lines": [{"name": "Sales", "color": "#e69f00", "path": "M31,143.67L93.25,91L155.5,117.33L217.75,64.67L280,38.33"}], "legend": []}},
{"name": "two series over dates: monthly ticks, a legend row, and a gap that breaks line A", "args": [{"width": 400, "height": 250, "x": null, "dates": ["2026-01-01", "2026-02-01", "2026-03-01", "2026-04-01"], "series": [{"name": "A", "values": [1, 2, null, 4]}, {"name": "B", "values": [2, 2, 3, 3]}], "curve": "linear", "yZero": false}], "expect": {"width": 400, "height": 250, "plot": {"x": 24, "y": 34, "width": 356, "height": 186}, "xAxis": {"orient": "bottom", "position": 220, "line": {"x1": 24, "y1": 220, "x2": 380, "y2": 220}, "ticks": [{"position": 24, "label": "Jan 2026", "tick": {"x1": 24, "y1": 220, "x2": 24, "y2": 226}, "labelX": 24, "labelY": 229, "anchor": "middle", "baseline": "hanging"}, {"position": 146.62, "label": "Feb 2026", "tick": {"x1": 146.62, "y1": 220, "x2": 146.62, "y2": 226}, "labelX": 146.62, "labelY": 229, "anchor": "middle", "baseline": "hanging"}, {"position": 257.38, "label": "Mar 2026", "tick": {"x1": 257.38, "y1": 220, "x2": 257.38, "y2": 226}, "labelX": 257.38, "labelY": 229, "anchor": "middle", "baseline": "hanging"}, {"position": 380, "label": "Apr 2026", "tick": {"x1": 380, "y1": 220, "x2": 380, "y2": 226}, "labelX": 380, "labelY": 229, "anchor": "middle", "baseline": "hanging"}]}, "yAxis": {"orient": "left", "position": 24, "line": {"x1": 24, "y1": 220, "x2": 24, "y2": 34}, "ticks": [{"position": 220, "label": "1", "tick": {"x1": 24, "y1": 220, "x2": 18, "y2": 220}, "labelX": 15, "labelY": 220, "anchor": "end", "baseline": "middle"}, {"position": 158, "label": "2", "tick": {"x1": 24, "y1": 158, "x2": 18, "y2": 158}, "labelX": 15, "labelY": 158, "anchor": "end", "baseline": "middle"}, {"position": 96, "label": "3", "tick": {"x1": 24, "y1": 96, "x2": 18, "y2": 96}, "labelX": 15, "labelY": 96, "anchor": "end", "baseline": "middle"}, {"position": 34, "label": "4", "tick": {"x1": 24, "y1": 34, "x2": 18, "y2": 34}, "labelX": 15, "labelY": 34, "anchor": "end", "baseline": "middle"}]}, "gridLines": [{"x1": 24, "y1": 220, "x2": 380, "y2": 220}, {"x1": 24, "y1": 158, "x2": 380, "y2": 158}, {"x1": 24, "y1": 96, "x2": 380, "y2": 96}, {"x1": 24, "y1": 34, "x2": 380, "y2": 34}], "lines": [{"name": "A", "color": "#e69f00", "path": "M24,220L146.62,158M380,34Z"}, {"name": "B", "color": "#56b4e9", "path": "M24,158L146.62,158L257.38,96L380,96"}], "legend": [{"label": "A", "row": 0, "x": 8, "y": 8, "width": 21, "textX": 22}, {"label": "B", "row": 0, "x": 45, "y": 8, "width": 21, "textX": 59}]}},
{"name": "a step curve: the step sits midway, and labels get one place for a 0.5 step", "args": [{"width": 200, "height": 150, "x": [0, 1], "dates": null, "series": [{"name": "s", "values": [0, 1]}], "curve": "step", "yZero": false}], "expect": {"width": 200, "height": 150, "plot": {"x": 38, "y": 12, "width": 142, "height": 108}, "xAxis": {"orient": "bottom", "position": 120, "line": {"x1": 38, "y1": 120, "x2": 180, "y2": 120}, "ticks": [{"position": 38, "label": "0.0", "tick": {"x1": 38, "y1": 120, "x2": 38, "y2": 126}, "labelX": 38, "labelY": 129, "anchor": "middle", "baseline": "hanging"}, {"position": 109, "label": "0.5", "tick": {"x1": 109, "y1": 120, "x2": 109, "y2": 126}, "labelX": 109, "labelY": 129, "anchor": "middle", "baseline": "hanging"}, {"position": 180, "label": "1.0", "tick": {"x1": 180, "y1": 120, "x2": 180, "y2": 126}, "labelX": 180, "labelY": 129, "anchor": "middle", "baseline": "hanging"}]}, "yAxis": {"orient": "left", "position": 38, "line": {"x1": 38, "y1": 120, "x2": 38, "y2": 12}, "ticks": [{"position": 120, "label": "0.0", "tick": {"x1": 38, "y1": 120, "x2": 32, "y2": 120}, "labelX": 29, "labelY": 120, "anchor": "end", "baseline": "middle"}, {"position": 66, "label": "0.5", "tick": {"x1": 38, "y1": 66, "x2": 32, "y2": 66}, "labelX": 29, "labelY": 66, "anchor": "end", "baseline": "middle"}, {"position": 12, "label": "1.0", "tick": {"x1": 38, "y1": 12, "x2": 32, "y2": 12}, "labelX": 29, "labelY": 12, "anchor": "end", "baseline": "middle"}]}, "gridLines": [{"x1": 38, "y1": 120, "x2": 180, "y2": 120}, {"x1": 38, "y1": 66, "x2": 180, "y2": 66}, {"x1": 38, "y1": 12, "x2": 180, "y2": 12}], "lines": [{"name": "s", "color": "#e69f00", "path": "M38,120L109,120L109,12L180,12"}], "legend": []}},
{"name": "a monotone curve flattens into a plateau without overshooting it", "args": [{"width": 200, "height": 150, "x": [0, 0.5, 1], "dates": null, "series": [{"name": "s", "values": [0, 1, 1]}], "curve": "monotone", "yZero": false}], "expect": {"width": 200, "height": 150, "plot": {"x": 38, "y": 12, "width": 142, "height": 108}, "xAxis": {"orient": "bottom", "position": 120, "line": {"x1": 38, "y1": 120, "x2": 180, "y2": 120}, "ticks": [{"position": 38, "label": "0.0", "tick": {"x1": 38, "y1": 120, "x2": 38, "y2": 126}, "labelX": 38, "labelY": 129, "anchor": "middle", "baseline": "hanging"}, {"position": 109, "label": "0.5", "tick": {"x1": 109, "y1": 120, "x2": 109, "y2": 126}, "labelX": 109, "labelY": 129, "anchor": "middle", "baseline": "hanging"}, {"position": 180, "label": "1.0", "tick": {"x1": 180, "y1": 120, "x2": 180, "y2": 126}, "labelX": 180, "labelY": 129, "anchor": "middle", "baseline": "hanging"}]}, "yAxis": {"orient": "left", "position": 38, "line": {"x1": 38, "y1": 120, "x2": 38, "y2": 12}, "ticks": [{"position": 120, "label": "0.0", "tick": {"x1": 38, "y1": 120, "x2": 32, "y2": 120}, "labelX": 29, "labelY": 120, "anchor": "end", "baseline": "middle"}, {"position": 66, "label": "0.5", "tick": {"x1": 38, "y1": 66, "x2": 32, "y2": 66}, "labelX": 29, "labelY": 66, "anchor": "end", "baseline": "middle"}, {"position": 12, "label": "1.0", "tick": {"x1": 38, "y1": 12, "x2": 32, "y2": 12}, "labelX": 29, "labelY": 12, "anchor": "end", "baseline": "middle"}]}, "gridLines": [{"x1": 38, "y1": 120, "x2": 180, "y2": 120}, {"x1": 38, "y1": 66, "x2": 180, "y2": 66}, {"x1": 38, "y1": 12, "x2": 180, "y2": 12}], "lines": [{"name": "s", "color": "#e69f00", "path": "M38,120C61.67,66,85.33,12,109,12C132.67,12,156.33,12,180,12"}], "legend": []}},
{"name": "no series is an error", "args": [{"width": 300, "height": 200, "x": [0, 1], "dates": null, "series": [], "curve": "linear", "yZero": false}], "expectError": "a line chart needs at least one series"},
{"name": "x and dates together is an error", "args": [{"width": 300, "height": 200, "x": [0, 1], "dates": ["2026-01-01", "2026-01-02"], "series": [{"name": "a", "values": [1, 2]}], "curve": "linear", "yZero": false}], "expectError": "give exactly one of x and dates"},
{"name": "neither x nor dates is an error", "args": [{"width": 300, "height": 200, "x": null, "dates": null, "series": [{"name": "a", "values": [1, 2]}], "curve": "linear", "yZero": false}], "expectError": "give exactly one of x and dates"},
{"name": "a series of the wrong length is an error", "args": [{"width": 300, "height": 200, "x": [0, 1, 2], "dates": null, "series": [{"name": "A", "values": [1, 2]}], "curve": "linear", "yZero": false}], "expectError": "series \"A\" has 2 values but there are 3 x values"},
{"name": "every value a gap is an error", "args": [{"width": 300, "height": 200, "x": [0, 1], "dates": null, "series": [{"name": "a", "values": [null, null]}], "curve": "linear", "yZero": false}], "expectError": "a line chart needs at least one value to plot"},
{"name": "one x value cannot make an axis", "args": [{"width": 300, "height": 200, "x": [5, 5], "dates": null, "series": [{"name": "a", "values": [1, 2]}], "curve": "linear", "yZero": false}], "expectError": "a line chart needs at least two different x values"},
{"name": "a chart too small for its margins is an error", "args": [{"width": 40, "height": 40, "x": [0, 1], "dates": null, "series": [{"name": "a", "values": [1, 2]}], "curve": "linear", "yZero": false}], "expectError": "margins leave no room to plot"}
]