Tracker custom precision

Oystein Bjorke 5 years ago 0
This discussion was imported from CodePlex

krafty wrote at 2013-07-23 11:43:


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?


everytimer wrote at 2013-07-23 12:21:

See Tracker Examples

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

                            <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"/>
                                    <Run Text="X:" FontWeight="Bold" Foreground="Black" />
                                    <Run Text="{Binding DataPoint.X, StringFormat='{}{0:0.000}'}" Foreground="Black"/>
                                    <Run Text="Y:" FontWeight="Bold" Foreground="Black" />
                                    <Run Text="{Binding DataPoint.Y, StringFormat='{}{0:0.000}'}" Foreground="Black" />


Good luck

krafty wrote at 2013-07-23 13:11:

Hi everytimer..

Thanks for the example. I have seen it but I don't think its dynamically possible to change the precision with it?

everytimer wrote at 2013-07-23 13:39:

I think you should create a custom Series derived from LineSeries with the TrackerFormatString property exposed. See MatrixSeries.cs.

Good luck

raphay wrote at 2013-07-23 13:41:

Just put StringFormat='{}{0:0.0}' for only one decimal for example.
If you want more explanation about double format :

krafty wrote at 2013-07-23 14:04:

Thanks everytimer... That's a good idea, it will work!

krafty wrote at 2013-07-23 14:08:

Thanks raphay.. But my query was more towards the binding aspect.