Man*_*ete 4 c# wpf charts wpftoolkit
有没有办法在图表上标记轴?
<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>
Run Code Online (Sandbox Code Playgroud)
我已设法使用标记Y轴
<charting:Chart.Axes>
<charting:LinearAxis Orientation="Y" Minimum="0" Title="Number of Alerts" Margin="0,0,10,0" />
</charting:Chart.Axes>
Run Code Online (Sandbox Code Playgroud)
但是,如果我想标记X轴,它会出现在图表的顶部.我只是希望能够像"时间"和"事件"那样在轴上键入一些图例,但我找不到合适的方法来做到这一点.
如果我在X轴上执行相同操作,则图例和值将显示在图表的顶部.

当X轴的代码被引入时:
<charting:Chart.Axes>
<charting:LinearAxis Orientation="Y" Minimum="0" Title="Number of Alerts"
Run Code Online (Sandbox Code Playgroud)

不确定我是否有问题,但如果您想显示自定义内容而不是Axes,您可以通过以下方式执行此操作:
<!-- TODO: Define own custom templates for
YAxisTitleContentTemplate and XAxisTitleContentTemplate
-->
<charting:Chart.Axes>
<charting:LinearAxis Orientation="Y">
<charting:LinearAxis.Title>
<ContentControl
ContentTemplate="{StaticResource YAxisTitleContentTemplate}"/>
</charting:LinearAxis.Title>
</charting:LinearAxis>
<charting:CategoryAxis Orientation="X">
<charting:CategoryAxis.Title>
<ContentControl
ContentTemplate="{StaticResource XAxisTitleContentTemplate}"/>
</charting:CategoryAxis.Title>
</charting:CategoryAxis>
</charting:Chart.Axes>
Run Code Online (Sandbox Code Playgroud)
编辑:仅限X轴的标题
<charting:Chart.Axes>
<charting:CategoryAxis Orientation="X" Title="The X Axis Title" />
</charting:Chart.Axes>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8442 次 |
| 最近记录: |