-
Notifications
You must be signed in to change notification settings - Fork 980
Closed
Description
Steps to reproduce
- Use the following PlotModel
var model = new PlotModel();
model.MouseDown += (s, e) =>
{
if (e.ChangedButton == OxyMouseButton.Left)
{
foreach (var hit in model.HitTest(new HitTestArguments(e.Position, 0)))
{
if (hit.Item is BarItem barItem)
{
// change the color of the clicked Bar Item to
barItem.Color = OxyColors.Red;
model.InvalidatePlot(false);
}
}
}
};
var s1 = new BarSeries { Title = "Series 1", IsStacked = true, StrokeColor = OxyColors.Black, StrokeThickness = 1, StackGroup = "3" };
int i = 0;
s1.Items.Add(new BarItem { Value = 25, CategoryIndex = i++ });
s1.Items.Add(new BarItem { Value = double.NaN, CategoryIndex = i++ }); // add one invalid item
s1.Items.Add(new BarItem { Value = 18, CategoryIndex = i++ });
s1.Items.Add(new BarItem { Value = 40, CategoryIndex = i++ });
model.Series.Add(s1);- Now Click on the top item, the
HistTestreturns the wrong item
Platform:
.NET version: All
Expected behaviour
The HitTest should return the correct item. Thus the clicked BarItem should change color!
Actual behaviour
Problem description
I found the source of the misbehaviour in BarSeriesBase.UpdateValidData when the index in the reverse lookup dictionary is not correctly calculated.
I will provide a merge request to fix this bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
