Telerik RadCartesianChart Bar系列样式

Telerik RadCartesianChart BarSeries Style

我在 telerik WPF 中有一个 Radcartesianchart of Bar Series,每个 Bar 的值是两个值的百分比,如果这个值小于 98%,我需要将 bar 颜色更改为红色,并且需要更改如果值超过 97%,则条形颜色为绿色,但我所看到的所有内容都会改变 serie 中所有条形的颜色,并且条形不会低于我的目标百分比,有人可以帮助解决这个问题吗?

我已经完成了使用 StyleSelector 到 Barseries 的工作。

public override Style SelectStyle(object item,
            DependencyObject container)
        {
            if (SetColor)
            {
                Style st = new Style();
                var _item = (item as CategoricalDataPoint);
                st.TargetType = typeof(Border);
                Setter backGroundSetter = new Setter();
                backGroundSetter.Property = Border.BackgroundProperty;

                if (_item.Value < 98)
                {
                    backGroundSetter.Value = Brushes.Red;
                }
                else
                {
                    backGroundSetter.Value = Brushes.Lime;
                }
                st.Setters.Add(backGroundSetter);
                return st;
            }
            else
                return null;
        }

Ande 在 Barseries 参数中设置这个

RadChart.Series.Add(new BarSeries()
                {
                    ShowLabels = true,
                    ClipToPlotArea = true,
                    DefaultVisualStyleSelector = editor.selector,
                    ItemsSource = editor.ItemSourceOptions[i],
                    ValueBinding = new PropertyNameDataPointBinding(editor.SeriesItemsNames[i]),
                    CategoryBinding = new PropertyNameDataPointBinding(editor.CategoryNames[i])
                });