Forum Discussion
Line chart fit to width only when X-axis values are numerical?
Hi all,
I'm making several line charts that all need to fit on a single page, so limited real estate. My x-axis values are a numerical sequence, but there are breaks in the sequence. (e.g., 1001, 1002, 1003, 1006, 1007, 1010, etc.) When I create the chart, it squeezes everything into a single view (no scroll bar) which is what I want, but those breaks in the sequence make for non-iniform spacing of the data points. There's also an annoying bit of white space on the left, but I accepted defeat on that battle a while ago.
If I convert the x-axis sequence numbers to text, the spacing on the x-axis becomes uniform (yay!) and the left side white space magically disappears (bonus!), but now the chart won't fit-to-width and it gives me a scroll bar (deal breaker!). Is there any way to get the best of both worlds?
Thanks in advance!
1 Reply
- ppm1
Solution Sage
One option would be to use the Deneb visual (free & certified). Here is an example where I reproduced your issue. The Deneb one is on the bottom and the "spec" for it is provided below.
Declarative Visualization in Power BI | Deneb (deneb-viz.github.io)
{ "data": {"name": "dataset"}, "layer": [ { "mark": { "type": "line", "tooltip": true } } ], "encoding": { "x": { "field": "X", "type": "nominal" }, "y": { "field": "Y", "type": "quantitative" } } }Pat