Question

I have a stacked bar chart on my userform that I am generating dynamically based of data that is currently in an array. There are approximately 500 data points in total, around 20 series.

What I currently have is each datapoint on this chart owns its own tooltip. That is, when a user hovers over a data point, a tooltip pops up, telling the user where the data is coming from. What I would like is to assign an event handler to each datapoint, so that on MouseOver, I can change the color of that individual datapoint.

I believe one way would be to capture the mouse position over the chart, and then with a little math, figure out which data point is being hovered. However, if possible, I would like a simpler solution. Are there any event handlers that can do this? If so, how would I go about assigning them? I did a little searching and it appears that I can only apply an event handler to the chart area itself, which doesn't really serve my purpose.

Any advice would be gladly appreciated

Was it helpful?

Solution

With the System.Windows.Forms.DataVisualization.Charting component this is only possible by registering the MouseMove event and calculating the hovered point as you suggested in your question.

The DataPoint class itself does not offer any events, see the documentation

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top