protected override Size MeasureContentOverride(Size constraint)
        {
            if (plotAreaUpper.RendererCount == 0)
            {
#if DEBUG
                if (plotAreaLower.RendererCount != 0)
                {
                    throw new Exception("plotArea1 is supposed to be in sync with plotArea0");
                }
#endif
                //empty graphic. Add at least the grid lines
                addGridLineRenderers();
            }

            TotalZoom100Button !.Measure(new Size(constraint.Width, constraint.Height));
            double totalZoom100ButtonWidth  = TotalZoom100Button.DesiredSize.Width;
            double totalZoom100ButtonHeight = TotalZoom100Button.DesiredSize.Height;
            legendScrollerX.Legend.MinHeight = totalZoom100ButtonHeight;

            legendScrollerX.Measure(constraint);
            double zoomButtonDimension = TotalZoomOutButton !.Width = TotalZoomOutButton.Height = TotalZoomInButton !.Height = TotalZoomInButton.Width =
                legendScrollerX.ScrollBarHeight;

            double legendHeight    = Math.Min(constraint.Height, Math.Max(legendScrollerX.DesiredSize.Height, totalZoom100ButtonHeight + zoomButtonDimension));
            double plotArea0Height = (constraint.Height - legendHeight) * plotAreaRatio;
            double plotArea1Height = (constraint.Height - legendHeight) * (1 - plotAreaRatio);
            legendScrollerYUpper.Measure(new Size(constraint.Width, plotArea0Height));
            legendScrollerYLower.Measure(new Size(constraint.Width, plotArea1Height));
            double legendScrollerYMaxWidth = Math.Max(legendScrollerYUpper.DesiredSize.Width, legendScrollerYLower.DesiredSize.Width);

            double legendWidth   = Math.Min(constraint.Width, Math.Max(legendScrollerYMaxWidth, totalZoom100ButtonWidth));
            double plotAreaWidth = constraint.Width - legendWidth;
            plotAreaUpper.Measure(new Size(plotAreaWidth, plotArea0Height));
            plotAreaLower.Measure(new Size(plotAreaWidth, plotArea1Height));

            TotalZoomInButton.Measure(new Size(TotalZoomInButton.Width, TotalZoomInButton.Height));
            TotalZoomOutButton.Measure(new Size(TotalZoomOutButton.Width, TotalZoomOutButton.Height));

            //always remeasure xLegend because in the beginning it is given the whole width of Chart2Plots1X2YLegends
            legendScrollerX.Measure(new Size(plotAreaWidth, legendHeight));


            Size returnedSize = constraint;
            if (double.IsInfinity(constraint.Height))
            {
                returnedSize.Height = legendScrollerX.DesiredSize.Height + legendScrollerYUpper.DesiredSize.Height + legendScrollerYLower.DesiredSize.Height;
            }
            if (double.IsInfinity(constraint.Width))
            {
                returnedSize.Width = legendScrollerX.DesiredSize.Width + legendScrollerYMaxWidth;
            }
            return(returnedSize);
        }
        protected override Size MeasureContentOverride(Size constraint)
        {
            if (plotArea.RendererCount == 0)
            {
                //empty graphic. Add at least the grid lines
                addGridLineRenderers();
            }

            TotalZoom100Button !.Measure(new Size(constraint.Width, constraint.Height));
            double totalZoom100ButtonWidth  = TotalZoom100Button.DesiredSize.Width;
            double totalZoom100ButtonHeight = TotalZoom100Button.DesiredSize.Height;

            legendScrollerX.Legend.MinHeight = totalZoom100ButtonHeight;

            legendScrollerX.Measure(constraint);
            double zoomButtonDimension = TotalZoomOutButton !.Width = TotalZoomOutButton.Height = TotalZoomInButton !.Height = TotalZoomInButton.Width =
                legendScrollerX.ScrollBarHeight;

            double legendHeight   = Math.Min(constraint.Height, Math.Max(legendScrollerX.DesiredSize.Height, totalZoom100ButtonHeight + zoomButtonDimension));
            double plotAreaHeight = (constraint.Height - legendHeight) * plotAreaRatio;

            legendScrollerY.Measure(new Size(constraint.Width, plotAreaHeight));
            double legendScrollerYWidth = legendScrollerY.DesiredSize.Width;

            double legendWidth   = Math.Min(constraint.Width, Math.Max(legendScrollerYWidth, totalZoom100ButtonWidth));
            double plotAreaWidth = constraint.Width - legendWidth;

            plotArea.Measure(new Size(plotAreaWidth, plotAreaHeight));

            TotalZoomInButton.Measure(new Size(TotalZoomInButton.Width, TotalZoomInButton.Height));
            TotalZoomOutButton.Measure(new Size(TotalZoomOutButton.Width, TotalZoomOutButton.Height));

            //always remeasure xLegend because in the beginning it is given the whole width of the chart
            legendScrollerX.Measure(new Size(plotAreaWidth, legendHeight));


            Size returnedSize = constraint;

            if (double.IsInfinity(constraint.Height))
            {
                returnedSize.Height = legendScrollerX.DesiredSize.Height + legendScrollerY.DesiredSize.Height;
            }
            if (double.IsInfinity(constraint.Width))
            {
                returnedSize.Width = legendScrollerX.DesiredSize.Width + legendScrollerYWidth;
            }
            return(returnedSize);
        }