Hi,
I have a pie chart with markers set to show the data point value or percentage. I have also set tooltips on the data points to show further information and handle the DataItemMouseLeftButtonDown to allow 'drill down'.
My problem is that the tooltips dont show when the user hovers over the marker label, and when the chart is fairly small this covers most of the slice. I can't seem to set a tooltip on the marker either directly or using TooltipService. Also, the DataItem event isn't triggered when clicking on the marker (which is fair enough), but is it possible to handle this event some other way?
The problem is isn't not very intuitive for users of the chart.
Thanks
Unfortunately there is no work around for this issue. However, a bug has been submitted for this. The bug number is 24896. If you would like more information on this bug, please contact our Developer Support team with this number.
Thanks.
Thanks Marisa,
I guess the solution would be to set the IsHitTestVisible property to False for the marker, or at least make it an option
Its a bit hacky, but you can use this as a workaround until the bug is resolved if you would like:
public partial class pie : Page
{
public pie()
InitializeComponent();
theChart1.MouseEnter += new MouseEventHandler(theChart1_MouseEnter);
}
private bool _fixed = false;
void theChart1_MouseEnter(object sender, MouseEventArgs e)
if (!_fixed)
MakeAllTextBlocksNonHittable(sender as FrameworkElement);
_fixed = true;
void MakeAllTextBlocksNonHittable(FrameworkElement current)
if (current != null)
TextBlock text = current as TextBlock;
if (text != null) text.IsHitTestVisible = false;
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(current); i++)
MakeAllTextBlocksNonHittable(VisualTreeHelper.GetChild(current, i) as FrameworkElement);
It basically walks the visual of the chart control when the mouse enters it and marks all of them as HitTestVisible = False, to avoid the issue. Obviously, if you are depending on any mouse events firing for other TextBlocks on the chart, you might have to extend this a bit.
One way to narrow the scope would be to set a specific font foreground color on the markers and check against that in this method. Hope this helps! Again, a little bit hacky though, so reverse it out if you experience any untoward effects.
You may have to remove the flag that makes this execute only once if you are doing things that make the grid recreate the markers (like changing the data source).
-Graham