Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
CategoryToolTipLayer show one category label for all series
posted

I would like to have the tooltip for CategoryToolTipLayer show a single category label at the top (in my case a date), and then show the series tooltips below as it usually does. I have many series on the same CategoryXAxis and do not want to show the category labels redundantly. I could show it only on one of the series, but my issue is that some of the series are sometimes empty.

Note that I realize I could work around this by creating a fake series with a transparent brush, but I was hoping there's a cleaner way to do it.

Thanks,

Goke

Parents
  • 34510
    Verified Answer
    Offline posted

    Hello Goke,

    You could retemplate the PointerToolTip which is responsible for rendering the individual series tooltips.  The CategoryToolTipLayer has a PointerToolTipStyle property.  There is a slight difficulty in that the PointerToolTip doesn't have the information needed to determine what category the tooltip is opening for so you will have to track this yourself and then tell the PointerToolTip which category it is over.  I have attached a sample to demonstrate this.

    In my sample I set the DataContext for the PointerToolTip to be the window DataContext which happened to be itself.  I then handled the MouseMove event on the XamDataChart and with the mouse position I was able to calculate the index of the item where the mouse is currently hovering.  With this I was able to get the category label.  I set this label to a property in the window and since the DataContext of the PointerToolTip was set to the window it had access to this property.

    CategoryToolTipLayer.zip
Reply Children
No Data