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
- chunxi asked 10 years ago
- last edited 10 years ago
- You must login to post comments
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:
- You need to create custom AxisInfo and add index property;
- 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); - 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!
- Yura Khariton answered 10 years ago
-
Many thanks Yura! I solved the problem.
- You must login to post comments
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.
- Yura Khariton answered 10 years ago
-
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>
-
I want to show the index of the 'Value' in the current series
- You must login to post comments
alternatively, if we can show the index for the tooltip when mouse move over the X-Axis, Please see my attached pic.
- chunxi answered 10 years ago
-
can anybody help answer the question?thanks!
- You must login to post comments
Please login first to submit.