Esempio n. 1
0
        void axis_BoundsChanged(DoubleAxisBase axis)
        {
            // HACK: Das hier kann wegfallen, wenn das Event abgehängt ist
            if (!_doubleAxes.OfType<DoubleAxisBase>().Contains(axis))
                return;

            if (!_handleEvents)
                return;
            if (IsRelative)
                ScaleRelative(axis, ProxyAxis);
            else
                ProxyAxis.SetBounds(axis.ActualLowerBound, axis.ActualUpperBound);
        }
Esempio n. 2
0
 private void SyncScale(DoubleAxisBase destination)
 {
     if (IsRelative)
         ScaleRelative(ProxyAxis, destination);
     else
         destination.SetBounds(ProxyAxis.ActualLowerBound, ProxyAxis.ActualUpperBound);
 }
Esempio n. 3
0
        private static void ScaleRelative(DoubleAxisBase source, DoubleAxisBase destination)
        {
            var normFactor = source.UpperBound - source.LowerBound;
            var ls0 = source.LowerBound / normFactor;
            var us0 = source.UpperBound / normFactor;
            var ls1 = source.ActualLowerBound / normFactor;
            var us1 = source.ActualUpperBound / normFactor;

            // Das hier sind jetzt relative Differenzen, da wir oben normiert haben
            var dls = ls1 - ls0; // Bedeutet: "x % von der Länge des Ursprungs-Vektors
            var dus = us1 - us0;

            // Destination:
            var destinationLength = destination.UpperBound - destination.LowerBound;
            var newLower = destination.LowerBound + dls * destinationLength;
            var newUpper = destination.UpperBound + dus * destinationLength;
            destination.SetBounds(newLower, newUpper);
        }