hist_scale_buffer

Cascade Historian: Version 4.1
Prev |  | Next

# `hist_scale_buffer`

`hist_scale_buffer` -- performs offset and scaling operations.

## Syntax

    hist_scale_buffer (buffer, xscale, xoffset, yscale, yoffset)

## Parameters

`buffer`

  A binary buffer of `X`-`Y` pairs of doubles, created by a call to `hist_buffer_id_read`.

`xscale, xoffset`

  The `X` value of the data pairs is transformed as follows:

          x' = x * xscale + xoffset

`yscale, yoffset`

  The `Y` value of the data pairs is transformed as follows:

          y' = y * yscale + yoffset

## Returns

`t` (true) if the transformation was performed with no errors, otherwise `nil`.

## Description

This function performs an offset and scaling transformation on a binary buffer of `X`-`Y` data pairs. The buffer is modified in place (i.e., a new buffer is not created, and the old values cannot be recovered). This function can be used to adjust data for graphing.

This function corresponds to the Cogent API function `HI_ScaleBuffer`.

## Example

        // To shift the Y data by 100 units:
        hist_scale_buffer (data, 1, 0, 1, 100);

Prev | Home | Next
`hist_register` | Up | `hist_stat_buffer`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.