I am using Microsoft's D3 with WPF (not silverlight). I am desperately looking for a version of D3 that would allow ,me to hide the legend. I found several examples online, using older versions of D3. When adding the sources of this version to my solution, I lost other functionality I was using - plotting a graph with logarithmic scales. Another version of D3 that was used in an example of a logarithmic scale did not have "hide legend" implemented yet. Apparently, the examples I've seen used different versions that are mutually exclusive. Moreover, I am not enough savvi with c# to take one version and convert it to the other.
Would you guys please please please help me and provide a solution that uses any (preferably latest) version of D3 for WPF that makes a ChartPlotter with logarithmic scale and is able to hide the legend?
Thanks
The key to this seems to be the LogarithmNumericTicksProvider class. This class alone seems to give you the functionality you need. So you could take that class and import it to the version of D3 you have that has a hiding legend working.
Your other option, would be to take the most recent stable version of D3, and fix the legend hiding in it. The solution that I found for hiding the legend does not seem to yet be implemented in the stable version, but looks very easy to.
You can add a new property to the ChartPlotter class for Legend Visibility that should hide and show your legend when setting the property. It looks like this :
class ChartPlotter {
...
public bool LegendVisible {
get { return legend.Visibility == Visibility.Visible; }
set { legend.Visibility = value ? Visibility.Visible : Visibility.Hidden; }
}
}
With this, you can set the LegendVisible property to true or false anywhere you need to in your code and it should show or hide on command. I found this solution Here
The most stable version of D3 can be found Here. This version implements the LogarithmNumericTicksProvider. This version is the most suitable to use and should be easy to implement the new property.