Jump to content
Software FX Community

Customizing ToolTip


Recommended Posts

Hello. I need a way to fully be able to customize a point tool-tip. the best way i can think is to have a column on the data table i am using as a items source to contain the tool-tip text, and assign this column to the series attribute in some way so this text will appear as the point tool-tip.

I know you can format the tool-tip using the %p %v etc... but i need the text to be created dynamically. another way is maybe using a template with a converter, and passing the entire chart element as the parameter to the converter. this way i can access some of the chart attributes when converting the value to the desired tool-tip.

best scenario (other than pre-constructing the tooltip and binding it from a dedicated column) is to have a converter where i can access the point attributes including the x and y values, and the chart object as the parameter.

Link to comment
Share on other sites

Let's say you are passing a collection of CLR objects to the chart, and these objects expose extra properties you are interested in, if you are using datatable it should work the same with your data having multiple columns you want to expose in the tooltip. All you need to do is create a datatemplate as follows

<DataTemplate x:Key="RichToolTip">


  <Image Grid.Row="0" Grid.Column="0" Source="{Binding Path=DataItem.Image}" Width="70" Height="100" HorizontalAlignment="Center"/>

  <TextBlock Grid.Row="1" Grid.Column="0" Text="{Binding Path=DataItem.Product}" FontFamily="Verdana" FontSize="14" HorizontalAlignment="Center"/>

The key here is that when we use your template, DataItem will point to your CLR object (or datatable row). In this sample the CLR object looked like this

public string Product {

  get { return m_product; }


public string Image {

  get { return m_image; }


You use this template by assigning to AllSeries.ToolTips.Template or if you want to customize the tooltip on a per-series basis Series.ToolTips.Template


Link to comment
Share on other sites

Your converter idea would also work (kind of), if you use Binding Path=Self instead of DataItem.XYZ you will receive an object that you can cast to ChartFX.WPF.Internal.LogicalPointItem, in this class we expose DataItem as well as the Series and Point. We do not expose the chart but if you need this we could add it as a property.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...