Remarks: We used D3 in Version 0.3.4703.0 (maybe it's fixed now?)
@Sss: We finally used D3's InjectedPlotter:
<d3:InjectedPlotter x:Name="InnerPlotter" SetViewportBinding="False">
<d3:VerticalAxis Placement="Right"/>
<d3:VerticalAxisTitle Content="Qualitaet" Placement="Right"/>
</d3:InjectedPlotter>
<d3:AxisNavigation Placement="Bottom"/>
<d3:AxisNavigation Placement="Right"/>
<d3:VerticalAxisTitle Content="Werte" Placement="Left"/>
<d3:HorizontalAxisTitle Content="Zeitpunkte" Placement="Bottom"/>
As one can see we used the x:Name
-Tag. That's because we had to use Code-Behind to achieve what we needed:
private void OnViewLoaded(object sender, RoutedEventArgs e)
{
// Passing Plotter to ViewModel
ViewModel.InnerPlotter = InnerPlotter;
Plotter.Viewport.PropertyChanged += Viewport_PropertyChanged;
}
private void Viewport_PropertyChanged(object sender, ExtendedPropertyChangedEventArgs e)
{
// Update Viewport of Inner Plotter
InnerPlotter.Viewport.Visible = new DataRect(
Plotter.Viewport.Visible.XMin,
InnerPlotter.Viewport.Visible.YMin,
Plotter.Viewport.Visible.Width,
InnerPlotter.Viewport.Visible.Height
);
}
By passing the InnerPlotter
to the ViewModel we violated the concept of MVVM. But after trying a lot we had no other solution than this.
In our ViewModel we manually add the needed Graphs to the InnerPlotter:
InnerPlotter.AddLineGraph(
compositeDataSource,
new Pen(lineBrush, 2),
desc));
Update 1:
I had a look in the documentation of D3 (http://research.microsoft.com/en-us/um/cambridge/groups/science/tools/d3/D3Overview.pdf)
There on page 8 they describe how to do plot composition:
<d3:Chart>
<d3:Plot>
<d3:ErrorBarGraph ... />
<d3:CircleMarkerGraph ... />
</d3:Plot>
</d3:Chart>
Where on page 9 they describe how to add multiple child plots:
<d3:Chart>
<Grid>
<d3:ErrorBarGraph ... />
<d3:CircleMarkerGraph ... />
</Grid>
</d3:Chart>
I hope this will help.