Add X-axis value to hot tracking

Micro Charts for WPF Forum

Posted 11 years ago by Nick
Version: 12.2.0573
Avatar

Hello,

Is it possible to include the X-axis value in the hot tracking popup?

Thx.

Comments (7)

Answer - Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello Nick,

You can use the format parameters on the MicroXYSeriesBase.LegendStringFormat property to display values for the X and Y axis. {2} is X axis and {3} is Y axis.

So if I wanted to display the X value, I could do something like this:

<MicroXYLineSeries LegendStringFormat="{}{2}"/>

(Note the inital, empty {} are used to escape curly braces in XAML so they don't get mistaken for markup extensions)

For further reference you can take a look at the documentation, or in the Hot Tracking QuickStart in the Sample Browser to see examples of this in action.


Actipro Software Support

Posted 11 years ago by Nick
Avatar

What I really want to do is set a template for the legend popup. I can see we can template the legend item, but what about the legend itself?

Thx.

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Nick,

Currently the Hot Tracking legend cannot be templated. What kind of customizations are you attempting to make? Knowing your use case will help us when implementing that feature in the future.


Actipro Software Support

Posted 11 years ago by Nick
Avatar

Currently I have a chart with 4 line series.

<microcharts:MicroLineSeries ItemsSource="{Binding SpeedStats}" YPath="Processed" Description="P" LegendStringFormat="{}{5}: {0:N0}/s"
                                                                 Visibility="{Binding IsProcessedLineVisible, Converter={StaticResource BoolToVis}}">
                                    </microcharts:MicroLineSeries>
                                    <microcharts:MicroLineSeries ItemsSource="{Binding SpeedStats}" YPath="Queued" Description="Q" LegendStringFormat="{}{5}: {0:N0}/s"
                                                                 Visibility="{Binding IsQueuedLineVisible, Converter={StaticResource BoolToVis}}">
                                    </microcharts:MicroLineSeries>
                                    <microcharts:MicroLineSeries ItemsSource="{Binding SpeedStats}" YPath="Filtered" Description="F" LegendStringFormat="{}{5}: {0:N0}/s"
                                                                 Visibility="{Binding IsFilteredLineVisible, Converter={StaticResource BoolToVis}}">
                                    </microcharts:MicroLineSeries>
                                    <microcharts:MicroLineSeries ItemsSource="{Binding SpeedStats}" YPath="Errors" Description="E" LegendStringFormat="{}{5}: {0:N0}/s"
                                                                 Visibility="{Binding IsErroredLineVisible, Converter={StaticResource BoolToVis}}">
                                    </microcharts:MicroLineSeries>

 and the legend shows the value of each line in the legend. Now I'd like to add a single X-axis value (a datetime) below the 4 Y-values.

It would look something like:

P: XX
Q: XX
F: XX
E: XX
Date/Time

Answer - Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Nick,

While currently we don't have the ability to retemplate the legend, you may be able to get similar results with the following steps:

On the last series (E, in the example above), add a newline and the X value to the LegendStringFormat:

LegendStringFormat="{}{5}: {0:N0}&#x0a;{1}"

 Then, adjust the template so the chart marker isn't centered vertically:

<microcharts:MicroLineSeries.LegendItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<microcharts:MicroChartMarker Width="8" Height="8" Style="{Binding MarkerStyle}" 
 Margin="0,4,0,0" VerticalAlignment="Top" />
<TextBlock Grid.Column="1" Margin="3,0,0,0" Text="{Binding Text}" />
</Grid>
</DataTemplate>
</microcharts:MicroLineSeries.LegendItemTemplate>

 It's not ideal, but hopefully that will get you close to what you're looking for. Thanks for your input!


Actipro Software Support

Posted 11 years ago by Nick
Avatar

Yeah - I'd actually done that already, the problem being that the date/time is lost when the 'E' series visibility is collapsed. I'm sure I could work around that with some viewmodel logic. Do you have any plans to add this feature?

Answer - Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Nick,

Sorry for the inconvenience. We'll add your suggestion to our todo list.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.