Trackball display for time and numeric axis simultaneously.

Hi Experts 

I am creating a graph on the main X axis is a timeline, and on the second X axis is numbers for an easier way to get the point number on the graph (this numerical axis is the main graph, the time line is only needed to display to the user), so I have a problem when the numerical axis was not and was only temporal I created Trackball and showed X and Y coordinates of point on the entire graph, now that I added a new numerical axis and made it main Trackball shows only the first point coordinates.

chartControl1.Trackball.Visible = true;
chartControl1.Trackball.DisplayMode = TrackballTooltipDisplayMode.Float;

1.png

How can this be fixed?


3 Replies

YP Yuvaraj Palanisamy Syncfusion Team February 28, 2022 05:40 PM UTC

Hi Dmitriy Shilin,  
  
You can customize the trackball text with the help of TrackballTooltipRendering event of chart Trackball as per the below code example.   
  
CodeSnippet 
  
chartControl1.Trackball.TrackballTooltipRendering += Trackball_TrackballTooltipRendering;  
  
private void Trackball_TrackballTooltipRendering(object sender, TrackballTooltipEventArgs args)  
 
    args.Text = Math.Round(chartControl1.Series[args.SeriesIndex].Points[args.pointIndex].X, 2).ToString();  
 
  
 
Also, please find the sample from the below link and let us know if you have any further assistance.  
 
  
Output 
 
  
 
Thanks, 
Yuvaraj. 



DS Dmitriy Shilin March 1, 2022 10:05 PM UTC

Hi, thanks for your reply, the problem is solved but not exactly the way I wanted, I wanted the X axis to have numbers corresponding to the point index on the graph to find the point index on the graph more easily and quickly as I do point movement with the mouse, my problem is that Trackball does not follow the mouse pointer if the axis values have different types, I create the axes this way:

ChartAxis newXaxis = new ChartAxis();
newXaxis.GridLineType.ForeColor = Color.LightGray;
newXaxis.LineType.ForeColor = Color.LightGray;
newXaxis.ValueType = ChartValueType.DateTime;
newXaxis.RangeType = ChartAxisRangeType.Set;

newXaxis.DateTimeFormat = "HH:mm";
int addminX = AllData.measure[0].TimeStart.Minute % 15;
int addmaxX = (60 - AllData.measure[0].TimeEnd.Minute) % 15;
DateTime minX = AllData.measure[0].TimeStart.AddMinutes(-addminX).AddSeconds(-AllData.measure[0].TimeStart.Second);
DateTime maxX = AllData.measure[0].TimeEnd.AddMinutes(addmaxX).AddSeconds(-AllData.measure[0].TimeEnd.Second);

newXaxis.DateTimeRange = new ChartDateTimeRange(minX, maxX, 15, ChartDateTimeIntervalType.Minutes);
chartControl1.Axes.Add(newXaxis);

ChartAxis mainXaxis = new ChartAxis();
mainXaxis.OpposedPosition = true;
mainXaxis.GridLineType.ForeColor = Color.LightGray;
mainXaxis.LineType.ForeColor = Color.LightGray;
mainXaxis.ValueType = ChartValueType.Double;
mainXaxis.RangeType = ChartAxisRangeType.Set;

int minpoint = ((AllData.measure[0].TimeStart.Hour * 60 * 60 + AllData.measure[0].TimeStart.Minute * 60 + AllData.measure[0].TimeStart.Second) - (minX.Hour * 60 * 60 + minX.Minute * 60 + minX.Second)) / interval;
int maxpoint = (((maxX.Hour * 60 * 60 + maxX.Minute * 60 + maxX.Second) - (minX.Hour * 60 * 60 + minX.Minute * 60 + minX.Second)) / interval) - minpoint;
int separator = 15 * 60 / interval;
mainXaxis.Range = new MinMaxInfo(-minpoint, maxpoint, separator);
chartControl1.Axes.Add(mainXaxis);
//newXaxispoint.IsVisible = false;

.....
series.XAxis = mainXaxis;

for (int j = 0; j < AllData.measure[i].DataGraph.Count; j++)
{
series.Points.Add(j, AllData.measure[i].DataGraph[j]);
}
.....

I am also attaching a video to fully understand the problem.


Attachment: test_vid_6bde2d73.zip


YP Yuvaraj Palanisamy Syncfusion Team March 3, 2022 03:20 AM UTC

Hi Dmitriy Shilin, 
 
We have checked the reported problem “trackball label moved to follow corresponding datapoint when x-Axis have different type of axis” and we are not able to reproduce the reported problem at our end. Also, we have attached the sample for your reference. Please find the sample from the below link. 
 
 
Output: 
 
 
Could you please share us the modified sample with issue reproduced state which will be helpful to serve you better solution at the earliest. 
 
Regards, 
Yuvaraj. 


Loader.
Up arrow icon