/// <summary>
 /// Transforms for single component.
 /// </summary>
 /// <param name="ls">Layout state.</param>
 /// <param name="rrea">Refresh request.</param>
 protected void ComponentTransforms(LayoutState ls, RefreshRequestEventArgs rrea)
 {
     if (rrea.Component is IRequireTransforms irt)
     {
         var rect = ls.Layout.For(rrea.Component);
         _trace.Verbose($"component-transforms {rrea.Component} {rrea.Axis} {rect}");
         var ctx = new DefaultRenderContext(Surface, Components, ls.LayoutDimensions, rect, ls.Layout.RemainingRect, DataContext)
         {
             Type = RenderType.TransformsOnly
         };
         irt.Transforms(ctx);
     }
 }
        /// <summary>
        /// Provide a render context for given component.
        /// Created contexts are cached until <see cref="InitializeLayoutContext"/> is called.
        /// <para/>
        /// Sets the <see cref="DefaultRenderContext.Type"/> to the current value of <see cref="Type"/>.
        /// </summary>
        /// <param name="cc">Component to provide context for.</param>
        /// <param name="surf">For ctor.</param>
        /// <param name="ccs">For ctor.</param>
        /// <param name="dc">For ctor.</param>
        /// <returns>New or cached instance.</returns>
        public DefaultRenderContext RenderFor(ChartComponent cc, Canvas surf, ObservableCollection <ChartComponent> ccs, object dc)
        {
            if (rendercache.ContainsKey(cc))
            {
                var rc = rendercache[cc];
                rc.Type = Type;
                return(rc);
            }
            var rect = Layout.For(cc);
            var drc  = new DefaultRenderContext(surf, ccs, LayoutDimensions, rect, Layout.RemainingRect, dc);

            rendercache.Add(cc, drc);
            drc.Type = Type;
            return(drc);
        }
 /// <summary>
 /// Render for single component.
 /// </summary>
 /// <param name="ls">Layout state.</param>
 /// <param name="rrea">Refresh request.</param>
 protected void ComponentRender(LayoutState ls, RefreshRequestEventArgs rrea)
 {
     if (rrea.Component is IRequireRender irr)
     {
         var rect = ls.Layout.For(rrea.Component);
         _trace.Verbose($"component-render {rrea.Component} {rrea.Axis} {rect}");
         if (rrea.Axis != AxisUpdateState.None)
         {
             // put axis limits into correct state for IRequireRender components
             Phase_ResetAxes();
             //Phase_AxisLimits((cc2) => cc2 is DataSeries && (cc2 is IProvideValueExtents));
             Phase_AxisLimits(ValueExtents_DataSeries.Items);
         }
         var ctx = new DefaultRenderContext(Surface, Components, ls.LayoutDimensions, rect, ls.Layout.RemainingRect, DataContext)
         {
             Type = RenderType.Component
         };
         irr.Render(ctx);
         if (rrea.Axis != AxisUpdateState.None)
         {
             // axes MUST be re-evaluated because this thing changed.
             //Phase_AxisLimits((cc2) => !(cc2 is DataSeries) && (cc2 is IProvideValueExtents));
             Phase_AxisLimits(ValueExtents_NotDataSeries.Items);
             Phase_AxesFinalized(ls);
             Phase_RenderPostAxesFinalized(ls);
             Phase_RenderAxes(ls);
             Phase_Transforms(ls);
         }
         else
         {
             if (rrea.Component is IRequireTransforms irt)
             {
                 irt.Transforms(ctx);
             }
         }
     }
 }