/// <summary>
        /// rule coordinates (x:[0..1], y:axis)
        /// </summary>
        /// <param name="icrc">The context.</param>
        void IRequireTransforms.Transforms(IChartRenderContext icrc)
        {
            if (ValueAxis == null)
            {
                return;
            }
            var matx = MatrixSupport.TransformFor(icrc.SeriesArea, ValueAxis);

            _trace.Verbose($"transforms sy:{matx.M22:F3} matx:{matx} sa:{icrc.SeriesArea}");
            if (ClipToDataRegion)
            {
                Path.Clip = new RectangleGeometry()
                {
                    Rect = icrc.SeriesArea
                };
            }
            var vx     = ValueAxis.For(Value);
            var offset = matx.Transform(new Point(0, vx));

            Rule.SetValue(Canvas.TopProperty, offset.Y);
            matx.OffsetY   = 0;
            Rule.Transform = new MatrixTransform()
            {
                Matrix = matx
            };
        }
Example #2
0
        /// <summary>
        /// Adjust transforms for the various components.
        /// Geometry: scaled to actual values in cartesian coordinates as indicated by axes.
        /// </summary>
        /// <param name="icrc"></param>
        void IRequireTransforms.Transforms(IChartRenderContext icrc)
        {
            if (CategoryAxis == null || ValueAxis == null)
            {
                return;
            }
            var matx = MatrixSupport.TransformFor(icrc.Area, CategoryAxis, ValueAxis);

            _trace.Verbose($"{Name} mat:{matx} clip:{icrc.SeriesArea}");
            Geometry.Transform = new MatrixTransform()
            {
                Matrix = matx
            };
            if (ClipToDataRegion)
            {
                Segments.Clip = new RectangleGeometry()
                {
                    Rect = icrc.SeriesArea
                };
            }
        }
        /// <summary>
        /// rule coordinates (x:[0..1], y:axis)
        /// </summary>
        /// <param name="icrc">The context.</param>
        void IRequireTransforms.Transforms(IChartRenderContext icrc)
        {
            if (ValueAxis == null)
            {
                return;
            }
            var matx = MatrixSupport.TransformFor(icrc.SeriesArea, ValueAxis);

            _trace.Verbose($"transforms sy:{matx.M22:F3} matx:{matx} sa:{icrc.SeriesArea}");
            if (ClipToDataRegion)
            {
                Value1Path.Clip = new RectangleGeometry()
                {
                    Rect = icrc.SeriesArea
                };
                Value2Path.Clip = new RectangleGeometry()
                {
                    Rect = icrc.SeriesArea
                };
                BandPath.Clip = new RectangleGeometry()
                {
                    Rect = icrc.SeriesArea
                };
            }
#if true
            var vmin    = ValueAxis.For(Value2);
            var vmax    = ValueAxis.For(Value1);
            var mmin    = DoMinMax ? Math.Min(vmin, vmax) : vmin;
            var mmax    = DoMinMax ? Math.Max(vmin, vmax) : vmax;
            var offset1 = matx.Transform(new Point(0, vmin));
            Value1Path.SetValue(Canvas.TopProperty, offset1.Y);
            var offset2 = matx.Transform(new Point(0, vmax));
            Value2Path.SetValue(Canvas.TopProperty, offset2.Y);
            var matx2 = matx;
            matx2.OffsetY        = 0;
            Value1Rule.Transform = new MatrixTransform()
            {
                Matrix = matx2
            };
            Value2Rule.Transform = new MatrixTransform()
            {
                Matrix = matx2
            };
            BandPath.SetValue(Canvas.TopProperty, offset1.Y);
            Band.Transform = new MatrixTransform()
            {
                Matrix = matx2
            };
#else
            Value1Rule.Transform = new MatrixTransform()
            {
                Matrix = matx
            };
            Value2Rule.Transform = new MatrixTransform()
            {
                Matrix = matx
            };
            Band.Transform = new MatrixTransform()
            {
                Matrix = matx
            };
#endif
        }