Coder Posted January 5, 2010 Report Share Posted January 5, 2010 I have version 8.0.3629.29517. When I try to set the StrokeThickness for my series and... 1) the LegendBox is displayed and2) the marker visibility is Hidden or Collapsed, it ignores my setting. If I make the markers visible, but set the opacity to 0.0, then the legend doesn't display the line marker or color. If I set the marker size to 0.0, then the legend displays the lines would-be colored marker UNLESS there is another series on the same chart which displays its marker normally. Then the legend doesn't display the line marker or color again. Your help fixing this is greatly appreciated! Here is an example where the two charts are identical except for the LegendBox visibility. The StrokeThickness setting is ignored on the second chart. DataPoint[] dummyData = { new DataPoint(new DateTime(2009, 1, 1), 50.0), new DataPoint(new DateTime(2009, 2, 1), 150.0), new DataPoint(new DateTime(2009, 3, 1), 100.0), new DataPoint(new DateTime(2009, 4, 1), 25.0), new DataPoint(new DateTime(2009, 5, 1), 75.0), new DataPoint(new DateTime(2009, 6, 1), 50.0), };TabControl tc = new TabControl();TabItem tab1 = new TabItem();TabItem tab2 = new TabItem();Chart chart1 = new Chart();Chart chart2 = new Chart();tab1.Header = "Chart 1";tab2.Header = "Chart 2";chart1.AxesX.Clear();chart1.AxesY.Clear();chart2.AxesX.Clear();chart2.AxesY.Clear();chart1.LegendBox.Visibility = Visibility.Collapsed;Axis axisX = new Axis();Axis axisY = new Axis();axisX.DataFormat.Format = AxisFormat.Date;axisX.Labels.Format = AxisFormat.Date;axisX.Min = new DateTime(2008, 12, 1);axisX.Max = new DateTime(2009, 7, 1);axisY.Min = 0.0;axisY.Max = 200.0;axisY.AxisStyle = AxisStyles.ShowEnds | AxisStyles.AutoFirstLabel;chart1.AxesX.Add(axisX);chart1.AxesY.Add(axisY);SeriesAttributes sa = new SeriesAttributes();sa.Gallery = Gallery.Line;sa.StrokeThickness = 10.0;sa.Marker.Visibility = Visibility.Hidden;sa.ItemsSource = dummyData;sa.BindingPath = "Value";sa.BindingPathX = "Date";sa.AxisX = axisX;sa.AxisY = axisY;chart1.Series.Add(sa);axisX = new Axis();axisY = new Axis();axisX.DataFormat.Format = AxisFormat.Date;axisX.Labels.Format = AxisFormat.Date;axisX.Min = new DateTime(2008, 12, 1);axisX.Max = new DateTime(2009, 7, 1);axisY.Min = 0.0;axisY.Max = 200.0;axisY.AxisStyle = AxisStyles.ShowEnds | AxisStyles.AutoFirstLabel;chart2.AxesX.Add(axisX);chart2.AxesY.Add(axisY);sa = new SeriesAttributes();sa.Gallery = Gallery.Line;sa.StrokeThickness = 10.0;sa.Marker.Visibility = Visibility.Hidden;sa.ItemsSource = dummyData;sa.BindingPath = "Value";sa.BindingPathX = "Date";sa.AxisX = axisX;sa.AxisY = axisY;chart2.Series.Add(sa);tab1.Content = chart1;tab2.Content = chart2;tc.Items.Add(tab1);tc.Items.Add(tab2); 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.