Hello,
I added a Cursortool (vertical line) for a chart that contains multiple TLineSeries. All series are based on the same XValues (timescale). User can position the Cursortool at a certain X-axis value (which may be between to seriespoints)
I want to read the YValues of all Series at the X-value where the Cursortool is. In case the cursortool is at an X-Value where no Seriespoint exists, then I want to read an interpolated Yvalue.
Is this possible? Until now, I managed to read the XValue of the cursortool position, but I found no way to read the YValues of all series at that point.
Ideas and suggestions are highly appreciated (solutions are, too:-).
Regards, Ronald
CursorTool and YValues
Re: CursorTool and YValues
Hi Ronald,
If I understood well this is exactly what's done in the example at "All features\Welcome !\Chart styles\Standard\Line (Strip)\Interpolating Line series" in the features demo.
If I understood well this is exactly what's done in the example at "All features\Welcome !\Chart styles\Standard\Line (Strip)\Interpolating Line series" in the features demo.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: CursorTool and YValues
Thanks, that is what I meant!
This raises the next question: I want to draw markers on all series at the given xvalue, regardless if this is a seriespoint or not. Is this possible? If not, would it be possible to mark the XValue with a vertical line overthe whole chart and some kind of label/marker/arrow/text or other means of indication? (like cursortool vertical line does, but cursortool does not have markers)
Thanks, Ronald
This raises the next question: I want to draw markers on all series at the given xvalue, regardless if this is a seriespoint or not. Is this possible? If not, would it be possible to mark the XValue with a vertical line overthe whole chart and some kind of label/marker/arrow/text or other means of indication? (like cursortool vertical line does, but cursortool does not have markers)
Thanks, Ronald
Re: CursorTool and YValues
Hi Ronald,
Find the example attached:
It's already done in the mentioned demo, isn't it? Concretely at the OnAfterDraw event, the line:rvc wrote:I want to draw markers on all series at the given xvalue, regardless if this is a seriespoint or not. Is this possible?
Code: Select all
Chart1.Canvas.Ellipse(xs-4,ys-4,xs+4,ys+4);
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: CursorTool and YValues
Hi Yeray,
I was looking for a way to draw lines/marks on Series. Drawing on the canvas leaves me with manualle handling zoom/scroll redrawing etc. the Series.Marks suit my needs, with the only problem being no points for some series at some xvalues.
Regards, Ronald
I was looking for a way to draw lines/marks on Series. Drawing on the canvas leaves me with manualle handling zoom/scroll redrawing etc. the Series.Marks suit my needs, with the only problem being no points for some series at some xvalues.
Regards, Ronald
Re: CursorTool and YValues
Hi Ronald,
Note the drawing is being done at OnAfterDraw event so the calculations made in it are already considering the *new* chart setting when you zoom/scroll. I can actually zoom/scroll and the interpolation is still drawn correctly in the example attached above.
Well, there is actually one little issue. After zooming, if one segment line is out of the ChartRect, so it's not drawn, the interpolation pointer is still drawn. But this can be avoided adding a simple condition to the drawing process:
On the other hand, if you also want a mark next to the interpolated points, I'd use Annotation tools or simply drawing the text directly to the canvas, because we already have all the information we need in the OnAfterDraw event.
I've modified the project above to use annotations. I had to force some repaints at OnCursorChange, OnZoom and OnUndoZoom to move the annotations.
Note the drawing is being done at OnAfterDraw event so the calculations made in it are already considering the *new* chart setting when you zoom/scroll. I can actually zoom/scroll and the interpolation is still drawn correctly in the example attached above.
Well, there is actually one little issue. After zooming, if one segment line is out of the ChartRect, so it's not drawn, the interpolation pointer is still drawn. But this can be avoided adding a simple condition to the drawing process:
Code: Select all
for i:=0 to Chart1.SeriesCount - 1 do
begin
ys := Chart1[i].GetVertAxis.CalcYPosValue(InterpolateLineSeries(Chart1[i],xval));
if (ys>Chart1.ChartRect.Top) and (ys<Chart1.ChartRect.Bottom) then
begin
Chart1.Canvas.Brush.Color := Chart1[i].Color;
Chart1.Canvas.Ellipse(xs-4,ys-4,xs+4,ys+4);
end;
end;
I've modified the project above to use annotations. I had to force some repaints at OnCursorChange, OnZoom and OnUndoZoom to move the annotations.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |