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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

0
0

take the SciChart Trader as an example, x-Axis is type of CategoryDateTimeAxis. I want a way to show the index of the time in the collection, when mouse moves over the price bar in some mode like Rollover or Cursor.

regards
chunxi

  • You must to post comments
1
0

Hi there,

If you need to add index of current point into tooltip label – you could use SeriesInfo.DataSeriesIndex value :

<DataTemplate x:Key="ChartDataTemplate" DataType="s:SeriesInfo">

        <TextBlock Text="{Binding DataSeriesIndex}"/>

</DataTemplate>

If you need to add index into axis tooltip – this would require some additional customization:

  1. You need to create custom AxisInfo and add index property;
  2. Then you need to override CategoryDateTimeAxis.HitTest method and return instance of CustomAxisInfo with value for index property. To get index you can use next code:
    var pixelCoordinate = IsHorizontalAxis ? atPoint.X : atPoint.Y
    var index = GetCurrentCoordinateCalculator().GetDataValue(pixelCoordinate);
  3. You need to change axis label tempate of modifier which you use.

There is forum thread which shows how to create and use custom axis info – Custom AxisLabelTemplate and LabelProvider.
Maybe it will be useful.

Hope it helps!

  • chunxi
    Many thanks Yura! I solved the problem.
  • You must to post comments
0
0

Hi there.

Do you have some screenshots which demonstates desired appearance of tooltip? As I understand you need to display index of renderable series in tooltip – in this case I would suggest to place index in DataSeries.SeriesName property.

By default RolloverModifier displays tooltip with SeriesName if it is set out of box. Please take a look on this example –
Real-Time with Cursors.

Also you could try to change tooltip template if you need some custom tooltip. Here is example where rollover has custom tooltip with SeriesName binding – Rollover Feedback.

  • chunxi
    Thanks Yura, But I don't know how to add the index to the text. Looks I need to change something here. Can you help me? <DataTemplate x:Key="ChartDataTemplate" DataType="s:SeriesInfo"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions><TextBlock Grid.Column="0" Margin="3,2,2,2" Style="{StaticResource ChartDataItemsStyle}" Text="{Binding SeriesName}"/> <TextBlock Grid.Column="1" Margin="0,2,2,2" Style="{StaticResource ChartDataItemsStyle}" Text=":"/> <TextBlock Grid.Column="2" Margin="3,2,20,2" Style="{StaticResource ChartDataItemsStyle}" Text="{Binding Value, StringFormat=\{0:0.00000\}}" /> </Grid> </DataTemplate>
  • chunxi
    I want to show the index of the 'Value' in the current series
  • You must to post comments
0
0

alternatively, if we can show the index for the tooltip when mouse move over the X-Axis, Please see my attached pic.

Images
  • chunxi
    can anybody help answer the question?thanks!
  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.