Setting y-axis range using Interactive data display WPF

212 views Asked by At

I'm stuck on a problem where i need to set y-axis based on its plot. Right now program stretches the plot to fit whole chart however i need it to let some free space above the plot. I wasn't able to come up with anything so far. Code looks like this:

Chart chart = new Chart()
{
    LegendVisibility = Visibility.Hidden,
    LeftTitle = YaxisName[i],
    BottomTitle = "Carrier i [-]",                      
};
chart.Content = getChart(graphIndex, GraphYvalues, GraphXvalues, GraphListOfNames[graphIndex]);
chartView.Children.Add(chart);

Could someone please help me out? Thank you

1

There are 1 answers

0
David Hala On BEST ANSWER

Eventually I was able to scramble something up. It's actually so damn easy. I gave up on setting the range of y-axis and instead of that I added padding to the plot itself like this:

LineGraph lineGraphFar = new LineGraph()
{
    Stroke = new SolidColorBrush(Colors.Red),
    Padding = new System.Windows.Thickness(0, 30, 0, 0)
};

It's surely not the greatest option but it will do the job.