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
645
Custom Tooltip
posted

I create series on the fly based on the data loaded.  Something like this:

 

foreach (var entry in distinctSeries)

{

    ScatterSeries ss = newScatterSeries();

    ss.XMemberPath = "XVal";

    ss.YMemberPath = "YVal";

    //etc.

    xamDataChart1.Series.Add(ss);

}

 

I want to have a custom tooltip based on some properties of the points in the series.

The underlying data looks something like this:

public class MyDataPoint

{

    public Int64 XVal { get; set; }

    public int YVal {get; set; }

    public string SomeOtherDataPointValue { get; set; }

    // other stuff

    public string MyToolTip

    {

        get { return XVal.ToString() + "my tooltip stuff goes here" + SomeOtherDataPointValue();}

        //etc

    }

}

 

I guess my question is how do I specify when I'm creating these series in the code behind that I want to use this MyToolTip property as the tooltip that pops up for each point?  I'm wanting to do something like:

ss.ToolTip = // and then something that indicates I want to bind each point's tooltip to the MyToolTip property of that  point

Make sense?  

How would I do that?

 

Parents
No Data
Reply
  • 30692
    Verified Answer
    Offline posted

    Hi,

    I'm winging this a bit so let me know if this doesnt compile or work:

    TextBlock tb = new TextBlock();
    tb.SetBinding(TextBlock.TextProperty, new Binding("Item.MyToolTip"));
    ss.Tooltip = tb;
    

     

    Hope this helps!

    -Graham

Children