【发布时间】: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 轴,因为某些折线图仅显示为水平线,而不是整个高度的图。
您好, 凯皮戈特
【问题讨论】: