Using Delphi 7 Pro and Teechart 7.07:

Values are added to a histogram by these lines (simplified here):

Code: Select all

```
function TGraph.HistogramSeries(DataVector, LabelVector; ColorFunc: TSeriesColorFunction): THistogramSeries;
var
i: integer;
begin
result := THistogramSeries.create(nil);
// Values are added like this:
for i := 1 to DataVector.Length do
result.Add(DataVector[i],LabelVector.AsString[i]),Color[i]);
end;
```

The function correctly adds the value points, but the problem is that the axis in this form is not drawn nicely with regular intervals. The histogram demands as the labelvector a string, such that if we try to define a proper tick mark separation by calling a function with the desired tick mark distance (increment), then

.... call function with "Value", e.g. 5:

Code: Select all

```
// Force calculation of min and max!
Axis.AdjustMaxMin;
min := Axis.Minimum;
max := Axis.Maximum;
Axis.Automatic := false;
Axis.SetMinMax(Axis.Minimum, Axis.Maximum); //
Axis.SetMinMax(Min, Max); // Axis.SetMinMax(min, max);
Axis.Increment := Value;
```

What happens then is that the bottom axis goes from 0 to number of bins, and with tick marks at 0 5 10 15 etc., whereas the data were e.g. 17, 19,22, 24 etc.

In short:

How can I draw a histogram where the bottom axis is considered numerical and not categorical. Keeping it numerical is essential for drawing the correct distance btw. points in the histogram.

Regards

JL/EpiData