Inverting Y-Axis and Repositioning X-Axis on Siemens WinCC Trend

David Krause12 min read
HMI / SCADASiemensTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview

Siemens WinCC Flexible 2008 (and successor TIA Portal WinCC Comfort/Advanced) trend displays plot a process tag's value along the Y-axis versus time along the X-axis. Two display adjustments are commonly required on plant-floor HMIs: relocate the time axis from the bottom to the top of the trend view, and reverse the value axis so that the higher raw value sits at the bottom and the lower raw value sits at the top (for example, an axis that reads 200 at the bottom and 0 at the top for fill-level, vacuum, or cooling-tower gauges). WinCC Flexible does not expose a direct "invert Y-axis" toggle; the inversion must be implemented through linear user-scaling points on the TrendView object. This reference documents the GraphDirection property, the user-scaling math, commissioning checks, alternative workarounds such as bar-chart substitution or a developer-written OCX, plus a migration path to TIA Portal WinCC where several controls are renamed but the conceptual model is preserved.

Prerequisites

  • WinCC Flexible 2008 SP2/SP3 or TIA Portal V13 SP1 onward with WinCC Comfort/Advanced
  • An HMI connection to a SIMATIC S7-300/400/1200/1500 PLC or an approved third-party controller
  • Process tag of type INT, REAL, or WORD already declared in the HMI tag table
  • Trend view placed in the target screen with at least one configured trend bound to the process tag
  • Engineering station with rights to edit Properties of the TrendView object and to recompile the project
  • Runtime panel firmware matched to the WinCC Flexible SP level installed on the engineering station (mismatched firmware prevents OCX property changes from propagating)
Back up the integrated project (.fwd or .hmi) before modifying trend properties. Property changes propagate live to the runtime, but a known-good baseline is required to revert cleanly.

Trend Control Architecture in WinCC Flexible

The trend display in WinCC Flexible 2008 is delivered as an OLE Custom Control (OCX) registered at engineering-install time. The OCX version delivered with WinCC Flexible 2008 SP2 onward is V6.2 SP2; the same OCX ships with SP3 and SP4 with no breaking changes to the property bag. Each trend view embeds one OCX instance that exposes a property tree accessible from the WinCC Flexible Properties window under categories: General, Trends, Time Axis, Value Axis, Display, and User Scaling. TIA Portal WinCC adopts the same conceptual model but renders the trend view through a WPF-based native control with renamed properties on V17 onward (TrendDirection replaces GraphDirection, ScaleX1/Y1/X2/Y2 unchanged).

Property Category Key Properties Runtime Effect
General Name, TrendColor, LineWidth Visual line style and color
Trends Trend Name, Tag Name, Source Type Binds tag to trace
Time Axis Mode, DateFormat, TimeFormat Time-stamp rendering
Value Axis AutoRange, Min, Max, Position Y-axis range and side
Display GraphDirection, Orientation Plot direction and axis placement
User Scaling ScaleX1, ScaleY1, ScaleX2, ScaleY2 Linear remap of raw samples

For details on the OCX property bag, consult the Siemens Industry Online Support entry for WinCC Flexible 2008 SP2 manual (search ID 18796012).

X-Axis (Time Axis) Position Control

GraphDirection Property Semantics

The GraphDirection property of the TrendView OCX determines whether the plot progresses left-to-right or right-to-left, and as a side effect relocates the rendered time axis. Locate the property under Properties > Display > GraphDirection with two valid enumerations:

Value Enumerator Effect on Time Axis and Plot
0 BottomToTop (default) Time axis labeled at bottom of view, plot draws left to right
1 TopToBottom Time axis relocates to top of view, plot draws right to left with most recent sample at the right edge

Setting GraphDirection = 1 alone does not move the current value to the left edge; the OCX still appends new samples by time order at the right edge of the canvas. To combine the X-axis-on-top goal with the current-value-on-left goal, pair GraphDirection = 1 with a script-driven mirror or accept that the new sample is plotted at the right edge while time labels flow right-to-left above the canvas.

Time Axis Label Density

On multi-resolution panels (TP177 to MP377), the X-axis label density is governed by the LabelDistance property expressed in pixels. Reduce the value (for example from 50 to 25) to display tick labels on alternating positions rather than skipping every other gridline. Conversely, raise the value when labels overlap at low screen widths.

In TIA Portal WinCC V17 onward, the property is renamed TrendDirection with identical semantics (0 = left, 1 = right). Update any legacy documentation that references GraphDirection to TrendDirection when migrating.

Y-Axis (Value Axis) Inversion via User Scaling

Why Invert the Value Axis

Operators in tank gauging, vacuum pressure, drainage, and cooling-tower applications expect fill levels or vacuum values to grow downward. A standard Y-axis that reads 0 at the bottom and 100 at the top contradicts the physical intuition; a descending axis (200 at bottom, 0 at top) restores correct mental mapping and reduces the cognitive load during alarm response. WinCC Flexible's value axis does not expose a polarity toggle, so engineers must mathematically invert the value at display time using the trend's user-scaling parameters.

Linear Scaling Math

User scaling applies a two-point linear interpolation to every sample before it lands on the canvas. The OCX computes the display value with the formula:

DisplayValue = ((RawValue - ScaleX1) * (ScaleY2 - ScaleY1) / (ScaleX2 - ScaleX1)) + ScaleY1

The four parameters are configured under Properties > User Scaling of the trend:

Parameter Raw Domain Mapped Range Typical Target (200 to 0 invert)
ScaleX1 Lower raw value — -200
ScaleY1 — Mapped lower display (where the lower raw value lands) 200
ScaleX2 Upper raw value — 200
ScaleY2 — Mapped upper display (where the upper raw value lands) 0

This configuration maps a raw span of -200 to +200 onto a displayed span of 200 to 0, putting the higher raw values at the bottom of the view and lower raw values at the top.

Selecting the Scaling Domain to Avoid the Zero Crossing

The descending-axis requirement is paired with a concern: the process tag itself must never cross zero. By selecting a raw domain of [-200, +200] for a process that physically never reaches 0, the engineer sidesteps the discontinuity where the inverted scale jumps. The Range Selection under Properties > Value Axis is then set to [-200, 0] so that only the meaningful sub-range occupies the visible plot area:

Setting Value Purpose
Range Selection Minimum -200 Truncates empty space above 0
Range Selection Maximum 0 Y-axis upper bound matches physical minimum
AutoRange Disabled Forces fixed range
Decimal Places 0 Suppresses display flicker on integer tags
Disable AutoRange when applying inverted user scaling. AutoRange continuously recalculates Min/Max from raw samples and discards your inverted ScaleY1/ScaleY2 mapping, reverting the axis to ascending order within seconds.

Edge Case: Negative Raw Values

Some process variables (vacuum in millibar, concentration in microgram/L) are natively negative with engineering offsets. The same scaling logic applies: define ScaleX1/Y1 at the lowest expected raw value mapped to the desired top-of-axis display, and ScaleX2/Y2 at the highest expected raw value mapped to the desired bottom-of-axis display. Because the math is symmetric, only the orientation of the mapping flips, not the formula.

Step-by-Step Configuration

  1. Open the WinCC Flexible project and navigate to Screens > [Target Screen]. Select the TrendView object on the screen.
  2. In the Properties pane, expand Display and set GraphDirection = 1 (TopToBottom) to relocate the time axis to the top edge of the view.
  3. Verify the runtime plot direction reads time labels right-to-left above the gridline; recompile and reload to confirm. On older panels, cycle power after download if properties do not refresh.
  4. Expand User Scaling of the same trend and enter the four scaling points exactly as listed below:
    ScaleX1 = -200
    ScaleY1 = 200
    ScaleX2 = 200
    ScaleY2 = 0
  5. Expand Value Axis > Range Selection and enter Minimum = -200, Maximum = 0.
  6. Confirm AutoRange = False so the OCX does not overwrite the inverted range.
  7. Assign the connected process tag under Trends > [Trend Name] > Tag Name. The tag value itself is not scaled at the PLC side; the OCX applies scaling only for visual display, and the same tag remains available to other HMI elements in its raw form.
  8. Configure the Common settings: TrendColor, LineWidth, and TrendName under the Trend properties.
  9. Compile the project (Project > Compiler > Check Consistency, then Compiler > Generate). Resolve any error codes returned.
  10. Download the runtime to the panel. On TP/MP panels, the runtime restart is automatic; on PC Runtime, restart the WinCC Flexible Runtime service.
  11. Apply a process stimulus (for example, force the tag to -100 via the PLC tag table) and verify the trace lands at the expected position on the screen.

Verification Checklist

Check Expected Result Method
X-axis on top of view Timestamp labels appear above the gridline Visual inspection
Y-axis descending 200 at bottom, 0 at top Visual inspection
PLC tag value unchanged at HMI HMI tag monitor shows raw value, not scaled HMI tag table online test
No negative displayed values Trace stays at or below 200, no underflow glitches Apply process stimulus, observe trace
AutoRange disabled Range does not auto-resize on tag excursion Force an out-of-range value
Tag reconnection on PLC fault Trace continues after PLC reconnect Cycle PLC, observe trace
If the HMI tag monitor shows a scaled value rather than the raw PLC value, the scaling has been mistakenly applied at the HMI tag level or within a script. User scaling on the TrendView only ever affects display, not the underlying tag.

Runtime vs. Archive-Backed Trends

WinCC Flexible supports two source types per trend: online (continuous samples pumped directly from the connected PLC into the trend buffer) and archive-backed (samples fetched from the WinCC archive database with a defined archive tag). The user-scaling math applies to the source sample at the canvas; it does not modify the archive. When the trend switches from online to archive-backed, the OCX continues to apply scaling because the scaling block sits between the sample buffer and the canvas. Engineers importing legacy archive trends into an inverted Y-axis screen must therefore re-bind scaling on the new TrendView rather than relying on archive tag transformation.

Multi-Value-Axis Considerations

A trend view with two traces (for example, pressure and temperature on the same canvas) can assign a dedicated value axis to each trace. When one trace must display in descending order, configure each trace's User Scaling separately. The Value Axis Position property controls whether the axis renders on the left or right side of the view; assigning one axis on each side prevents label collision when both axes are visible. Limits must be set per axis when AutoRange is enabled, because AutoRange acts on the combined sample set of all traces bound to that axis.

Alternative Approaches

Bar Chart Substitute

Where full inversion of the time axis or value axis is unattainable with the trend OCX (especially on legacy panels predating the OCX V6.2 SP2 build), an I/O Field array or a Bar Graph OCX rendered in descending orientation provides a workable substitute. A bar chart with one bar per hour (24 bars for a 24-hour log) can substitute for an inverted trend when the OCX cannot deliver the desired orientation. Each bar's fill direction is configured with BarGraphDirection = BottomToTop or TopToBottom on the Bar OCX, and the value-to-pixel mapping is set via the analog limits. Tags with known sampling cadence (one per hour, one per shift) are the best fits.

Custom OCX Development

The OCX V6.2 SP2 source confirms a hardware-side constraint: GraphDirection does not toggle Y-axis polarity. The only escape valve is a third-party OCX or a developer-written WPF trend hosted in TIA Portal WinCC V17 onward. The custom OCX reads the same PLC tag via the HMI connection, applies the inverse, and paints both axes natively. Effort is non-trivial: budget a sprint for OCX registration, signing, and HMI certification. Siemens-approved third-party OCX libraries from registered Solution Partners are also worth evaluating before writing custom code; consult Siemens Industry Online Support for the partner directory.

WinCC Scripted Reverse Plot

For TIA Portal WinCC Professional V17 onward, the trend view API exposes TrendView.InvertValueAxis = True on supported firmware builds. Confirm support on the customer's runtime via Panel Diagnostics > Runtime Version, and look for firmware V17.0.0.3 or later. When supported, this single property toggle replaces the four user-scaling points and is preserved across project migrations.

Migration to TIA Portal WinCC

Projects migrated from WinCC Flexible 2008 SP2/SP3 to TIA Portal WinCC Comfort/Advanced carry the TrendView OCX configuration forward automatically, including user-scaling points. After migration, validate the following:

  • GraphDirection is renamed to TrendDirection on V17 onward runtime; verify the value persists across the migration.
  • User-scaling points (ScaleX1/Y1/X2/Y2) retain their numeric values.
  • AutoRange migration may reset to True; explicitly set it False post-migration when using inverted scaling.
  • Time axis label density may need re-tuning because the WPF renderer scales differently from the OCX renderer.
  • Tag scaling at the tag level (Tag Properties > Scaling) must remain empty; only trend-level scaling should drive inversion.

For projects migrating to TIA Portal V18 with multi-user engineering, lock the TrendView configuration in the library to prevent unintended edits after migration.

Commissioning Notes

When handing a screen with inverted trends to operations, document the operator-facing details in the plant SOP: tag name, native engineering units, displayed units, axis orientation, and range. Operators reading a descending axis must not interpret 0 at the top as a fault condition; rather, 0 represents the maximum expected value or full-scale fill. Print the trend template on the panel's startup screen so the convention is consistent across shifts. Provide an operator training module that walks through a sample excursion (PLC tag forced to -150) and shows the expected response on the inverted axis. Verify the trend under realistic process transients before taking the panel live; an inverted axis with AutoRange inadvertently enabled will silently revert to ascending order within minutes and confuse the operator.

FAQ

Can the WinCC Flexible TrendView OCX invert the Y-axis directly without user scaling?

No. The OCX V6.2 SP2 exposed properties do not include a Y-axis polarity flag. Inversion must be implemented by linear user scaling on the trend, configured as ScaleX1 = -200, ScaleY1 = 200, ScaleX2 = 200, ScaleY2 = 0 for a 200 to 0 visual.

Does user scaling on a trend modify the PLC tag value?

No. User scaling on the TrendView OCX is a display-only transformation. The connected HMI tag value remains identical at the PLC and in any other HMI element bound to the same tag. To verify, monitor the tag via the HMI tag table online test.

How do I move the time axis from bottom to top of the trend view?

Set the TrendView GraphDirection property to 1 (TopToBottom). Recompile and reload the runtime; on older panels cycle power after download. In TIA Portal WinCC V17 onward set TrendDirection = 1 for the same effect.

What happens to the trace if AutoRange is enabled while using inverted user scaling?

AutoRange will continuously recalculate the Y-axis limits from the raw samples, overriding the inverted ScaleY1/ScaleY2 mapping and reverting the axis to ascending order. Always disable AutoRange when configuring inverted scaling.

Which panel firmware is required for the SP2 OCX behavior described here?

WinCC Flexible 2008 SP2 or later is required. Earlier OCX builds lack the propertie interfaces discussed here. Confirm the patch level under Project > WinCC Flexible Version or on the runtime panel under Panel Diagnostics.

Back to blog