图表工具包 WPF 上的标签
有没有办法在图表上标记轴?
<charting:Chart Name="EventAlertsChart" BorderThickness="0" Margin="0,10,0,0">
<charting:Chart.Axes>
<charting:LinearAxis Orientation="Y" Minimum="0" Title="Number of Alerts" Margin="0,0,10,0" />
</charting:Chart.Axes>
<charting:Chart.LegendStyle>
<Style TargetType="Control">
<Setter Property="Width" Value="0" />
<Setter Property="Height" Value="0" />
</Style>
</charting:Chart.LegendStyle>
<charting:Chart.Series>
<charting:ColumnSeries Name="LineSeriesBWSrc" ItemsSource="{Binding AlertPoints,UpdateSourceTrigger=PropertyChanged}"
IndependentValueBinding="{Binding Path=Key}" DependentValueBinding="{Binding Path=Value}" Title="Alerts" Background="Maroon" >
<charting:ColumnSeries.DataPointStyle>
<Style TargetType="charting:ColumnDataPoint">
<Setter Property="Background" Value="Crimson" />
</Style>
</charting:ColumnSeries.DataPointStyle>
</charting:ColumnSeries>
</charting:Chart.Series>
</charting:Chart>
我已经设法使用标记 Y 轴
<charting:Chart.Axes>
<charting:LinearAxis Orientation="Y" Minimum="0" Title="Number of Alerts" Margin="0,0,10,0" />
</charting:Chart.Axes>
,但是如果我想标记 X 轴,它会显示在图表的顶部。我只想能够在轴上输入一些图例,例如“时间”和“事件”,但我找不到正确的方法来做到这一点。
如果我在 X 轴上执行相同的操作,则图例和值将显示在图表的顶部。
当 X 轴的代码引入为:
<charting:Chart.Axes>
<charting:LinearAxis Orientation="Y" Minimum="0" Title="Number of Alerts"
Is there any way to label the axis on charts?
<charting:Chart Name="EventAlertsChart" BorderThickness="0" Margin="0,10,0,0">
<charting:Chart.Axes>
<charting:LinearAxis Orientation="Y" Minimum="0" Title="Number of Alerts" Margin="0,0,10,0" />
</charting:Chart.Axes>
<charting:Chart.LegendStyle>
<Style TargetType="Control">
<Setter Property="Width" Value="0" />
<Setter Property="Height" Value="0" />
</Style>
</charting:Chart.LegendStyle>
<charting:Chart.Series>
<charting:ColumnSeries Name="LineSeriesBWSrc" ItemsSource="{Binding AlertPoints,UpdateSourceTrigger=PropertyChanged}"
IndependentValueBinding="{Binding Path=Key}" DependentValueBinding="{Binding Path=Value}" Title="Alerts" Background="Maroon" >
<charting:ColumnSeries.DataPointStyle>
<Style TargetType="charting:ColumnDataPoint">
<Setter Property="Background" Value="Crimson" />
</Style>
</charting:ColumnSeries.DataPointStyle>
</charting:ColumnSeries>
</charting:Chart.Series>
</charting:Chart>
I've managed to label the Y axis using
<charting:Chart.Axes>
<charting:LinearAxis Orientation="Y" Minimum="0" Title="Number of Alerts" Margin="0,0,10,0" />
</charting:Chart.Axes>
however if I want to label the X axis it appears on the top of the chart. I just want to be able to type some legends on the axis like "Time" and "Events" but I cannot find a proper way to do it.
If I do the same on the X axis, then the legend and the values go to the top of the chart.
When the code for X axis is introduced as:
<charting:Chart.Axes>
<charting:LinearAxis Orientation="Y" Minimum="0" Title="Number of Alerts"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定我的问题是否正确,但如果您想显示自定义内容来代替轴,您可以通过以下方式执行此操作:
编辑:仅 X 轴的标题
Not sure I got question right but if you want to show custom content in place of the Axes you can do it in the following way:
EDIT: Title for the X Axis only