BarSeries.Clicked() is not working correctly when stacking in 3D (.NET Framework 4.8 WinForms)
Posted: Fri Oct 16, 2020 6:57 am
Hello.
I have .NET Framework 4.8 WinForms application and a chart with 4 stacking 3D bars.
I use the following code to show a tooltip then cursor is above any bar point:
As I can see BarSeries.Clicked() checkes whether cursor is above front, right or top face of 3D bar. But it is not respecting situation when stacking bar point overlaps top face. It still return that cursor is above first bar point decpite of that fact that user actually don't see it's top face. User is seeing second bar front and right face on that position.
My test project
Fix that please ASAP, this bug completely stops my work for now.
I have .NET Framework 4.8 WinForms application and a chart with 4 stacking 3D bars.
I use the following code to show a tooltip then cursor is above any bar point:
Code: Select all
private void tChart1_MouseMove(object sender, MouseEventArgs e)
{
Int32 clickedPointIndex = -1, clickedSeriesIndex = -1;
var chart = sender as TChart;
//search for cursor hitting point of any bar
for (int i = 0; i < chart.Series.Count; i++)
{
if ((chart.Series[i] is CustomBar) && ((chart.Series[i] as CustomBar).Clicked(e.X, e.Y) != -1))
{
clickedSeriesIndex = i;
clickedPointIndex = (chart.Series[i] as CustomBar).Clicked(e.X, e.Y);
break;
}
}
if (clickedPointIndex != -1)
{
//when cursor was moved from one point to another on the same bar - tooltip must be changed
if ((clickedSeriesIndex != prevClickedSeriesIndex) || (clickedPointIndex != prevClickedPointIndex))
{
toolTip1.Active = false;
toolTip1.SetToolTip(sender as TChart, $"{chart.Series[clickedSeriesIndex].Title} - {chart.Series[clickedSeriesIndex][clickedPointIndex].Y}");
toolTip1.Active = true;
prevClickedSeriesIndex = clickedSeriesIndex;
prevClickedPointIndex = clickedPointIndex;
}
else
if (!toolTip1.Active)
{
toolTip1.SetToolTip(chart, $"{chart.Series[clickedSeriesIndex].Title} - {chart.Series[clickedSeriesIndex][clickedPointIndex].Y}");
toolTip1.Active = true;
}
}
else
toolTip1.Active = false;
}
My test project
Fix that please ASAP, this bug completely stops my work for now.