具有多个Y轴的动态数据显示

时间:2017-07-11 11:07:18

标签: c# wpf charts

我必须在一个图中显示几个折线图。由于Y范围值差异很大,我想为每条线指定一个特定的y轴。我已经发现我可以通过使用InjectionPlooter并为它们分配线图来实现这一点,但每个y轴的比例是相同的。

我正在为我的值使用ObservableDataSource。

我的XAML代码:

controller...
$document_type = CompanyTypesDocumentTypes::where('company_type_id',$company->company_type_id)->with('document_type')->where('is_default',true)->first();

view...
{{ $document_type->name }}

我的代码背后有一个线图添加到y2-plotter

<d3:ChartPlotter x:Name="Plotter" Height="400" Grid.Row="1">
    <d3:InjectedPlotter Name="y2" Background="Aqua">
        <d3:VerticalAxis Placement="Left"/>
        <d3:VerticalAxisTitle Content="y2" Placement="Left" />
    </d3:InjectedPlotter>
    <d3:InjectedPlotter Name="y3" Background="Aqua">
        <d3:VerticalAxis Placement="Left"/>
        <d3:VerticalAxisTitle Content="y3" Placement="Left"/>
    </d3:InjectedPlotter>
    <d3:InjectedPlotter Name="y4" Background="Aqua">
        <d3:VerticalAxis Placement="Left"/>
        <d3:VerticalAxisTitle Content="y4" Placement="Left"/>
    </d3:InjectedPlotter>
</d3:ChartPlotter>

图片:Several line graphs with 4 y-axes

我真的希望有人可以帮助我缩放Y轴,因为有些线图只显示为水平线而不是整个高度的图形。

问候, Caipigott

1 个答案:

答案 0 :(得分:0)

我终于找到了解决方案。我发现使用的d3版本是V0.4,它是DynamicDataDisplay项目的新Future(d3future)。 D3.Current解决方案内部是一个非常好的样本,名为TwoIndependentAxes。

问候, Caipigott