2014-06-16 22 views
0

我已经阅读了太多材料,并在过去一周尝试了很多东西,而且我没有得到任何解决办法。使用动态数据显示器(D3)生成具有多个Y轴的图形

我有如下定义具有复选框主窗口MainWindowView

<CheckBox IsChecked="{Binding Path=ocv_checkbox, Mode=TwoWay}" Margin="0, 0, 0, 2" Content="OCV"/> 
<CheckBox IsChecked="{Binding Path=battery_temperature_checkbox, Mode=TwoWay}" Margin="0, 0, 0, 2" Content="Battery Temperture"/> 
<CheckBox IsChecked="{Binding Path=slope_checkbox, Mode=TwoWay}" Margin="0, 0, 0, 2" Content="Slope"/> 

根据该复选框被选中,我希望当用户点击一个Button绘制在图上的线。 我想要上的所有行都是相同的图。

问题是,根据点击的框,我可能需要一个额外的轴来绘制。例如,如果我有3个复选框1 2和3.数字1和2的单位是英寸,复选框3的单位是加仑。如果全部3个选中,我需要一个左侧(或右侧)英寸的垂直轴和右侧的加仑轴(绘制3)。

如何以编程方式使用D3做到这一点?根本没有太多的文档,我需要在网上看到明确的答案。

目前我有:

<d3:ChartPlotter Name="plotter" Margin="10,10,20,10"> 
    <d3:ChartPlotter.HorizontalAxis> 
     <d3:HorizontalIntegerAxis Name="dateAxis"/> 
    </d3:ChartPlotter.HorizontalAxis> 
    <d3:ChartPlotter.VerticalAxis> 
     <d3:VerticalIntegerAxis Name="countAxis"/> 
    </d3:ChartPlotter.VerticalAxis> 

    <d3:Header FontFamily="Arial" Content="{Binding ElementName=ThisGraphWindowInstance, Path=title}"/> 
    <d3:VerticalAxisTitle FontFamily="Arial" Content="{Binding ElementName=ThisGraphWindowInstance, Path=yAxis}"/> 
    <d3:HorizontalAxisTitle FontFamily="Arial" Content="{Binding ElementName=ThisGraphWindowInstance, Path=xAxis}"/> 
</d3:ChartPlotter> 

在我GraphWindowView.xaml这显然只有2个轴。如果可能,我想添加一个使用代码的代码。

如果你想添加多个Y轴,去为InjectedPlotter对象谢谢你, 丰富

回答

0

。每种类型的数据(英寸,加仑...),您需要一个InjectedPlotter,您将其作为子女添加到您的海图仪。当一种数据的所有行都被禁用时(复选框未选中),只需隐藏注入的绘图仪。你必须将每一行与他正确的轴(注入绘图仪)连接起来。