Tracker custom precision

Jul 23, 2013 at 10:43 AM
Hi,

I wanted to round off the double precision displayed in the tracker X and Y values .. using some custom rounding values. Is it possible to do with the current tracker?

Thanks
Jul 23, 2013 at 11:21 AM
See Tracker Examples
  <oxy:Plot.DefaultTrackerTemplate>
                <ControlTemplate>

                    <oxy:TrackerControl Position="{Binding Position}" BorderThickness="2" BorderBrush="LightSteelBlue" LineStroke="SteelBlue" LineExtents="{Binding PlotModel.PlotArea}">
                        <oxy:TrackerControl.Background>
                            <LinearGradientBrush EndPoint="0,1">
                                <GradientStop Color="#B0C4DE" />
                                <GradientStop Offset="1" Color="#f0ffffff" />
                            </LinearGradientBrush>
                        </oxy:TrackerControl.Background>
                        <oxy:TrackerControl.Content>

                            <UniformGrid  Columns="2" Canvas.Left="{Binding Position.X}" Canvas.Top="{Binding Position.Y}" Margin="6">
                                <TextBlock Text="{Binding Series.Title}" FontWeight="Bold" FontSize="15" Foreground="Black" />
                                <TextBlock Text="{Binding Series.Tag}" Foreground="Black"/>
                                <TextBlock>
                                    <Run Text="X:" FontWeight="Bold" Foreground="Black" />
                                    <Run Text="{Binding DataPoint.X, StringFormat='{}{0:0.000}'}" Foreground="Black"/>
                                </TextBlock>
                                <TextBlock>
                                    <Run Text="Y:" FontWeight="Bold" Foreground="Black" />
                                    <Run Text="{Binding DataPoint.Y, StringFormat='{}{0:0.000}'}" Foreground="Black" />
                                </TextBlock>
                            </UniformGrid>

                        </oxy:TrackerControl.Content>
                    </oxy:TrackerControl>

                </ControlTemplate>
            </oxy:Plot.DefaultTrackerTemplate>
Good luck
Jul 23, 2013 at 12:11 PM
Hi everytimer..

Thanks for the example. I have seen it but I don't think its dynamically possible to change the precision with it?
StringFormat='{}{0:0.000}'
Jul 23, 2013 at 12:39 PM
I think you should create a custom Series derived from LineSeries with the TrackerFormatString property exposed. See MatrixSeries.cs.

Good luck
Jul 23, 2013 at 12:41 PM
Just put StringFormat='{}{0:0.0}' for only one decimal for example.
If you want more explanation about double format : http://www.csharp-examples.net/string-format-double/
Jul 23, 2013 at 1:04 PM
Edited Jul 23, 2013 at 1:05 PM
Thanks everytimer... That's a good idea, it will work!
Jul 23, 2013 at 1:08 PM
Thanks raphay.. But my query was more towards the binding aspect.
cheers.