Legend shows invisible graphs

Dec 13, 2010 at 7:55 PM

I have noticed a little bug with the legend. If you add some lines in invisible mode they are shown in the legend anyway. In my case there is the following scenario.


TimeChartPlotter Plotter = new TimeChartPlotter();

// some code

((LineGraph)Plotter.Children[0]).Visibility = System.Windows.Visibility.Hidden; 
// for updating the legend I use - havent found anything better so far



In my opinion the first graph should now not be visible on the legend. I think this issue should be easy to fix. It would be great if you could fix it ;)

One approach would be something like this:


public void PopulateLegend() // in Legend.cs

	if (!LegendVisible) return;
	if (plotter == null) return;

	foreach (var chart in plotter.Children.OfType<DependencyObject>())
		var legendItemsBuilder = Legend.GetLegendItemsBuilder(chart);
						// the && ... is the new part
		if (legendItemsBuilder != null && (chart is UIElement) ? ((UIElement)chart).Visibility == System.Windows.Visibility.Visible :true)
			foreach (var legendItem in legendItemsBuilder((IPlotterElement)chart))




Dec 20, 2010 at 12:28 PM
can you please add a issue for me here - http://d3future.codeplex.com/workitem/list/basic
Best regards,
Mikhail Brinchuk,
My freelance CV - searching for remote work