So I have this fine legacy Delphi 5 project with a tchart with vertical bars along a datetime bottomaxis. It works very fine.Now I want to add up to three horizontal 'warning'-lines, each with up to three togglable labels. The idea is to show three red limit lines(three 3-element lineseries), and labels at far left, middle and far right showing Yvalue limits. Labels are togglable in order not to clutter data. And it works too. These labels must sit at xmin, mid and xmax even when scrolling. I solved it with having a timer started when first dataseries is redrawn, and then resetting the three labelseries with the chart's new xmin, mid, xmax. When scrolling, the labels follow.But when I zoom in, something is lost. I print the xmin, xmax and line coordinates in the statusbar as it is recalculated (for debugging), it looks quite right, but the three horizontal lines slip away to the left. Leftmost point is out of sight, rightmost is drifting to the left, worse with increased zoom. Yvalues are correct.
Is there a best way to do plot-eventdriven recalculation of plotdata?(Or must I rebuild it all in my XE10.2? )
![Delphi Delphi](/uploads/1/2/4/7/124744178/688731766.jpg)
P OltergeistP Oltergeist
The default maximum and minimum values automatically chosen by TChart are too close to the maximum and minimum of the series values, so that sometimes series lines parallel to minimum and maximum are not visible in the chart. Therefore I want to make maximum and minimum a little bit larger with the following event handler: with LeftAxis do. Delphi - Mouseover hint for TChart series value I am using a TChart in Delphi 7, and I want to display some bar charts. I am using the following code to set up the series values from a database query.
1 Answer
I just ran it at home, the same phenomenon appears in XE10.2. When I zoom in, the second series (horizontal line, endpoints recalculated to be at the graph's edges) creeps away to the side. However if I connect series2 to Topaxis, then everything is fine. Rock solid. Seems like a natural thing. Silly me.
P OltergeistP Oltergeist