0

这是我用于图表的代码,一切正常,但是当我添加 LineSeries.ToolTip 标记时出现此错误: xml 命名空间http://schemas.infragistics.com中不存在标记 LineSeries.ToolTip /xaml

<ig:XamDataChart Name="Datachar" VerticalZoomable="True" HorizontalZoomable="True" Width="550" Height="220">
                                <ig:XamDataChart.Axes>
                                    <ig:CategoryXAxis x:Name="xAxis" ItemsSource="{Binding Data}" Label="{}{Date:MM/yyyy}">
                                        <ig:CategoryXAxis.LabelSettings>
                                            <ig:AxisLabelSettings Location="OutsideTop" Extent="45" VerticalAlignment="Center" Visibility="Visible" />
                                        </ig:CategoryXAxis.LabelSettings>
                                    </ig:CategoryXAxis>
                                    <ig:NumericYAxis x:Name="yAxis">
                                        <ig:NumericYAxis.LabelSettings>
                                            <ig:AxisLabelSettings Location="OutsideLeft" Extent="50" VerticalAlignment="Center" Visibility="Visible"/>
                                        </ig:NumericYAxis.LabelSettings>
                                    </ig:NumericYAxis>
                                </ig:XamDataChart.Axes>

                                <ig:XamDataChart.Series>
                                    <ig:LineSeries ItemsSource="{Binding Data}" XAxis="{Binding ElementName=xAxis}" YAxis="{Binding ElementName=yAxis}" ValueMemberPath="Value" Thickness="1" MarkerType="None"/>
                                    <ig:LineSeries ItemsSource="{Binding Index}" XAxis="{Binding ElementName=xAxis}" YAxis="{Binding ElementName=yAxis}" ValueMemberPath="Value" Thickness="1" MarkerType="None"/>
                                    <ig:LineSeries.ToolTip>
                                        <StackPanel>
                                            <StackPanel Orientation="Horizontal">
                                                <TextBlock Margin="2" Text="Value" VerticalAlignment="Center"></TextBlock>
                                                <TextBlock Margin="2" Text="{Binding Item.Value, StringFormat='0,0'}" VerticalAlignment="Center" />
                                            </StackPanel>
                                        </StackPanel>
                                    </ig:LineSeries.ToolTip>
                                </ig:XamDataChart.Series>
                            </ig:XamDataChart>
4

1 回答 1

1

在您定义工具提示的 XAML 中存在错误。具体应该是元素的子元素,目前不是。更新的标记:

<ig:XamDataChart Name="Datachar" VerticalZoomable="True" HorizontalZoomable="True" Width="550" Height="220">
    <ig:XamDataChart.Axes>
        <ig:CategoryXAxis x:Name="xAxis" ItemsSource="{Binding Data}" Label="{}{Date:MM/yyyy}">
            <ig:CategoryXAxis.LabelSettings>
                <ig:AxisLabelSettings Location="OutsideTop" Extent="45" VerticalAlignment="Center" Visibility="Visible" />
            </ig:CategoryXAxis.LabelSettings>
        </ig:CategoryXAxis>
        <ig:NumericYAxis x:Name="yAxis">
            <ig:NumericYAxis.LabelSettings>
                <ig:AxisLabelSettings Location="OutsideLeft" Extent="50" VerticalAlignment="Center" Visibility="Visible"/>
            </ig:NumericYAxis.LabelSettings>
        </ig:NumericYAxis>
    </ig:XamDataChart.Axes>

    <ig:XamDataChart.Series>
        <ig:LineSeries ItemsSource="{Binding Data}" XAxis="{Binding ElementName=xAxis}" YAxis="{Binding ElementName=yAxis}" ValueMemberPath="Value" Thickness="1" MarkerType="None"/>
        <ig:LineSeries ItemsSource="{Binding Index}" XAxis="{Binding ElementName=xAxis}" YAxis="{Binding ElementName=yAxis}" ValueMemberPath="Value" Thickness="1" MarkerType="None">
        <ig:LineSeries.ToolTip>
            <StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Margin="2" Text="Value" VerticalAlignment="Center"></TextBlock>
                    <TextBlock Margin="2" Text="{Binding Item.Value, StringFormat='0,0'}" VerticalAlignment="Center" />
                </StackPanel>
            </StackPanel>
        </ig:LineSeries.ToolTip>
            </ig:LineSeries>
    </ig:XamDataChart.Series>
</ig:XamDataChart>

我所做的更改是将第二个系列元素的结尾更改为以“>”而不是“/>”结尾,并在工具提示之后添加了结束标记。

于 2013-03-18T23:19:35.113 回答