SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
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
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:
var pixelCoordinate = IsHorizontalAxis ? atPoint.X : atPoint.Y
var index = GetCurrentCoordinateCalculator().GetDataValue(pixelCoordinate);
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!
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.
<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>
alternatively, if we can show the index for the tooltip when mouse move over the X-Axis, Please see my attached pic.
Please login first to submit.