Plot Preset Example |
Below, an example implementation of a RelaxISPlugin_PlotPreset is shown.
The function of the plugin is chosen for illustrative purposes.
Reference to the RelaxIS_SDK.dll
.NET Framework 4.7.2 target (class library)
Recommended: Development environment with compiler e.g. RelaxIS SDK Code Editor, Microsoft Visual Studio
This examples illustrates the implementation of a PlotPreset plugin.
The plugin reimplements the Bode-Plot as an example.
// <copyright file="MyPlotPreset.cs" company="rhd instruments GmbH and Co. KG"> // Copyright (c) rhd instruments GmbH and Co. KG. All rights reserved. // Licensed under the MIT No Attribution (MIT-0) license. See section 'License' in the 'SDK Examples / Tutorials' topic for full license information. // </copyright> namespace RelaxIS_SDK_Examples.Plugins { using RelaxIS_SDK.Plugins; /*** * PlotPreset plugins define a combination of X, Y1 and Y2 axis values that make up a default plot preset in * RelaxIS spectrum plots. * One complication here is that the plugin can define different axis values depending on whether the used * transfer function "typically" produces negative imaginary parts. For example the Impedance produces negative * imaginary parts for typical spectra, while the Admittance produces mostly positive imaginary parts. * This is used in order to keep the plot mostly in the same quadrant of the plot. */ /// <summary> /// Defines an example <see cref="RelaxISPlugin_PlotPreset"/> class. /// </summary> public class MyPlotPreset : RelaxISPlugin_PlotPreset { /*** * First, implement the default plugin properties Name and Description that describe the plugin. * This is mainly used for display purposes. */ /// <inheritdoc/> public override string Name { get { return "MyPlotPreset"; } } /// <inheritdoc/> public override string Description { get { return "Redefines the Bode Plot."; } } /*** * Define the first set of axis values for X, Y1 and Y2. These apply when the transfer function usually * gives negative imaginary parts. * These will also be used as a fallback if XValueNameNonNegative (etc.) are not overriden. * The properties return internal names of RelaxISPlugin_AxisValue names. Refer to the RelaxIS Settings -> Plugins * dialog to find the internal names of the available values. */ /// <inheritdoc/> public override string XValueName { get { return "Frequency"; } } /// <inheritdoc/> public override string Y1ValueName { get { return "Real part"; } } /// <inheritdoc/> public override string Y2ValueName { get { return "Negative imaginary part"; } } /*** * Define the axis value names that are used in cases where the transfer function typically returns * positive imaginary parts. * If these three properties are not overriden they default to returning the same name as the XValueName (etc.) * properties. * * This would be used if the imaginary parts are usually not negative, e.g. for Admittance. * Useful for e.g. a Nyquist Plot, to keep it displayed in the same quadrant. */ /// <inheritdoc/> public override string XValueNameNonNegative { get { return this.XValueName; } } /// <inheritdoc/> public override string Y1ValueNameNonNegative { get { return this.Y1ValueName; } } /// <inheritdoc/> public override string Y2ValueNameNonNegative { get { return "Imaginary Part"; } } /*** * Define if the axes are usually plotted with logarithmic scaling. */ /// <inheritdoc/> public override bool IsXAxisLogarithmic { get { return true; } } /// <inheritdoc/> public override bool IsY1AxisLogarithmic { get { return true; } } /// <inheritdoc/> public override bool IsY2AxisLogarithmic { get { return true; } } /*** * Define if the plot is scaled symmetrically in the X and Y1 axes. */ /// <inheritdoc/> public override bool IsPlotScaledSymmetrical { get { return false; } } } }