Hello,
I am using TeeeChart v8.06 Pro and Delphi 2010. I'm about to start a new chart project, and I have a few questions about TSeriesPointer. They are:
1. Can the size of the pointer symbol be set per datapoint, or does the size of a TSeriesPointer apply to the whole series?
2. Can custom symbols be used instead of the TSeriesPointerStyle symbols provided?
3. Should the size, pointer style and color be set when adding data points to the series or is there a better way to set those properties?
Thanks!!
-erzsebet
TSeriesPointer Questions
Re: TSeriesPointer Questions
Hi erzsebet,
Then, you could modify the method TSeriesPointer.DrawPointer, also in TeEngine.pas and add cour custom drawing there:
B. If you are not a source customer, you could set the pointer style to psNothing and draw your pointers directly at
Furthermore, note that the color is stored in an array of colors, ValueColor. You can change a point color through it at any moment (and also at OnGetPointerStyle).
It applies to the whole series, but you can use OnGetPointerStyle to modify this the pointer properties before each them are drawn. For example:erzsebet wrote:1. Can the size of the pointer symbol be set per datapoint, or does the size of a TSeriesPointer apply to the whole series?
Code: Select all
uses series;
var point1: TPointSeries;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
point1:=Chart1.AddSeries(TPointSeries) as TPointSeries;
point1.FillSampleValues();
point1.OnGetPointerStyle:=Series1GetPointerStyle;
end;
function TForm1.Series1GetPointerStyle(Sender: TChartSeries; ValueIndex: Integer): TSeriesPointerStyle;
begin
with Sender as TPointSeries do
begin
Pointer.Size:=(ValueIndex mod 5) + 3;
Result:=psRectangle;
end;
end;
A. If you are a source code customer, you can add a TSeriesPointerStyle in TeEngine.pas, for example a psCustom:erzsebet wrote:2. Can custom symbols be used instead of the TSeriesPointerStyle symbols provided?
Code: Select all
TSeriesPointerStyle=( psRectangle,psCircle,psTriangle,psDownTriangle,
psCross,psDiagCross,psStar,psDiamond,psSmallDot,
psNothing,psLeftTriangle,psRightTriangle,
psHexagon,psVisual, psCustom );
Code: Select all
Procedure TSeriesPointer.DrawPointer( ACanvas:TCanvas3D; Is3D:Boolean; px,py,tmpHoriz,tmpVert:Integer; ColorValue:TColor; AStyle:TSeriesPointerStyle);
//...
case AStyle of
//...
psCustom: Line(px-5,py,px+5,py);
Code: Select all
uses series, TeCanvas;
var point1: TPointSeries;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
point1:=Chart1.AddSeries(TPointSeries) as TPointSeries;
point1.FillSampleValues();
point1.Pointer.Style:=psNothing;
point1.OnGetPointerStyle:=Series1GetPointerStyle;
end;
function TForm1.Series1GetPointerStyle(Sender: TChartSeries; ValueIndex: Integer): TSeriesPointerStyle;
var px, py: Integer;
tmpRect: TRect;
begin
with Chart1.Axes do
tmpRect:=Rect(Left.PosAxis, Left.IStartPos, Bottom.IEndPos, Bottom.PosAxis);
with Sender as TPointSeries do
begin
px:=CalcXPos(ValueIndex);
py:=CalcYPos(ValueIndex);
end;
if PointInRect(tmpRect, px, py) then
Chart1.Canvas.Line(px-5, py, px+5, py);
end;
The same as 1. The pointer properties are properties from the whole series, but you can change them at OnGetPointerStyle.erzsebet wrote:3. Should the size, pointer style and color be set when adding data points to the series or is there a better way to set those properties?
Furthermore, note that the color is stored in an array of colors, ValueColor. You can change a point color through it at any moment (and also at OnGetPointerStyle).
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: TSeriesPointer Questions
Yeray, hi!
Thank you very much for answering my questions. I am a source code customer, so thanks for including the source code change options, too! Have a great day!
-erzsebet
Thank you very much for answering my questions. I am a source code customer, so thanks for including the source code change options, too! Have a great day!
-erzsebet
Re: TSeriesPointer Questions
Hi erzsebet,
You're welcome! And have a nice one you too!
You're welcome! And have a nice one you too!
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |