WPF Toolkit 图表中具有相同 Y 轴的两个 LineSeries
我想对 WPF 工具包图表执行以下操作:
我有两个线系列,它们应该使用相同的 y 轴(即我希望它们都具有相同的比例)。我可以给它们每个相同的轴定义,这样它们就会重叠(然后其中一个具有折叠的可见性),但这不是我的最佳选择。
这就是我正在讨论的解决方案:
<charts:LineSeries Name="ExternalMeasureSeries"
IndependentValueBinding="{Binding Time}"
DependentValueBinding="{Binding ExternalMeasure}">
<charts:LineSeries.DataPointStyle>
<Style TargetType="charts:LineDataPoint">
<Setter Property="Background" Value="Red"/>
<Setter Property="Opacity" Value="0" />
</Style>
</charts:LineSeries.DataPointStyle>
<!-- Vertical axis for external measure curve -->
<charts:LineSeries.DependentRangeAxis>
<charts:LinearAxis
Orientation="Y"
Title="Measurement"
Minimum="0"
Maximum="30"/>
</charts:LineSeries.DependentRangeAxis>
</charts:LineSeries>
<charts:LineSeries Name="InternalMeasureSeries"
IndependentValueBinding="{Binding Time}"
DependentValueBinding="{Binding InternalMeasure}">
<charts:LineSeries.DataPointStyle>
<Style TargetType="charts:LineDataPoint">
<Setter Property="Background" Value="Orange"/>
<Setter Property="Opacity" Value="0" />
</Style>
</charts:LineSeries.DataPointStyle>
<!-- Vertical axis for internal measure curve -->
<charts:LineSeries.DependentRangeAxis>
<charts:LinearAxis
Orientation="Y"
Minimum="0"
Maximum="30"
Visibility="Collapsed"/>
</charts:LineSeries.DependentRangeAxis>
</charts:LineSeries>
是否有一种方法可以定义多个具有相同 Y 轴的系列?
我发现工具包版本 3.5.0.0 有一个名为 StackedLineSeries
的东西,但 2010 年 2 月版本的工具包中安装的版本 3.5.40128.1 并不存在。它是否移动到另一个 clr 命名空间?
I want to do the following with the WPF toolkit charts:
I have two line series that should use the same y axis (i.e I want them both to be on the same scale). I could give each of them the same axis definition so they would overlap (and then have one of them with collapsed visibility), but that is not my best choice.
This is the solution I'm talking about:
<charts:LineSeries Name="ExternalMeasureSeries"
IndependentValueBinding="{Binding Time}"
DependentValueBinding="{Binding ExternalMeasure}">
<charts:LineSeries.DataPointStyle>
<Style TargetType="charts:LineDataPoint">
<Setter Property="Background" Value="Red"/>
<Setter Property="Opacity" Value="0" />
</Style>
</charts:LineSeries.DataPointStyle>
<!-- Vertical axis for external measure curve -->
<charts:LineSeries.DependentRangeAxis>
<charts:LinearAxis
Orientation="Y"
Title="Measurement"
Minimum="0"
Maximum="30"/>
</charts:LineSeries.DependentRangeAxis>
</charts:LineSeries>
<charts:LineSeries Name="InternalMeasureSeries"
IndependentValueBinding="{Binding Time}"
DependentValueBinding="{Binding InternalMeasure}">
<charts:LineSeries.DataPointStyle>
<Style TargetType="charts:LineDataPoint">
<Setter Property="Background" Value="Orange"/>
<Setter Property="Opacity" Value="0" />
</Style>
</charts:LineSeries.DataPointStyle>
<!-- Vertical axis for internal measure curve -->
<charts:LineSeries.DependentRangeAxis>
<charts:LinearAxis
Orientation="Y"
Minimum="0"
Maximum="30"
Visibility="Collapsed"/>
</charts:LineSeries.DependentRangeAxis>
</charts:LineSeries>
Is there a way to define more than one series with the same Y axis?
I found that toolkit version 3.5.0.0 has something called StackedLineSeries
but that version 3.5.40128.1 which is what gets installed in the February 2010 version of the toolkit, it isn't there. Did it move to another clr-namespace?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了同样的问题并找到了以下方法。您可以将两个系列添加到同一个图表中,并通过将宽度设置为 0 来隐藏第二个系列的轴标签;
希望这有帮助
I faced the same issue and found the following way around. You can add the two series to the same chart and hide the second series Axis label by setting the Width to 0;
Hope this helps
我有一个包含 3 条线系列的图表。前两个系列代表相对湿度,第三个系列代表露点。
我想在同一 Y 轴上绘制前 2 个系列。我在资源部分创建了我的轴。在我的示例中,它位于
TabItem
中。I have a chart with 3 line series. The first 2 series represent the relative humidity and the third one represent the dew point.
I want to draw the first 2 series on the same Y axis. I created my axes in a resource section. In my example, this is in a
TabItem
.