Hello everyone,
is it possible to edit interactively the XamDataChart points with the mouse, e.g. set new point with the mouse click or drag the existing one?
Any help will be greatly appreciated.
Hello,
Thank you for your post. I have been looking through it and I created a sample project for you where you can add DataPoint, when you click with the mouse. As for the DataPoints dragging, after some research it has been determined to be a new feature request. I have sent your feature request directly to our product management team. Our product team chooses new feature requests for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested features, we can plan accordingly.
We value your input, and our philosophy is to enhance our toolset based on customer feedback. If your feature is chosen for development, you will be notified at that time. Your reference number for this feature request is FR13776.
If you would like to follow up on your feature request at a later point, you may contact Developer Support management via email. Please include the reference number of your feature request in the subject and body of your email message. You can reach Developer Support management through the following email address: dsmanager@infragistics.com
Stefan Stoyanov, Good day!
Your example (xamDataChartAddPoints), helped me a lot. Thank you very much!
I have to ask you. Please send me a sample to the line. By clicking on the chart to add a new point in line.
x++; y=y_mouse.
Hello kabsau,
Try foolowing code (modified Infragistics sample).
Add somewhere:
xamChart.PreviewMouseLeftButtonDown += OnPreviewMouseLeftButtonDown;
void OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { // Assumed there is only one serie. var series = this.xamChart.Series.FirstOrDefault(); if (series == null) return; var point = e.GetPosition(series); if (series.Chart.Axes.OfType<NumericXAxis>().Any()) { double unscaledX; double unscaledY; UnscalePoint(series, point, out unscaledX, out unscaledY); var data = xamChart.DataContext as ObservableCollection<LiveViewDataPoint>; // Get insertion index. int index = 0; foreach (var dataPoint in data) { if (dataPoint.X < unscaledX) { index++; continue; } if (dataPoint.X == unscaledX) { // Don't insert points with the same X-coordinate. index = -1; } break; } var newPoint = new LiveViewDataPoint() {X = (int) unscaledX, Y = unscaledY}; if (index == data.Count()) { // Add point at the end of the curve. data.Add(newPoint); } else if (index != -1) { // Insert new point. data.Insert(index, newPoint); } } }
public class LiveViewDataPoint { public double X { get; set; } public double Y { get; set; } }private static void UnscalePoint(Series series, Point point, out double unscaledX, out double unscaledY) { var xAxis = series.Chart.Axes.OfType<NumericXAxis>().First(); var yAxis = series.Chart.Axes.OfType<NumericYAxis>().First(); var viewport = new Rect(0, 0, xAxis.ActualWidth, yAxis.ActualHeight); var window = series.Chart.WindowRect; unscaledX = xAxis.GetUnscaledValue(point.X, window, viewport); unscaledY = yAxis.GetUnscaledValue(point.Y, window, viewport); }
Dear bonitz, I could not repeat your example. I understand the idea of work, but I had not achieved the result. Please laid out his example in the project (as Stefan Stoyanov).
Hello Kabsau,
try please this example
Bonizt
Hi Guys,
Is there a way to move the existing data points to a new position?
Friendly Regards,
Roelof
Roelof,
Your question was answered in the Moving series data point with mouse thread that you created for this.