Show label on data points in line graph

Aug 8, 2011 at 11:26 AM

Hi,

Is there any way to show label(with X and Y values) near the data point..?

I guess we need to use "TemplateMarkerGenerator2" but i am unable to do so.

Any pointers..? A working sample with a simple Numeric(X), double(Y) axis would be great!

Thanks!

Sep 30, 2011 at 4:33 AM

Hi,

 

yes, it's easy with DataFollowChart.

Marker position (relative to curve's point) could be affected by setting ScreenOffsetX, ScreenOffestX (s. code below)

        <DataTemplate x:Key="followMarkerTemplate">
            <Grid d3:ViewportPanel.ScreenOffsetY="-20" d3:ViewportPanel.ScreenOffsetX="40">
                <Rectangle RadiusX="3" RadiusY="3" Fill="Yellow" Stroke="DarkGray">
                </Rectangle>
                <StackPanel Orientation="Vertical">
                    <StackPanel Orientation="Horizontal" Margin="3">
                        <TextBlock Text="{Binding Data.Y, StringFormat=V:{0}}" Margin="0,0,3,0"/>
                        <TextBlock Text="{Binding Data.Derivative, StringFormat=D:{0}}"/>
                    </StackPanel>
                </StackPanel>
            </Grid>
        </DataTemplate>

DataFollowChart