Search code examples
livecharts

Change margin of X Axis


Is it possible to change the white space (margin) between the plotted values and the edge of the chart bounds? I wouldn't mind if the bars went all the way to the edge. Thank you for your help!

Picture for reference showing 5 charts in a wrappanel with so much space between Y-axis and bars as well as between bars and right side of chart:

How to reduce margins


Solution

  • This space is not margin. It's because of teh values of the X-axis. you can set MinValueand MaxValue for it.

    <lvc:CartesianChart.AxisX>
        <lvc:AxesCollection>
            <lvc:Axis Name="xAxis"
                      MinValue = "0">
            </lvc:Axis>
        </lvc:AxesCollection>
    </lvc:CartesianChart.AxisX>
    

    If your values start from, let's say 0, and you set the MinValue to 0, then the bars go to the edge.