Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Adjustable ToolTip Vertical Line (Read 36 times)
Cajunman64
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 2
Joined: Apr 2nd, 2024
Adjustable ToolTip Vertical Line
Yesterday at 3:09pm
Print Post  
The are two objects I am trying to implement into my RealTimeChart LineChart.

First is to get the ToolTip to display the Pressure and time when my mouse pointer is hovered over the line.
I managed to enabled the Tooltip function in the Properties of the Chart but I haven't figured out how to add the code to my form.
Using the example from "Re: Display X and Y value when hovering on points of line on" I had added the code under "class YTooltip : Series" but the upper part of the Code I do not know how to add it to my Form....Attached is my form Code.

Second is I like to add Two "Adjustable ToolTip Vertical Line" where the user can move to two different places of the Line Chart where I can write a code to calculate the differential pressure between the two points. like in photo
  

Line_Chart.txt ( 50 KB | 6 Downloads )
Vertical_Line.jpg ( 73 KB | 2 Downloads )
Vertical_Line.jpg
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3248
Joined: Oct 19th, 2005
Re: Adjustable ToolTip Vertical Line
Reply #1 - Today at 12:00pm
Print Post  
The Pressure series class from attached code overrides GetLabel to return Sample.Label for LabelKinds.ToolTip - does that tooltip appear when the mouse pointer hovers over a point? Instead of the Sample.Label property value, you could return concatenated Sample.Value and Sample.Time from GetLabel.

One way to draw those lines is by passing their coordinates to a custom SeriesRenderer object added to the plot:

Code
Select All
class MarkerLineRenderer : Renderer2D
{
	public MarkerLineRenderer(SimpleSeries series) :
		base(new ObservableCollection<Series> { series })
	{
	}

	protected override void Draw(RenderContext context)
	{
		var series = Series[0];
		for (int i = 0; i < series.Size; i++)
		{
			double x = series.GetValue(i, 0);
			var point = GetPixel(x, context.XAxis, 0, context.YAxis, context.Component);
			context.Graphics.DrawLine(
				Pens.Red, point.X, 0, point.X, (float)context.Component.ActualHeight);
		};
	}
}

var markerCoords = new SimpleSeries(
	new double[] { 5, 20 }, null);
lineChart.Plot.SeriesRenderers.Add(
	new MarkerLineRenderer(markerCoords)); 



the coordinates being relative to the chart's X axis range. You could get the values from e.g. TrackBar controls, or possibly implement a custom PlotController class to let users draw the range interactively inside the plot.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Cajunman64
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 2
Joined: Apr 2nd, 2024
Re: Adjustable ToolTip Vertical Line
Reply #2 - Today at 4:16pm
Print Post  
I had added the "class MarkerLineRenderer : Renderer2D" code but not sure where to add the lower part of the code...when I add the whole code I get errors....Code 1.png

Thanks for the help
  

Live_Chart_Properties_.png ( 100 KB | 1 Download )
Live_Chart_Properties_.png
Live_Chart_ToolTip_.png ( 91 KB | 1 Download )
Live_Chart_ToolTip_.png
Code_1.png ( 122 KB | 1 Download )
Code_1.png
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3248
Joined: Oct 19th, 2005
Re: Adjustable ToolTip Vertical Line
Reply #3 - Today at 4:29pm
Print Post  
You should be able to call those few lines from MainForm constructor, after the other lineChart... assignments.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint