Problem with MinValue and MaxValue in YAxis

Feb 3, 2014 at 10:22 AM
Hello,

The current behaviour of my chart is that the min and max of the YAxis are the min and max of the ObservableCollection.

But this means that the minimum and maximum values are not displayed, because there is the axis line.
I'd like to have a little gap between the minimum and maximum value, and the minimum and maximum values of the YAxis should not be fixed, but instead bound to some property.

But when I use it, the bound properties work well but the graph is not displayed at all. So my YAxis is good but no data is displayed.
Is there a workaround there, or should I be using something else to dynamically change minimum and maximum values ?
Mar 23, 2014 at 2:43 AM
Hi,
Did you find a problem? I just started another discussion which seems to be relative to yours. In my case the problem is definitely in binding to MinValue and MaxValue (https://sparrowtoolkit.codeplex.com/discussions/539769). I'm about to start debugging on the chart source but before I start wasting my time I'd like know if it's actually necessary and might be somebody already did it and found the root-cause.

Thank you,
Alex
Mar 23, 2014 at 9:59 AM

Hello,

My problem is still there, since I lack the skills to investigate further I’ve been using the default behaviour, but I’d love to see it fixed !

Regards,

Benoît

De : kucheravy [email removed]
Envoyé : dimanche 23 mars 2014 02:43
À : [email removed]
Objet : Re: Problem with MinValue and MaxValue in YAxis [sparrowtoolkit:528713]

From: kucheravy

Hi,
Did you find a problem? I just started another discussion which seems to be relative to yours. In my case the problem is definitely in binding to MinValue and MaxValue (https://sparrowtoolkit.codeplex.com/discussions/539769). I'm about to start debugging on the chart source but before I start wasting my time I'd like know if it's actually necessary and might be somebody already did it and found the root-cause.

Thank you,
Alex

Jul 11, 2014 at 10:36 PM
Edited Jul 11, 2014 at 10:42 PM
Hello!
I have found a possible somewhat clumsy workaround (better late then never):
<chart:SparrowChart.XAxis>
   <chart:LinearXAxis Name="AxaX"/>
</chart:SparrowChart.XAxis>
<chart:SparrowChart.YAxis>
    <chart:LinearYAxis Name="AxaY"/>
</chart:SparrowChart.YAxis>
Normally, we would have bounded MinValue and Maxvalue where inearYAxis is. However doing that does not work. However putting this in the 'Loaded' event will create a 5% margin in on the chart.

public double MaxValX { get; set; }
public double MinValX { get; set; }

public double MaxValY { get; set; }
public double MinValY { get; set; }

/////////////////////////////////////

MaxValY = (int) (SomeCollection.Max(x => x.Y));
MinValY = (int) (SomeCollection.Min(x => x.Y));

MaxValX = (int)(SomeCollection.Max(x => x.X));
MinValX = (int)(SomeCollection.Min(x => x.X));

AxaY.MaxValue = MaxValY + ((MaxValY - MinValY) * 0.05);
AxaY.MinValue = MinValY - ((MaxValY - MinValY) * 0.05);

AxaX.MaxValue = MaxValX + ((MaxValX - MinValX) * 0.05);
AxaX.MinValue = MinValX - ((MaxValX - MinValX) * 0.05);

CabinTemp.InvalidateMeasure();  // CabinTemp is 'Name' of the SparrowChart
CabinTemp.UpdateLayout();
Hope this helps!