Page 1 of 1
Area Graph Question
Posted: Wed Mar 07, 2007 9:42 pm
by 9337953
When I'm graphing a single point, the area graph only shows a single dashed verticle line up the the value of the point.
Is there any way to change the display of the graph so it draws the single point from the bottom-left of the chart window to the point to the bottom-right of the chart window? This would then show a single point essentially as a pyramid. As it is, viewing a single data point sometimes confuses the customer because it looks like nothing was graphed.
Thanks
Posted: Thu Mar 08, 2007 9:53 am
by yeray
Hello mh,
To plot an area series you should have, at least, two points to define a valid area to be plotted. Anyway, if you wish to achieve what you request you could use something like the AddValue method and OnGetPointerStyle event (to show the points you need) as in the example we implemented below.
Code: Select all
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TeEngine, Series, ExtCtrls, TeeProcs, Chart, StdCtrls, TeeComma;
type
TForm1 = class(TForm)
Chart1: TChart;
Series1: TAreaSeries;
Button1: TButton;
TeeCommander1: TTeeCommander;
procedure FormCreate(Sender: TObject);
function Series1GetPointerStyle(Sender: TChartSeries;
ValueIndex: Integer): TSeriesPointerStyle;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
OnePoint: boolean;
procedure AddValue(y: double);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.AddValue(y: double);
begin
if Series1.Count = 0 then
begin
OnePoint:=true;
Series1.Add(y-1);
Series1.Add(y);
Series1.Add(y-1);
end
else
begin
if OnePoint then
begin
Series1.Delete(0);
Series1.Delete(Series1.Count-1);
Series1.XValues.FillSequence;
OnePoint:=false;
end;
Series1.Add(y);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.Clear;
Series1.Pointer.Visible:=true;
OnePoint:=false;
AddValue(random);
end;
function TForm1.Series1GetPointerStyle(Sender: TChartSeries;
ValueIndex: Integer): TSeriesPointerStyle;
begin
if OnePoint then
begin
if (ValueIndex = 1) then
result := psRectangle
else
result := psNothing;
end
else
result := psRectangle;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
AddValue(random);
end;
end.
Posted: Thu Mar 08, 2007 3:57 pm
by 9337953
Thanks for the tip. However we are utilizing the graph inside of a Report Builder report, so we don't have programmatic access to it. I guess we'll have to adjust the data or select another report style.
Thanks again
Posted: Thu Mar 08, 2007 4:06 pm
by narcis
Hi mh,
If you don't have access to all those events and properties in Report Builder you could use an invisible TChart, export it to an image and then load the image into Report Builder. For more information on how to export TeeChart to images please read Tutorial 12 - Exporting and Importing Charts. You'll find the tutorials at TeeChart's program group.