SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

1
0

Hi,

I have some problems displaying coordinates including a comment to a datapoint.

I have been looking at the section Inspect Data-Points in the code examples.

But it was not clear to me how i could do that.

So, how can I create a custom way to display coordinates that includes some comment-text? 🙂

Best regards,
Jeppe

  • You must to post comments
0
0

Yes of course.

In XAML i do the following:

<sciChart:TooltipModifier ReceiveHandledEvents="True" IsEnabled="True" UseInterpolation="True">
  <sciChart:TooltipModifier.TooltipLabelTemplate>
    <ControlTemplate TargetType="sciChart:TemplatableControl">
      <Border Background="LightGoldenrodYellow" BorderBrush="#9AB400" BorderThickness="1" Padding="2" CornerRadius="3">
        <StackPanel>
          <TextBlock FontSize="12" Text="{Binding XValue, StringFormat='{}{0:h:mm:ss}'}"/>
           <TextBlock FontSize="12" Text="{Binding YValue, StringFormat=\{0:0.000\}}"/>
           <TextBlock FontSize="12" Text="{Binding Comment}"/>
        </StackPanel>
      </Border>
    </ControlTemplate>
  </sciChart:TooltipModifier.TooltipLabelTemplate>
</sciChart:TooltipModifier>

The coordinates are plotted and this works fine. In the lower part of the stackpanel i want some text to be displayed.

Right now it visually looks like what you can see on the image i have attached where coordinates appear.

I just need to be able to add some text that would be displayed for example in the bottom of the tooltip.

Thanks!

Best regards,
Jeppe

Images
  • You must to post comments
0
0

Hi,

If you take a look at the SeriesTooltips example, in the code behind you will find the TooltipDataContext property which is bound to the TooltipModifier.TooltipLabelDataContextSelector property. The object returned is used as the DataContext of a label.

Alternatively, you can use the XyzDataSeries and put comments as Z values. In this case your markup will work even without using TooltipLabelDataContextSelector.

Hope this helps!

  • You must to post comments
0
0

Hi,

Thanks for the suggestions. I tried using XyzDataSeries and put Comments as Z values.

But i get an exception System.NotSupportedException with the message, GenericMath does not support Type System.String.

What i do is:

<sciChart:TooltipModifier ReceiveHandledEvents="True" IsEnabled="True" UseInterpolation="True">
 <sciChart:TooltipModifier.TooltipLabelTemplate>
   <ControlTemplate TargetType="sciChart:TemplatableControl">
     <Border Background="LightGoldenrodYellow" BorderBrush="#9AB400" BorderThickness="1" Padding="2" CornerRadius="3">
       <StackPanel>
         <TextBlock FontSize="12" Text="{Binding XValue, StringFormat='{}{0:h:mm:ss}'}"/>
         <TextBlock FontSize="12" Text="{Binding YValue, StringFormat=\{0:0.000\}}"/>
         <TextBlock FontSize="12" Text="{Binding ZValue}"/>
       </StackPanel>
     </Border>
   </ControlTemplate>
 </sciChart:TooltipModifier.TooltipLabelTemplate>

And i populate the chart with data using the code below:

CommentsData.ChartData.Append(series.X, series.Y, series.Comment);

Where series.Comment is a list of strings.

The property ChartData is of type IXyzDataSeries and looks like this:

public IXyzDataSeries<DateTime, double, string> ChartData
{
    get { return _chartData; }
    set
    {
        _chartData = value;
        OnPropertyChanged("ChartData");
    }
}

I dont know if i have misunderstood something with the implementation 🙂

Best regards,

Jeppe

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.