# Difference between revisions of "TAChart documentation"

(New page: {{TAChart documentation}} == Overview == TAChart is a package for drawing graphs, charts and other diagrams. It is comparable in features, but not specifically compatible, with Delphi Te...) |
|||

Line 3: | Line 3: | ||

== Overview == | == Overview == | ||

− | TAChart is a package for drawing graphs, charts and other diagrams. | + | [[TAChart]] is a package for drawing graphs, charts and other diagrams. |

It is comparable in features, but not specifically compatible, with Delphi TeeChart package. | It is comparable in features, but not specifically compatible, with Delphi TeeChart package. | ||

One substantial difference is that some features (e.g. data sources and axis transformations) | One substantial difference is that some features (e.g. data sources and axis transformations) | ||

Line 16: | Line 16: | ||

* ''Graph coordinates'' (aka world coordinates) are converted from the axis coordinates using axis transformation, such as logarithmic scale. Graph coordinates are common for all objects in the chart. | * ''Graph coordinates'' (aka world coordinates) are converted from the axis coordinates using axis transformation, such as logarithmic scale. Graph coordinates are common for all objects in the chart. | ||

* ''Image coordinates'' (aka screen coordinates) are converted from graph coordinates based on the chart viewport. This transformation is always linear and can be influenced by chart tools such as zooming and panning. | * ''Image coordinates'' (aka screen coordinates) are converted from graph coordinates based on the chart viewport. This transformation is always linear and can be influenced by chart tools such as zooming and panning. | ||

+ | |||

+ | You can add or remove arbitrary number of axises by editing <code>AxisList</code> property. | ||

+ | By default, chart have two axises: one horizontal and one vertical. | ||

+ | They are accessible via <code>BottomAxis</code> and <code>LeftAxis</code> properties. | ||

+ | Note that those properties are aliases to <code>AxisList[0]</code> and <code>AxisList[1]</code>, | ||

+ | so if you remove those default axises, accessing <code>BottomAxis</code> and <code>LeftAxis</code> will return nil. | ||

+ | |||

+ | === Axis transformations === | ||

+ | |||

+ | Axis transformations are grouped in <code>TChartAxisTransformations</code> component. | ||

+ | It contains a list of transformations which are applied in the order given. | ||

+ | For transformations to have an effect, you should: | ||

+ | * Make sure <code>Enabled</code> property is true for all transformations. | ||

+ | * Assign transformations component to <code>Transformations</code> property of at least one axis. | ||

+ | * Assign <code>AxisIndexX</code> and/or <code>AxisIndexY</code> properties of the series to the appropriate axis index. | ||

+ | Note that by default, <code>AxisIndexX</code> and <code>AxisIndexY</code> have a special value of -1, | ||

+ | which means "ignore axis transformations". Also note that if you add or remove axises, the indexes may change. | ||

+ | You can rotate the series by assigning ''both'' <code>AxisIndexX</code> to vertical axis and <code>AxisIndexY</code> | ||

+ | to the horizontal axis. | ||

+ | |||

+ | ==== Auto-scaling transformation ==== | ||

+ | |||

+ | To display several independently scaled series, assign them to two or more axises | ||

+ | and apply <code>TAutoScaleAxisTransform</code> to each axis. | ||

+ | See "axistransf" demo, page "Linear", checkbox "Auto scale". | ||

+ | |||

+ | By using <code>MinValue</code> and <code>MaxValue</code> properties you can control the in graph coordinates | ||

+ | of the auto-scaled series. For example, by setting one transformation to a range from 0 to 1, and another | ||

+ | to a range from 1 to 2, you will confine all the series using the first transformation to the upper half of the chart, | ||

+ | and all the series using the second transformation to the lower half (assuming there are no unassigned series left). |

## Revision as of 05:42, 29 July 2011

│
**English (en)** │
**русский (ru)** │
**українська (uk)** │
**中文（中国大陆） (zh_CN)** │

## Contents

## Overview

TAChart is a package for drawing graphs, charts and other diagrams. It is comparable in features, but not specifically compatible, with Delphi TeeChart package. One substantial difference is that some features (e.g. data sources and axis transformations) are implemented via separate components instead of just properties. This leads to increased flexibility and opportunity for code re-use, but at the cost of some additional API complexity.

## Coordinates and axises

TAChart uses three coordinate systems:

*Axis coordinates*(known in some other applications as object coordinates) -- this is the "raw" coordinate values obtained from the data. As the name implies, axis coordinates are interpreted in therms of specific axis -- the same coordinate value may have different meaning depending on the axis it is applied to.*Graph coordinates*(aka world coordinates) are converted from the axis coordinates using axis transformation, such as logarithmic scale. Graph coordinates are common for all objects in the chart.*Image coordinates*(aka screen coordinates) are converted from graph coordinates based on the chart viewport. This transformation is always linear and can be influenced by chart tools such as zooming and panning.

You can add or remove arbitrary number of axises by editing `AxisList`

property.
By default, chart have two axises: one horizontal and one vertical.
They are accessible via `BottomAxis`

and `LeftAxis`

properties.
Note that those properties are aliases to `AxisList[0]`

and `AxisList[1]`

,
so if you remove those default axises, accessing `BottomAxis`

and `LeftAxis`

will return nil.

### Axis transformations

Axis transformations are grouped in `TChartAxisTransformations`

component.
It contains a list of transformations which are applied in the order given.
For transformations to have an effect, you should:

- Make sure
`Enabled`

property is true for all transformations. - Assign transformations component to
`Transformations`

property of at least one axis. - Assign
`AxisIndexX`

and/or`AxisIndexY`

properties of the series to the appropriate axis index.

Note that by default, `AxisIndexX`

and `AxisIndexY`

have a special value of -1,
which means "ignore axis transformations". Also note that if you add or remove axises, the indexes may change.
You can rotate the series by assigning *both* `AxisIndexX`

to vertical axis and `AxisIndexY`

to the horizontal axis.

#### Auto-scaling transformation

To display several independently scaled series, assign them to two or more axises
and apply `TAutoScaleAxisTransform`

to each axis.
See "axistransf" demo, page "Linear", checkbox "Auto scale".

By using `MinValue`

and `MaxValue`

properties you can control the in graph coordinates
of the auto-scaled series. For example, by setting one transformation to a range from 0 to 1, and another
to a range from 1 to 2, you will confine all the series using the first transformation to the upper half of the chart,
and all the series using the second transformation to the lower half (assuming there are no unassigned series left).