コード例 #1
0
        protected override Size ArrangeContentOverride(Rect arrangeRect)
        {
            double legendWidth = Math.Min(arrangeRect.Width,
                                          Math.Max(Math.Max(legendScrollerYUpper.DesiredSize.Width, legendScrollerYLower.DesiredSize.Width), TotalZoom100Button !.DesiredSize.Width));
            double remainingWidth = arrangeRect.Width - legendWidth;
            double legendHeight   = Math.Min(arrangeRect.Height,
                                             Math.Max(legendScrollerX.DesiredSize.Height, TotalZoom100Button.DesiredSize.Height + TotalZoomOutButton !.DesiredSize.Height));
            double remainingHeight = arrangeRect.Height - legendHeight;
            double plotArea0Height = remainingHeight * plotAreaRatio;
            double plotArea1Height = remainingHeight * (1 - plotAreaRatio);

            legendScrollerYUpper.ArrangeBorderPadding(arrangeRect, remainingWidth, 0, legendWidth, plotArea0Height);
            legendScrollerYLower.ArrangeBorderPadding(arrangeRect, remainingWidth, plotArea0Height, legendWidth, plotArea1Height);
            legendScrollerX.ArrangeBorderPadding(arrangeRect, 0, remainingHeight, remainingWidth, legendHeight);
            //arrange plot-area after scrollers, which might change the values plot-area has to display
            plotAreaUpper.ArrangeBorderPadding(arrangeRect, 0, 0, remainingWidth, plotArea0Height);
            plotAreaLower.ArrangeBorderPadding(arrangeRect, 0, plotArea0Height, remainingWidth, plotArea1Height);
            TotalZoom100Button.ArrangeBorderPadding(arrangeRect, remainingWidth, remainingHeight, legendWidth, TotalZoom100Button.DesiredSize.Height);

            double zoomInOutY = remainingHeight + TotalZoom100Button.DesiredSize.Height;

            TotalZoomOutButton.ArrangeBorderPadding(arrangeRect, remainingWidth, zoomInOutY,
                                                    TotalZoomOutButton.DesiredSize.Width, TotalZoomOutButton.DesiredSize.Height);
            TotalZoomInButton !.ArrangeBorderPadding(arrangeRect, arrangeRect.Width - TotalZoomInButton !.DesiredSize.Width, zoomInOutY, TotalZoomInButton.DesiredSize.Width, TotalZoomInButton.DesiredSize.Height);
            return(arrangeRect.Size);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        protected override Size ArrangeContentOverride(Rect arrangeRect)
        {
            double legendWidth =
                Math.Min(arrangeRect.Width,
                         Math.Max(
                             Math.Max(
                                 Math.Max(
                                     Math.Max(legendScrollerY0.DesiredSize.Width, legendScrollerY1.DesiredSize.Width),
                                     legendScrollerY2.DesiredSize.Width),
                                 legendScrollerY3.DesiredSize.Width),
                             TotalZoom100Button !.DesiredSize.Width));
            double remainingWidth = arrangeRect.Width - legendWidth;
            double legendHeight   = Math.Min(arrangeRect.Height,
                                             Math.Max(legendScrollerX.DesiredSize.Height, TotalZoom100Button.DesiredSize.Height + TotalZoomOutButton !.DesiredSize.Height));
            double remainingHeight = arrangeRect.Height - legendHeight;
            double plotArea0Height = remainingHeight * heightRatio0;
            double plotArea1Height = remainingHeight * heightRatio1;
            double plotArea2Height = remainingHeight * heightRatio2;
            double plotArea3Height = remainingHeight * heightRatio3;
            var    y = 0.0;

            legendScrollerY0.ArrangeBorderPadding(arrangeRect, remainingWidth, y, legendWidth, plotArea0Height);
            y += plotArea0Height;
            legendScrollerY1.ArrangeBorderPadding(arrangeRect, remainingWidth, y, legendWidth, plotArea1Height);
            y += plotArea1Height;
            legendScrollerY2.ArrangeBorderPadding(arrangeRect, remainingWidth, y, legendWidth, plotArea2Height);
            y += plotArea2Height;
            legendScrollerY3.ArrangeBorderPadding(arrangeRect, remainingWidth, y, legendWidth, plotArea3Height);
            legendScrollerX.ArrangeBorderPadding(arrangeRect, 0, remainingHeight, remainingWidth, legendHeight);

            //arrange plot-area after scrollers, which might change the values plot-area has to display
            y = 0.0;
            plotArea0.ArrangeBorderPadding(arrangeRect, 0, y, remainingWidth, plotArea0Height);
            y += plotArea0Height;
            plotArea1.ArrangeBorderPadding(arrangeRect, 0, y, remainingWidth, plotArea1Height);
            y += plotArea1Height;
            plotArea2.ArrangeBorderPadding(arrangeRect, 0, y, remainingWidth, plotArea2Height);
            y += plotArea2Height;
            plotArea3.ArrangeBorderPadding(arrangeRect, 0, y, remainingWidth, plotArea3Height);
            TotalZoom100Button.ArrangeBorderPadding(arrangeRect, remainingWidth, remainingHeight, legendWidth, TotalZoom100Button.DesiredSize.Height);

            double zoomInOutY = remainingHeight + TotalZoom100Button.DesiredSize.Height;

            TotalZoomOutButton.ArrangeBorderPadding(arrangeRect, remainingWidth, zoomInOutY,
                                                    TotalZoomOutButton.DesiredSize.Width, TotalZoomOutButton.DesiredSize.Height);
            TotalZoomInButton !.ArrangeBorderPadding(arrangeRect, arrangeRect.Width - TotalZoomInButton !.DesiredSize.Width, zoomInOutY, TotalZoomInButton.DesiredSize.Width, TotalZoomInButton.DesiredSize.Height);
            return(arrangeRect.Size);
        }