krb875 Posted July 17, 2008 Report Share Posted July 17, 2008 Hopefully this is a simple question, If I have a line graph and I want to mark a particular point on that graph with a marker and I have the corresponding value to is there away to do this without having to overlay a scatterplot on top of the line plot. Quote Link to comment Share on other sites More sharing options...
JuanC Posted July 21, 2008 Report Share Posted July 21, 2008 If you want to "highlight" one of the points in the line you can do so using the Chart.Points property. This allows you to change the marker shape, size, color, etc. If you draw a marker on a specific XY but this is not one of the points in the line, you will probably use the Annotation extension. This extension allows you to create WPF visuals and attach them to a logical XY position inside our plot area. If you wanted to do this in code it would be something like this: ChartFX.WPF.Annotation.Annotations annotations = new ChartFX.WPF.Annotation.Annotations();Rectangle r = new Rectangle();r.Width = 10;r.Height = 10;r.Fill = Brushes.Red;r.Stroke = Brushes.Black; ChartFX.WPF.Annotation.Annotations.SetAttachX(r, 2.0);ChartFX.WPF.Annotation.Annotations.SetAttachY(r, 40.0); annotations.Children.Add®; chart1.Extensions.Add(annotations);Regards, JuanC Quote Link to comment Share on other sites More sharing options...
krb875 Posted July 22, 2008 Author Report Share Posted July 22, 2008 I just need to highlight one of the points on the line. The source is a simple Array of Singles containing about 280 elements. How to I highlight the X point on the line in c#. I appreciate the work JuanC. just incase you want to see whats going on I've attached the following ChartFX.WPF.SeriesAttributes series1 = new ChartFX.WPF.SeriesAttributes();ChartFX.WPF.SeriesAttributes series2 = new ChartFX.WPF.SeriesAttributes(); series1.ItemsSource = m_smartBus1[region].VLOADARRAY; series2.ItemsSource = m_smartBus2[region].VLOADARRAY;series1.Gallery = ChartFX.WPF.Gallery.Line; series2.Gallery = ChartFX.WPF. Gallery.Line;series1.Fill = System.Windows.Media.Brushes.Blue; series2.Fill = System.Windows.Media. Brushes.OrangeRed;series1.Content = "Vload vs Ref Curve 1st Dir"; series2.Content = "Vload vs Ref Curve 2nd Dir";series1.PointLabels.Visibility = System.Windows.Visibility.Hidden; series2.PointLabels.Visibility = System.Windows. Visibility.Hidden;chartfxVloadVsRef0 = new ChartFX.WPF.Chart(); vloadvsRefElemHost0.Child = chartfxVloadVsRef0;chartfxVloadVsRef0.AxisY = new ChartFX.WPF.Axis();chartfxVloadVsRef0.AxisY.ForceZero = false; chartfxVloadVsRef0.Series.Add(series1); chartfxVloadVsRef0.Series.Add(series2); Quote Link to comment Share on other sites More sharing options...
juanZ Posted October 22, 2009 Report Share Posted October 22, 2009 Hi, I found an interesting class (Effects) that can help you. Please look at the following code snippet: LighterEffect myEffect = new LighterEffect(); myEffect.Change = 80; chart1.Highlight.Mode = HighlightMode.Point; chart1.Highlight.IsEnabled = true; chart1.Points[0].Effects.Add(myEffect); This will highlight point [0] of the Chart. You can also set the HighlightMode to Series. This does not puts a marker shape on the chart, but it does hightlight an specific point on the chart Hope this helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.