Forum > TAChart
Lazarus 4 and TAChart Hint Tool
(1/1)
Nicole:
To my code I did a lot of nasty things. I changed its parent and I upgraded from Lazarus 3.0 to Lazarus 4.0.
I still work with Windows 7.
The TACharts seem to have moved quite fine.
However my hints are not displayed any more. Doubleclick on the chart shows e.g. "cross hair", however there are no outputs at runtime.
Here is an example how the code looks alike, which has worked in my former environment:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---// gibt das Datum in einem kleinen Zusatzfenster im Chart aus und den geklickten Punkt der mouse-over Serieprocedure TFrame_Bacora.Hint_bacoHint(ATool: TDataPointHintTool; const APoint: TPoint; var AHint: String);var ser: TChartSeries; punkt: Integer;begin ser:=nil; if ATool.Series is TChartSeries then begin ser := TChartSeries(ATool.Series); punkt := ATool.PointIndex; end; if ser <> nil then AHint := DateToStr(ser.GetXValue(punkt)) +' ' + FloatToStr(ser.GetYValue(punkt)) else AHint := '';end; // verschiebt das Ausgabefenster vom Mauscursor wegprocedure TFrame_Bacora.Hint_bacoHintLocation(ATool: TDataPointHintTool; AHintSize: TSize; var APoint: TPoint);begin APoint.Y := APoint.Y - AHintSize.CY;end;
CM630:
Just shooting in the dark - the hints are disabled by default for most Lazarus components, maybe you have to enable yours.
wp:
The code in the snippet seems to be correct.
I could imagine the following scenarios which prevent the popup hint from appearing:
* The ChartToolset is no longer linked to the Chart.Tools property.
* The code in procedure TFrame_Bacora.Hint_bacoHint is no longer assigned to the DataPointHintTool's OnHint event.
* You incidentally changed the Shift property of the DataPointHintTool. Normally Shift is an empty set here, meaning that it is enough to just move the mouse over a data point to see the hint.
* The DataPointHintTools's AffectedSeries property is not empty or does not contain the index of the series at which the tool should become active.
* The property Enabled has been switched to False
It is not necessary to set the Chart's ShowHint property to true in order to see the datapoint hints.
Nicole:
Sure, the code is correct, - you wrote it. :D
Thank you for your answer.
I checked all of those points and all positive.
And now the surprise: It works again. I have not changed anything!
Maybe just the clicking at the items re-did something which was broken.
I watch such effects before.
completely different thing:
e.g. I added an imagelist to a TPageControl.
Then I add images to the tabsheets. Leave it alone for long.
One day: all gone. I ask myself: Haven't I checked the icons there? - Did I miss this?
I see - no imagelist.
After having added it: The tabsheet icons re-appear "by themselves".
Navigation
[0] Message Index