Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 2407 - Subsclassing annotation tool drawText method is not called.
Summary: Subsclassing annotation tool drawText method is not called.
Status: CONFIRMED
Alias: None
Product: .NET TeeChart
Classification: Unclassified
Component: Xamarin.Forms (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- enhancement
Target Milestone: ---
Assignee: Steema Issue Manager
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-29 05:43 EDT by pep jorge
Modified: 2021-03-29 05:43 EDT (History)
0 users

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments
sample (567.88 KB, application/x-zip-compressed)
2021-03-29 05:43 EDT, pep jorge
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pep jorge 2021-03-29 05:43:34 EDT
Created attachment 960 [details]
sample

Related post :
http://support.steema.com/viewtopic.php?f=4&t=17492&sid=ab43c8c37b85b8f48aefaa218bc86c14

I got it to render, albeit incorrectly, by subclassing it and invoking the draw call to it. The DrawText method is NOT being called otherwise, for whatever reason.

Edit: AutoSize was being changed for some reason, somewhere. The sizing is ok.

This is a workaround:
[code]


	public class AnnotationTool : Annotation
	{
		public AnnotationTool( Chart chart, string text ) : this(chart) => Text = text;
		public AnnotationTool( Chart chart ) : base(chart)
		{
			Active = true;
			Position = AnnotationPositions.Custom;
			TextAlign = TextAlignment.Start;
			AutoSize = true;
			AllowEdit = false;
		}

		public Rectangle GetBounds()
		{
			 // forces a refresh.
			AutoSize = true;
			return Bounds;
		}


		public void Draw( Graphics3D g ) { DrawText(g); }
	}
	
	
	// In the graphing page, attach to the AfterDraw event
	private void TChart1_Annotations_AfterDraw( object sender, Graphics3D g )
	{
		/// ...
		AnnotationTool.Draw(g);
		/// ...
	}

[/code]