Margins when calling fit view

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

Posts: 49
Joined: Thu May 16, 2013 8:24 pm

Margins when calling fit view

Post by symbolick » Fri Aug 30, 2013 8:38 pm

There are many times in my code that I need to call ViewXY.FitView() however this will place some data right on the edge of the chart. We are in a situation where they need to be able to select portions of the data which becomes very hard when that data might be right on the edge of the chart. Is there a solution to have it leave some space on the side when fitview is being applied?


User avatar
Posts: 1365
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: Margins when calling fit view

Post by ArctionPasi » Sun Sep 01, 2013 4:41 pm

Y axes have Fit methods, where you can set margin in axis values or in pixels. For X axis there's no such, nor for ViewXY.FitView.

To implement custom fit logic, you may want to get the minimum and maximum of X and Y from the series data. Then add some margin in those. Finally call xAxis.SetRange and yAxis.SetRange with these values.
LightningChart Support Team, PT