public AreaGraphData(SrmDocument document,
                      DocNode docNode,
                      DisplayTypeChrom displayType,
                      GraphValues.ReplicateGroupOp replicateGroupOp,
                      int ratioIndex,
                      AreaNormalizeToData normalize,
                      AreaExpectedValue expectedVisible,
                      PaneKey paneKey)
     : base(document, docNode, displayType, replicateGroupOp, paneKey)
 {
     _docNode         = docNode;
     _ratioIndex      = ratioIndex;
     _normalize       = normalize;
     _expectedVisible = expectedVisible;
 }
 public AreaGraphData(SrmDocument document,
     DocNode docNode,
     DisplayTypeChrom displayType,
     GraphValues.ReplicateGroupOp replicateGroupOp,
     int ratioIndex,
     AreaNormalizeToData normalize,
     AreaExpectedValue expectedVisible,
     PaneKey paneKey)
     : base(document, docNode, displayType, replicateGroupOp, paneKey)
 {
     _docNode = docNode;
     _ratioIndex = ratioIndex;
     _normalize = normalize;
     _expectedVisible = expectedVisible;
 }
        private void UpdateAxes(bool resetAxes, GraphValues.AggregateOp aggregateOp, AreaNormalizeToData normalizeData,
                                AreaNormalizeToView areaView, IsotopeLabelType standardType)
        {
            if (resetAxes)
            {
                XAxis.Scale.MaxAuto = XAxis.Scale.MinAuto = true;
                YAxis.Scale.MaxAuto = true;
            }
            if (BarSettings.Type == BarType.PercentStack)
            {
                YAxis.Scale.Max     = 100;
                YAxis.Scale.MaxAuto = false;
                YAxis.Title.Text    = aggregateOp.AnnotateTitle(Resources.AreaReplicateGraphPane_UpdateGraph_Peak_Area_Percentage);
                YAxis.Type          = AxisType.Linear;
                YAxis.Scale.MinAuto = false;
                FixedYMin           = YAxis.Scale.Min = 0;
            }
            else
            {
                if (normalizeData == AreaNormalizeToData.optimization)
                {
                    // If currently log scale or normalized to max, reset the y-axis max
                    if (YAxis.Type == AxisType.Log || YAxis.Scale.Max == 1)
                    {
                        YAxis.Scale.MaxAuto = true;
                    }

                    YAxis.Title.Text    = aggregateOp.AnnotateTitle(Resources.AreaReplicateGraphPane_UpdateGraph_Percent_of_Regression_Peak_Area);
                    YAxis.Type          = AxisType.Linear;
                    YAxis.Scale.MinAuto = false;
                    FixedYMin           = YAxis.Scale.Min = 0;
                }
                else if (areaView == AreaNormalizeToView.area_maximum_view)
                {
                    YAxis.Scale.Max = 1;
                    if (IsDotProductVisible)
                    {
                        // Make YAxis Scale Max a little higher to accommodate for the dot products
                        YAxis.Scale.Max = 1.1;
                    }
                    YAxis.Scale.MaxAuto = false;
                    YAxis.Title.Text    = aggregateOp.AnnotateTitle(Resources.AreaReplicateGraphPane_UpdateGraph_Peak_Area_Normalized);
                    YAxis.Type          = AxisType.Linear;
                    YAxis.Scale.MinAuto = false;
                    FixedYMin           = YAxis.Scale.Min = 0;
                }
                else if (Settings.Default.AreaLogScale)
                {
                    // If currently not log scale, reset the y-axis max
                    if (YAxis.Type != AxisType.Log)
                    {
                        YAxis.Scale.MaxAuto = true;
                    }
                    if (Settings.Default.PeakAreaMaxArea != 0)
                    {
                        YAxis.Scale.MaxAuto = false;
                        YAxis.Scale.Max     = Settings.Default.PeakAreaMaxArea;
                    }

                    YAxis.Type       = AxisType.Log;
                    YAxis.Title.Text = GraphValues.AnnotateLogAxisTitle(aggregateOp.AnnotateTitle(
                                                                            Resources.AreaReplicateGraphPane_UpdateGraph_Peak_Area));
                    YAxis.Scale.MinAuto = false;
                    FixedYMin           = YAxis.Scale.Min = 1;
                }
                else
                {
                    // If currently log scale, reset the y-axis max
                    if (YAxis.Type == AxisType.Log)
                    {
                        YAxis.Scale.MaxAuto = true;
                    }
                    if (Settings.Default.PeakAreaMaxArea != 0)
                    {
                        YAxis.Scale.MaxAuto = false;
                        YAxis.Scale.Max     = Settings.Default.PeakAreaMaxArea;
                    }
                    else if (!YAxis.Scale.MaxAuto)
                    {
                        YAxis.Scale.MaxAuto = true;
                    }
                    string yTitle = Resources.AreaReplicateGraphPane_UpdateGraph_Peak_Area;
                    switch (areaView)
                    {
                    case AreaNormalizeToView.area_ratio_view:
                        yTitle = string.Format(Resources.AreaReplicateGraphPane_UpdateGraph_Peak_Area_Ratio_To__0_,
                                               standardType.Title);
                        break;

                    case AreaNormalizeToView.area_global_standard_view:
                        yTitle = Resources.AreaReplicateGraphPane_UpdateGraph_Peak_Area_Ratio_To_Global_Standards;
                        break;
                    }
                    YAxis.Title.Text    = aggregateOp.AnnotateTitle(yTitle);
                    YAxis.Type          = AxisType.Linear;
                    YAxis.Scale.MinAuto = false;
                    FixedYMin           = YAxis.Scale.Min = 0;
                }
                // Handle a switch from percent stack
                if (!YAxis.Scale.MaxAuto && YAxis.Scale.Max == 100)
                {
                    YAxis.Scale.MaxAuto = true;
                }
            }
            Legend.IsVisible = Settings.Default.ShowPeakAreaLegend;
            AxisChange();

            // Reformat Y-Axis for labels and whiskers
            var maxY = GraphHelper.GetMaxY(CurveList, this);

            if (IsDotProductVisible)
            {
                var extraSpace = _lableHeight * (maxY / (Chart.Rect.Height - _lableHeight * 2)) * 2;
                maxY += extraSpace;
            }

            GraphHelper.ReformatYAxis(this, maxY > 0 ? maxY : 0.1); // Avoid same min and max, since it blanks the entire graph pane
        }
        private void UpdateAxes(bool resetAxes, GraphValues.AggregateOp aggregateOp, AreaNormalizeToData normalizeData,
            AreaNormalizeToView areaView, IsotopeLabelType standardType)
        {
            if (resetAxes)
            {
                XAxis.Scale.MaxAuto = XAxis.Scale.MinAuto = true;
                YAxis.Scale.MaxAuto = true;
            }
            if (BarSettings.Type == BarType.PercentStack)
            {
                YAxis.Scale.Max = 100;
                YAxis.Scale.MaxAuto = false;
                YAxis.Title.Text = aggregateOp.AnnotateTitle(Resources.AreaReplicateGraphPane_UpdateGraph_Peak_Area_Percentage);
                YAxis.Type = AxisType.Linear;
                YAxis.Scale.MinAuto = false;
                FixedYMin = YAxis.Scale.Min = 0;
            }
            else
            {
                if (normalizeData == AreaNormalizeToData.optimization)
                {
                    // If currently log scale or normalized to max, reset the y-axis max
                    if (YAxis.Type == AxisType.Log || YAxis.Scale.Max == 1)
                        YAxis.Scale.MaxAuto = true;

                    YAxis.Title.Text = aggregateOp.AnnotateTitle(Resources.AreaReplicateGraphPane_UpdateGraph_Percent_of_Regression_Peak_Area);
                    YAxis.Type = AxisType.Linear;
                    YAxis.Scale.MinAuto = false;
                    FixedYMin = YAxis.Scale.Min = 0;
                }
                else if (areaView == AreaNormalizeToView.area_maximum_view)
                {
                    YAxis.Scale.Max = 1;
                    if (IsDotProductVisible)
                        // Make YAxis Scale Max a little higher to accommodate for the dot products
                        YAxis.Scale.Max = 1.1;
                    YAxis.Scale.MaxAuto = false;
                    YAxis.Title.Text = aggregateOp.AnnotateTitle(Resources.AreaReplicateGraphPane_UpdateGraph_Peak_Area_Normalized);
                    YAxis.Type = AxisType.Linear;
                    YAxis.Scale.MinAuto = false;
                    FixedYMin = YAxis.Scale.Min = 0;
                }
                else if (Settings.Default.AreaLogScale)
                {
                    // If currently not log scale, reset the y-axis max
                    if (YAxis.Type != AxisType.Log)
                        YAxis.Scale.MaxAuto = true;
                    if (Settings.Default.PeakAreaMaxArea != 0)
                    {
                        YAxis.Scale.MaxAuto = false;
                        YAxis.Scale.Max = Settings.Default.PeakAreaMaxArea;
                    }

                    YAxis.Type = AxisType.Log;
                    YAxis.Title.Text = GraphValues.AnnotateLogAxisTitle(aggregateOp.AnnotateTitle(
                        Resources.AreaReplicateGraphPane_UpdateGraph_Peak_Area));
                    YAxis.Scale.MinAuto = false;
                    FixedYMin = YAxis.Scale.Min = 1;
                }
                else
                {
                    // If currently log scale, reset the y-axis max
                    if (YAxis.Type == AxisType.Log)
                        YAxis.Scale.MaxAuto = true;
                    if (Settings.Default.PeakAreaMaxArea != 0)
                    {
                        YAxis.Scale.MaxAuto = false;
                        YAxis.Scale.Max = Settings.Default.PeakAreaMaxArea;
                    }
                    else if (!YAxis.Scale.MaxAuto)
                    {
                        YAxis.Scale.MaxAuto = true;
                    }
                    string yTitle = Resources.AreaReplicateGraphPane_UpdateGraph_Peak_Area;
                    switch (areaView)
                    {
                        case AreaNormalizeToView.area_ratio_view:
                            yTitle = string.Format(Resources.AreaReplicateGraphPane_UpdateGraph_Peak_Area_Ratio_To__0_,
                                                   standardType.Title);
                            break;
                        case AreaNormalizeToView.area_global_standard_view:
                            yTitle = Resources.AreaReplicateGraphPane_UpdateGraph_Peak_Area_Ratio_To_Global_Standards;
                            break;
                    }
                    YAxis.Title.Text = aggregateOp.AnnotateTitle(yTitle);
                    YAxis.Type = AxisType.Linear;
                    YAxis.Scale.MinAuto = false;
                    FixedYMin = YAxis.Scale.Min = 0;
                }
                // Handle a switch from percent stack
                if (!YAxis.Scale.MaxAuto && YAxis.Scale.Max == 100)
                    YAxis.Scale.MaxAuto = true;
            }
            Legend.IsVisible = Settings.Default.ShowPeakAreaLegend;
            AxisChange();

            // Reformat Y-Axis for labels and whiskers
            var maxY = GraphHelper.GetMaxY(CurveList,this);
            if (IsDotProductVisible)
            {
                var extraSpace = _lableHeight*(maxY/(Chart.Rect.Height - _lableHeight*2))*2;
                maxY += extraSpace;
            }

            GraphHelper.ReformatYAxis(this, maxY);
        }