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
Hi,
if you want to move from your data space to the coordinate space of the chart. You can call the GetScaledValue methods on the x and y axis. You have to provide these the current zoom window of the chart, which you can get from XamDataChart.Window. But you also have to provide the viewport rectangle of the series that you are trying to scale to. This is most simple done by creating a rectangle with the width and height of the series. If you do a search on the xamDataChart forum for GetScaledValue you should see numerous examples of doing this sort of operation.
Hope this helps!
-Graham
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.
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); }