0

1)我希望在 LiveCharts 中显示轴部分的工具提示,但似乎无法弄清楚如何做到这一点。下面是我当前使用 LiveCharts 的代码。

        <Grid Grid.Column="1" Margin="15, 15, 15, 15" MaxHeight="500">
        <Grid.OpacityMask>
            <VisualBrush Visual="{Binding ElementName=Border}" />
        </Grid.OpacityMask>
        <Grid.Resources>
            <Style TargetType="lvc:LineSeries">
                <Setter Property="Stroke" Value="Black"/>
                <Setter Property="LineSmoothness" Value="0"/>
                <Setter Property="Fill" Value="Transparent"/>
                <Setter Property="PointForeground" Value="White"/>
            </Style>
            <Style TargetType="lvc:Axis">
                <Setter Property="ShowLabels" Value="True"/>
                <Setter Property="Foreground" Value="White"/>
            </Style>
            <Style TargetType="lvc:Separator">
                <Setter Property="Stroke" Value="DimGray"/>
                <Setter Property="StrokeDashArray" Value="2"/>
                <Setter Property="IsEnabled" Value="True"/>
            </Style>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <Border x:Name="Border" Grid.Row="0" Grid.RowSpan="3" CornerRadius="5" Background="Gray"/>
        <TextBlock Grid.Row="0" TextAlignment="Center" Padding="10, 10, 0, 5" Foreground="Black" FontSize="24" FontWeight="Bold">
                Process Capability
        </TextBlock>
        <TextBlock Grid.Row="1" TextAlignment="Center" Foreground="Black" Padding="0,0,0,20">Sample Values</TextBlock>
        <lvc:CartesianChart Series="{Binding SeriesCollection}" Grid.Row="2" Margin="0, 0, 0, 0" Foreground="Black" Zoom="X">
            <lvc:CartesianChart.AxisY>
                <lvc:Axis Name="Y" MinValue="{Binding MinimumY}" MaxValue="{Binding MaximumY}" LabelFormatter="{Binding Formatter}">
                    <lvc:Axis.Sections>
                        <lvc:AxisSection Value="{Binding LowerSpecificationLimit}" StrokeThickness="3" Stroke="Black" DataLabel="True" ToolTip="HELLOOOO" Panel.ZIndex="99"/>
                        <lvc:AxisSection Value="{Binding UpperSpecificationLimit}" StrokeThickness="3" Stroke="Black" DataLabel="True" ToolTip="{Binding LowerSpecificationLimitToolTip}"/>
                        <lvc:AxisSection Value="{Binding NominalConstraint}" StrokeThickness="1.5" Stroke="DarkGray" DataLabel="True" StrokeDashArray="5" ToolTip="{Binding LowerSpecificationLimitToolTip}"/>
                        <lvc:AxisSection Value="{Binding LowerTolerance}" StrokeThickness="1.5" Stroke="DarkGray" DataLabel="True" StrokeDashArray="5" ToolTip="{Binding LowerSpecificationLimitToolTip}"/>
                        <lvc:AxisSection Value="{Binding UpperTolerance}" StrokeThickness="1.5" Stroke="DarkGray" DataLabel="True" StrokeDashArray="5" ToolTip="{Binding LowerSpecificationLimitToolTip}"/>
                    </lvc:Axis.Sections>
                </lvc:Axis>
            </lvc:CartesianChart.AxisY>
        </lvc:CartesianChart>
    </Grid>

2) 我还希望能够更改 DataLabel 的位置。在下图中,您可以看到轴部分数据标签与常规轴的数据标签重叠。为了阻止它重叠,我想将轴部分的数据标签放置在图表的右侧而不是左侧。 图片

任何帮助表示赞赏。谢谢你。

4

1 回答 1

1

对于第二个问题,使用合并轴可能会有所帮助。(将Axis.IsMerged属性设置为true。)

参考:https ://lvcharts.net/App/examples/v1/wpf/Axes

于 2017-07-28T06:21:20.573 回答