This project is read-only.

Labeling data points on line graph

Mar 1, 2011 at 7:22 AM

Is it possible to assign label for each data point on line graph? ( http://www.syncfusion.com/content/en-US/Products/screenshots/aspnet/img/InteractiveCursor_larger.png)

I wish to stick XY value near data point instead of showing it on tooltip of data point.

Please let me know if there is any way to achieve this.

Mar 1, 2011 at 3:30 PM

Take a look at TemplateMarkerGenerator.

Aug 8, 2011 at 12:18 PM

@Jimfoye,

cud u pls post a simple sample with a Numeric(X) and Double Axis(Y)?

Aug 9, 2011 at 8:21 AM

Update: I was able to do it by deriving from ShapeElementPointMarker.

Posting the code for others reference :)

public override UIElement CreateMarker()
        {
            StackPanel stackPanel = new StackPanel();
            stackPanel.Orientation = Orientation.Vertical;

            Ellipse ellipse = new Ellipse()
            {
                Width = 10,
                Height = 10,
                StrokeThickness = 1,
                Stroke = Brushes.OrangeRed,
                Fill = Brushes.Orange,
                HorizontalAlignment = HorizontalAlignment.Left
            };
           
            stackPanel.Children.Add(ellipse);

            Border border = new Border() 
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
                BorderThickness = new Thickness(1),
                BorderBrush = Brushes.Black,
                CornerRadius = new CornerRadius(2)
            };

            TextBlock txtblk = new TextBlock() 
            {
                Background = new SolidColorBrush(Color.FromRgb(247,247,247)),
                FontSize = 16,
            };

            border.Child = txtblk;

            if (!String.IsNullOrEmpty(ToolTipText))
            {
                ToolTip tt = new ToolTip();
                tt.Content = ToolTipText;
                txtblk.Text = ToolTipText;
                stackPanel.ToolTip = tt;
            }

            if(showLabel.Equals("yes"))
                stackPanel.Children.Add(border);

            return stackPanel;
        }

Oct 9, 2013 at 6:06 AM
Hello ujwaliyer

Could you or anyone please tell me how to label data points with their ids/names (Not x or Y values). If any sample code , please post it. It will be great help.
Thanks
Oct 9, 2013 at 6:07 AM
Hello ujwaliyer

Could you or anyone please tell me how to label data points with their ids/names (Not x or Y values). If any sample code , please post it. It will be great help.
Thanks