Hello,
I have a LineSeries chart, used to display quotation values.
I want to draw a horizontal line tangent the highest and lowest values visible in the chart.
My problem is I don't know where the MaxValue or MinValue has been drawn on the chart (in other words, the Y-coordinate), in order to draw a line at that coordinate.
Regards
Q: how to plot a Horizontal line in a Line Chart?
Hi!
You could use the following approach:
1) Cycle through all visible points and determine the index of minimum and maximum point. Pseudo-code you can use:
2) Now that you have minimum and maximum point indices, you can use series CalcYPos method to get the maximum and minimum point y pixel coordinate.
3) Finally, use calculated screen position to draw horizontal line. Pseudo-code, placed in TChart.OnAfterDraw event:
You could use the following approach:
1) Cycle through all visible points and determine the index of minimum and maximum point. Pseudo-code you can use:
Code: Select all
for i := Series.FirstVisibleIndex to Series.LastVisibleInde x do
if Series.YValues[i] > current_max then maxindex := i ;
if Series.YValues[i] < current_min then minindex := i;
3) Finally, use calculated screen position to draw horizontal line. Pseudo-code, placed in TChart.OnAfterDraw event:
Code: Select all
With Chart1, Chart1.Canvas do
begin
MoveTo(ChartRect.Left,calculated_y_pos);
LineTo(ChartRect.Right,calculated_y_pos);
end;
Hello,
I reuse this topic for another problem.
I want to draw a horizontal line, on my TLineSeries chart, at certain Y value.
I obtained the screen coordinates using TChartSeries.CalcYPosValue.
I'd like drawing a line using SmallDots style, which I found only in TChartPen class (derived from TPen).
Where TChartPen is used? Chart objects have the standard Canvas property, which contains the standard Pen.
How can I draw a line using TChartPen, in a chart?
Regards
I reuse this topic for another problem.
I want to draw a horizontal line, on my TLineSeries chart, at certain Y value.
I obtained the screen coordinates using TChartSeries.CalcYPosValue.
I'd like drawing a line using SmallDots style, which I found only in TChartPen class (derived from TPen).
Where TChartPen is used? Chart objects have the standard Canvas property, which contains the standard Pen.
How can I draw a line using TChartPen, in a chart?
Regards
How about using the ColorLine tool ?
I think it does all that you're looking for. You can see one example example of it in the TeeChart Pro Demo Features under : All Features -> Welcome ! -> Tools -> Color Line
Josep Lluis Jorge
http://support.steema.com
I think it does all that you're looking for. You can see one example example of it in the TeeChart Pro Demo Features under : All Features -> Welcome ! -> Tools -> Color Line
Josep Lluis Jorge
http://support.steema.com