FeatureVectorCalculatore bug fix : case when complete curve is below zero and fromZero == true
This commit is contained in:
parent
5854a6e620
commit
cfaf8e6a59
@ -55,12 +55,42 @@ namespace FeatureVectorCalculator
|
||||
// cl.ToPosition = Math.Log10(xs[j] / spacer);
|
||||
// chArea.AxisX.CustomLabels.Add(cl);
|
||||
// }
|
||||
|
||||
chArea.AxisY.Title = captionY;
|
||||
chArea.AxisY.IsLogarithmic = false;
|
||||
chArea.AxisY.IsLabelAutoFit = true;
|
||||
chArea.AxisY.IsStartedFromZero = fromZero;
|
||||
chArea.AxisY.Minimum = chArea.AxisY.IsStartedFromZero ? 0 : minY;
|
||||
chArea.AxisY.Maximum = 1.1 * maxY;
|
||||
|
||||
if (!fromZero)
|
||||
{
|
||||
/// fromZero = false
|
||||
chArea.AxisY.IsStartedFromZero = false;
|
||||
float diff = maxY - minY;
|
||||
chArea.AxisY.Minimum = minY - 0.05 * diff;
|
||||
chArea.AxisY.Maximum = maxY + 0.05 * diff;
|
||||
}
|
||||
else if (minY >= 0)
|
||||
{
|
||||
/// fromZero = true, All points are above zero
|
||||
chArea.AxisY.IsStartedFromZero = true;
|
||||
chArea.AxisY.Minimum = 0;
|
||||
chArea.AxisY.Maximum = 1.05 * maxY;
|
||||
}
|
||||
else if (maxY <= 0)
|
||||
{
|
||||
/// fromZero = true, All points are below zero
|
||||
chArea.AxisY.IsStartedFromZero = true;
|
||||
chArea.AxisY.Minimum = 1.05 * minY;
|
||||
chArea.AxisY.Maximum = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Points are both below and above zero
|
||||
chArea.AxisY.IsStartedFromZero = false;
|
||||
float diff = maxY - minY;
|
||||
chArea.AxisY.Minimum = minY - 0.05 * diff;
|
||||
chArea.AxisY.Maximum = maxY + 0.05 * diff;
|
||||
}
|
||||
|
||||
if (chArea.AxisY.Maximum == chArea.AxisY.Minimum)
|
||||
{
|
||||
chArea.AxisY.Maximum = chArea.AxisY.Maximum + 1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user