【问题标题】:Can't Get Telerik Legend to work with Bar Chart无法让 Telerik Legend 与条形图一起使用
【发布时间】:2018-03-09 14:50:38
【问题描述】:

我无法让我的图例显示标签以外的任何内容。它不会显示颜色形状。堆积条形图确实显示正确。您能否看看我的 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>

【问题讨论】:

    标签: uwp telerik


    【解决方案1】:

    我可以在 UWP 应用中重现您的问题。通过我这边的测试,如果你用的是其他系列,比如PointSeries或者AreaSeries,图例控件可以正常工作,只有BarSeries有问题。所以你上面的代码应该没有问题,这可能是由于包有问题或不支持造成的。您可以打开一个新问题here

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

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-02
    • 2014-10-31
    • 2018-01-02
    • 2016-11-14
    • 2015-02-01
    • 2019-05-10
    相关资源
    最近更新 更多