【问题标题】:Dynamic Data Display with multiple Y-axis多 Y 轴动态数据显示
【发布时间】:2017-07-13 19:09:54
【问题描述】:

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

我正在使用 ObservableDataSource 作为我的值。

我的 XAML 代码:

<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>

我的代码在 y2 绘图仪中添加了一个折线图

var data = new ObservableDataSource<Point>();

for (int i = 0; i < xvalues.Count(); i++)
{
data.Collection.Add(new Point(Convert.ToDouble(xvalues[i].Replace('.', ','), new CultureInfo("de-DE")) + xoffset, Convert.ToDouble(yaxes4Values[i].Replace('.', ','), new CultureInfo("de-DE"))));
}

LineGraph line = new LineGraph(data);
this.y2.Children.Add(line);

图片:Several line graphs with 4 y-axes

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

您好, 凯皮戈特

【问题讨论】:

    标签: c# wpf charts


    【解决方案1】:

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

    您好, 凯皮戈特

    【讨论】:

      猜你喜欢
      • 2017-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-08
      • 1970-01-01
      • 2014-11-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多