I am displaying data in a bar-chart with a date-time axis.
The bars (there is a bar for each hour) overlap, the degree of overlapping depending on the zoom.
I want each bar to be shown distinctly, with a space separating neighbouring bars. How do I achieve this?
bar-chart : overlapping bars
Hi Simon,
which code are you using to reproduce this behaviour ? It works fine here setting the bottom axis labels as datetime, to talValue and increment, using similar code to the following :
which code are you using to reproduce this behaviour ? It works fine here setting the bottom axis labels as datetime, to talValue and increment, using similar code to the following :
Code: Select all
With TChart1
.AddSeries scBar
.Series(0).AddXY DateValue("05/12/02") + TimeValue("00:00"), Rnd() * 100, "", clTeeColor
.Axis.Bottom.Labels.Style = talValue
.Series(0).XValues.DateTime = True
.Axis.Bottom.Labels.DateTimeFormat = "hh:mm:ss dd/mm/yy"
.Axis.Bottom.Labels.Angle = 90
.Axis.Bottom.Increment = .GetDateTimeStep(dtOneHour)
End With
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi Josep
I've tried your suggestions, but the overlapping still occurs.
The problem is that the bar width does not change when I zoom in an out. So if I zoom into a date-time range of a few hours, the bars are spaced wide apart. But if I display data for a couple of months, they overlap
I'm using the code below.
if XDate then //if x-axis is a date
TBarSeries(aChartSeries).XValues.ValueSource := XValSource
else
TBarSeries(aChartSeries).XLabelsSource := XValSource;
This overlapping does not occur when the x-axis is not a date: i.e. if I set TBarSeries(aChartSeries).XLabelsSource := XValSource
But then the graph does not interpret the x-axis values as dates and does not position the bars accordingly, but places them at equally spaced intervals.
Here are some of the other settings I'm using.
optimaDBChart.BottomAxis.StartPosition := 3;
optimaDBChart.BottomAxis.EndPosition := 97;
TBarSeries(aChartSeries).AutoBarSize := true;
TBarSeries(aChartSeries).MultiBar := mbSide;
TBarSeries(aChartSeries).Marks.Visible := false;
optimaDBChart.BottomAxis.ExactDateTime := false;
Cheers
Simon
I've tried your suggestions, but the overlapping still occurs.
The problem is that the bar width does not change when I zoom in an out. So if I zoom into a date-time range of a few hours, the bars are spaced wide apart. But if I display data for a couple of months, they overlap
I'm using the code below.
if XDate then //if x-axis is a date
TBarSeries(aChartSeries).XValues.ValueSource := XValSource
else
TBarSeries(aChartSeries).XLabelsSource := XValSource;
This overlapping does not occur when the x-axis is not a date: i.e. if I set TBarSeries(aChartSeries).XLabelsSource := XValSource
But then the graph does not interpret the x-axis values as dates and does not position the bars accordingly, but places them at equally spaced intervals.
Here are some of the other settings I'm using.
optimaDBChart.BottomAxis.StartPosition := 3;
optimaDBChart.BottomAxis.EndPosition := 97;
TBarSeries(aChartSeries).AutoBarSize := true;
TBarSeries(aChartSeries).MultiBar := mbSide;
TBarSeries(aChartSeries).Marks.Visible := false;
optimaDBChart.BottomAxis.ExactDateTime := false;
Cheers
Simon
Hi Simon,
I'm sorry, I'm not able to reproduce the problem here. Could you please be so kind to send me a simple example directly to me (to my account pep@steema.com) so I can see the problem ?
Or, are you able to reproduce it using the any example of the Demo Features project (under Database Examples) ?
I'm sorry, I'm not able to reproduce the problem here. Could you please be so kind to send me a simple example directly to me (to my account pep@steema.com) so I can see the problem ?
Or, are you able to reproduce it using the any example of the Demo Features project (under Database Examples) ?
Pep Jorge
http://support.steema.com
http://support.steema.com