dummzeuch 1529 Posted January 9 (edited) I am using TeeChart for drawing multiple series with two different vertical axis. One set of series uses the left axis, the others use the right axis. The legend contains check boxes that allow the user to turn a series on and off. Everything works fine but there is one small problem that I can't get solved: When all series associated with one of the axis are turned off, this axis is not shown. Right Axis missing: Left axis missing: I don't want that. Both axes should always be shown, regardless of which series are visible. But I found no way to change this behavior. Any hint? Edited January 9 by dummzeuch 1 Share this post Link to post
Sherlock 666 Posted January 9 Perhaps draw invisible point belonging to the axis? Share this post Link to post
dummzeuch 1529 Posted January 9 (edited) 1 hour ago, Sherlock said: Perhaps draw invisible point belonging to the axis? Invisible point? You mean a point series, that is visible but does no contain any data? Or one that contains data but is set to be drawn invisibly? I thought about that, but I was really hoping that I am just missing some setting. Edited January 9 by dummzeuch Share this post Link to post
Sherlock 666 Posted January 9 Visible but without data, best describes what I meant. I currently don't use TChart but had to, several years ago. I remember the necessity for trickery like that to reach the expected outcome. But my brain is not good at storing code...sorry. Share this post Link to post
Die Holländer 54 Posted January 9 Is it possible to use the Afterdraw event to force the axis to be visible? procedure TForm1.Chart1AfterDraw(Sender: TObject); begin if not Chart1.Axes.Left.Visible then Chart1.Axes.Left.Visible := True; if not Chart1.Axes.Right.Visible then Chart1.Axes.Right.Visible := True; end; Share this post Link to post
dummzeuch 1529 Posted January 9 1 hour ago, Die Holländer said: Is it possible to use the Afterdraw event to force the axis to be visible? procedure TForm1.Chart1AfterDraw(Sender: TObject); begin if not Chart1.Axes.Left.Visible then Chart1.Axes.Left.Visible := True; if not Chart1.Axes.Right.Visible then Chart1.Axes.Right.Visible := True; end; Interesting idea, but unfortunately it doesn't work either. I also tried to just set them visible unconditionally and tried the BeforeDrawAxes event. Share this post Link to post
dummzeuch 1529 Posted January 9 (edited) Adding two empty point series, one associated with each axis, and not shown in the legend, does the trick. This still feels too much like a hack. So if anybody else has an idea... ? I used to have an account for Steema's support forum, but my credentials don't seem to work any more. Edited January 9 by dummzeuch Share this post Link to post
Pat Foley 52 Posted January 9 I found this Quote Pep wrote:Hi Bertrod, you can accomplish that by using : Series1.Pen.Visible:=false; This one works well. Thank you pep. at http://teechart.net/support/viewtopic.php?t=4313 Share this post Link to post
dummzeuch 1529 Posted January 9 2 hours ago, Pat Foley said: I found this at http://teechart.net/support/viewtopic.php?t=4313 Unfortunately this is basically the same hack as with empty TPointSeries, just made invisible with a different method. Share this post Link to post
Yeray 0 Posted January 10 I use to recommend adding a dummy series with ShowInLegend set to False. In this case this should do it: Chart1.Draw; Chart1.Axes.Left.Automatic:=False; Chart1.Axes.Right.Automatic:=False; with Chart1.AddSeries(TLineSeries) do begin ShowInLegend:=False; VertAxis:=aBothVertAxis; end; Share this post Link to post
david berneda 21 Posted Saturday at 10:08 AM (edited) We're adding a new property to axes to achieve this functionality: Chart1.Axes.Left.AutoHide := False; By default AutoHide is True, meaning the axis will be automatically made invisible when all of its associated series are also invisible. Setting it to False will always paint the axis as if all of its series were visible. If the axis min and max are set to be automatic, they will be calculated using all associated series. If you wish to beta test I'll be glad to email you the latest sources, just email me at david@steema.com This new property will also allow adding multiple custom axes anywhere, without the need of creating series, among other things. regards ! david Edited Saturday at 10:10 AM by david berneda 2 Share this post Link to post