无法使Telerik Legend使用条形图

时间:2018-03-09 14:50:39

标签: uwp telerik

我无法让我的图例显示标签以外的任何内容。它不会显示颜色形状。堆积条形图可以正确显示。你能看看我的XAML代码,告诉我我做错了什么吗?我对此进行了广泛的研究,我的代码似乎与我在网上找到的例子相符。感谢。

        <telerikPrimitives:RadLegendControl LegendProvider="{Binding ElementName=BarChart}"                                           
                                        x:Name="legend"
                                        RelativePanel.Below="BarChart"
                                        RelativePanel.AlignLeftWithPanel="True">
                <telerikPrimitives:RadLegendControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal">
                        </StackPanel>
                    </ItemsPanelTemplate>
                </telerikPrimitives:RadLegendControl.ItemsPanel>
            </telerikPrimitives:RadLegendControl>

            <telerikChart:RadCartesianChart Name="BarChart" PaletteName="DefaultDark"  RelativePanel.Below="pieChart" Width="400" Height="400">
                <telerikChart:RadCartesianChart.HorizontalAxis>
                    <telerikChart:CategoricalAxis />
                </telerikChart:RadCartesianChart.HorizontalAxis>
                <telerikChart:RadCartesianChart.VerticalAxis>
                    <telerikChart:LinearAxis />
                </telerikChart:RadCartesianChart.VerticalAxis>
                <telerikChart:RadCartesianChart.Grid>
                    <telerikChart:CartesianChartGrid MajorLinesVisibility="Y" StripLinesVisibility="Y" />
                </telerikChart:RadCartesianChart.Grid>
                <telerikChart:BarSeries ItemsSource="{Binding MyData, Mode=TwoWay}" CombineMode="Stack" LegendTitle="Ready" IsVisibleInLegend="True">
                    <telerikChart:BarSeries.ValueBinding>
                        <telerikChart:PropertyNameDataPointBinding PropertyName="Value"/>
                    </telerikChart:BarSeries.ValueBinding>
                    <telerikChart:BarSeries.CategoryBinding>
                        <telerikChart:PropertyNameDataPointBinding PropertyName="Evaluator"/>
                    </telerikChart:BarSeries.CategoryBinding>
                </telerikChart:BarSeries>
                <telerikChart:BarSeries ItemsSource="{Binding MyData2, Mode=TwoWay}" CombineMode="Stack" LegendTitle="Not Ready" IsVisibleInLegend="True">
                    <telerikChart:BarSeries.ValueBinding>
                        <telerikChart:PropertyNameDataPointBinding PropertyName="Value"/>
                    </telerikChart:BarSeries.ValueBinding>
                    <telerikChart:BarSeries.CategoryBinding>
                        <telerikChart:PropertyNameDataPointBinding PropertyName="Evaluator"/>
                    </telerikChart:BarSeries.CategoryBinding>
                </telerikChart:BarSeries>
            </telerikChart:RadCartesianChart>

1 个答案:

答案 0 :(得分:0)

我可以在UWP应用中重现您的问题。通过测试,如果您正在使用其他系列,例如PointSeriesAreaSeries,则图例控件将运行良好,只有BarSeries有问题。因此,您的上述代码应该没有任何问题,这可能是由于包的错误或不支持造成的。您可以打开一个新问题here

作为一种解决方法,您可以在未绑定模式下使用图例控件。有关示例,请参考this以完成图例项目的自定义。