2017-05-29 2 views
0

私はBarシリーズのRadCartesianチャートを持っていますが、各バーの値は2つの値からのパーセンテージです。この値が98%未満であれば、バーの色を赤に変更する必要があります値が97%を超えると、バーの色を緑色に変えますが、私が見たすべてのものがセリのすべてのバーの色を変更し、バーが私のゴールのパーセンテージ未満になると、誰かがこの問題を助けることができますか?Telerik RadCartesianChart BarSeries Style

答えて

0

これは、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; 
     } 

アンデ設定の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]) 
       }); 
パラメータ