Hi;
Can we do custom label in WPF? I create one in win form, but don't sure if you provide this function in WPF.
thanks ...
/Cathy
This is the way how to create a custom drawing:
1. Create a canvas and add the XamChart to it as a child.
2. Use mouse event and add a TextBlock to the canvas as a child.
3. Use GetPosition methods to get pixel position from axis values.
Thanks,
GoranS
See sample below
XAML:
<Grid x:Name="LayoutRoot"> <Canvas Name="Canvas1" Margin="0,0,0,0"> <igCA:XamChart Name="Chart1" Width="523" Height="329"/> </Canvas></Grid>
C#:
protected override void OnMouseDown(System.Windows.Input.MouseButtonEventArgs e) { double x1 = Chart1.GetPosition(Infragistics.Windows.Chart.AxisType.PrimaryX, 1); double y1 = Chart1.GetPosition(Infragistics.Windows.Chart.AxisType.PrimaryY, 10); Canvas canvas = Chart1.Scene.GridArea.Content as Canvas;
TextBlock text = new TextBlock(); text.Foreground = Brushes.Red; text.Text = "Test"; Canvas.SetLeft(text, x1); Canvas.SetTop(text, y1);
Canvas1.Children.Add(text);
base.OnMouseDown(e); }
Hello,
XamChart has the GetPosition method.
i.e.: XamChart.GetPostion(Infragistics.Windows.Chart.AxisType.PrimaryX, 1);
What method can I use in the XamDataChart? for getting the position of a datapoint.