2011-12-22 2 views
5

Telerik Kendo Pie Chart를 사용하고 있으며 웨지에 색을 칠할 수 있기를 원합니다. 색상을 지정하는 방법 Telerik Kendo UI 원형 차트 쐐기?

다음

내 검도 UI 원형 차트의 마크 업입니다 :

<script type="text/javascript"> 
function createChart() { 
    jQuery("#chart").kendoChart({ 
     theme: jQuery(document).data("kendoSkin") || "Metro", 
     legend: { 
      position: "bottom" 
     }, 
     seriesDefaults: { 
      labels: { 
       visible: true, 
       format: "{0}%" 
      } 
     }, 

     series: [{ 
      type: "pie", 
      data: [{ 
       category: "Remaining Work", 
       value: 75, 
       explode: true 
      }, { 
       category: "CIOs", 
       value: 2 
      }, { 
       category: "Other Executives", 
       value: 10 
      }, { 
       category: "Directors and Physicians", 
       value: 13 
      }] 
     }], 
     tooltip: { 
      visible: true, 
      format: "{0}%" 
     } 
    }); 
} 

jQuery(document).ready(function() { 
    setTimeout(function() { 
     createChart(); 

     // Initialize the chart with a delay to make sure 
     // the initial animation is visible 
    }, 400); 

    jQuery(document).bind("kendo:skinChange", function (e) { 
     createChart(); 
    }); 
}); 
</script> 

내가 남은 작업은 밝은 회색 싶습니다. 어떻게해야합니까?

의견을 보내 주시면 감사하겠습니다.

답변

18

Kendo UI DataViz에서 모든 차트는 seriesColors option을 통해 테마 색보다 우선합니다. 이 속성은 16 진수 색상 문자열 배열을 사용합니다. 예 :

$("#chart").kendoChart({ 
    ... 
    seriesColors: ["#7c7c7c", ... ] 
}); 
0
it is an implementation from server side would be very interesting on the concept of avoiding Similar shades..please look in to the below code which iam inserting to bind the pie chart with colors 
If Not radChart Is Nothing Then 
        radChart.PlotArea.EmptySeriesMessage.TextBlock.Text = strNoData 
        radChart.SkinsOverrideStyles = False 
        Dim seriesColors As Color() = {Color.Aqua, Color.Bisque, Color.Chartreuse, Color.Coral, Color.DarkCyan, Color.DarkKhaki, Color.DimGray, Color.Yellow, Color.LightGreen, Color.Magenta, Color.Orange, Color.Purple, Color.SaddleBrown, Color.Silver, Color.WhiteSmoke, Color.Violet, Color.RosyBrown, Color.Olive, Color.Navy, Color.IndianRed} 
        Dim seriesPalette As New Palette("seriesPalette", seriesColors, True) 
        radChart.CustomPalettes.Add(seriesPalette) 
        radChart.SeriesPalette = "seriesPalette" 
        radChart.DataBind() 
       End If