Scaling the X-axis

In this sample the X-axis can be scaled by entries so that a different value range is used. The values of the IndexScaling class, which is located in the AcquisitionInterpreter as a SubMember, are thereby edited. The value range can be shifted with the offset. The offset represents the starting value of the value range. The value range can be scaled differently with the scale factor. The value is multiplied by the value range.

private void tbXScale_TextChanged(object sender, EventArgs e)
{
    foreach(Chart chart in scopeProjectPanel.ScopeProject.SubMember.OfType<Chart>())
    {
        foreach(AxisGroup ag in chart.SubMember.OfType<AxisGroup>())
        {
            foreach(Channel channel in ag.SubMember.OfType<Channel>())
            {
                foreach(AcquisitionInterpreter ai in channel.SubMember.OfType<AcquisitionInterpreter>().Where(x => x.Orientation == TwinCAT.Measurement.Scope.API.AxisOrientation.Y))
                {
                    IndexScaling indexScaling = ai.SubMember.OfType<IndexScaling>().First();
                    double factor = 0;
                    double.TryParse(tbXScale.Text, out factor);
                    indexScaling.ScaleFactor = factor;
                }
            }
        }
    }
}

private void tbXOffset_TextChanged(object sender, EventArgs e)
{
    foreach (Chart chart in scopeProjectPanel.ScopeProject.SubMember.OfType<Chart>())
    {
        foreach (AxisGroup ag in chart.SubMember.OfType<AxisGroup>())
        {
            foreach (Channel channel in ag.SubMember.OfType<Channel>())
            {
                foreach (AcquisitionInterpreter ai in channel.SubMember.OfType<AcquisitionInterpreter>().Where(x => x.Orientation == TwinCAT.Measurement.Scope.API.AxisOrientation.Y))
                {
                    IndexScaling indexScaling = ai.SubMember.OfType<IndexScaling>().First();
                    double offset = 0;
                    double.TryParse(tbXOffset.Text, out offset);
                    indexScaling.Offset = offset;
                }
            }
        }
    }
}