This is a migrated thread and some comments may be shown as answers.

Series Colors

1 Answer 765 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 21 Aug 2019, 03:29 PM

Hi,

How do we set the series colours on an AJAX MVC Bar chart.

there is an option to set the colors but doesnt seem to matter what is entered nothing works

@(Html.Kendo().Chart<CML.Models.TopRequestersSample_Result>()
    .Name("TopRequesters")
    .SeriesColors()
    .Title("Top 10 Requesters by Sample Count")
    .Legend(legend => legend.Position(ChartLegendPosition.Bottom))
    .DataSource(ds => ds.Read(read => read.Action( "GetTopRequesters","Dash" ) ))
    .Series( s => { s.Bar( a => a.Total ); } )
    .CategoryAxis(ca => {
        ca
   .Categories( a => a.DisplayName )
   .Name( "Requester" );
    })

 

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 23 Aug 2019, 11:53 AM
Hello Chris,

To set different colors for your chart you can use the seriesColors property. It will allow you to set the default colors for the chart's series. When all colors are used, new colors are pulled from the start again.

@(Html.Kendo().Chart<CML.Models.TopRequestersSample_Result>()
    .Name("TopRequesters")
    .SeriesColors("red", "blue", "yellow", "#006634", "#c72e15")

Alternatively to this, I would suggest you customizing a theme in the Kendo ThemeBuilder (LESS or SASS).  Under the section "Series colors" you can manually choose up to 6 different colors which will be added to your custom theme. More information you can find in our documantation: https://docs.telerik.com/kendo-ui/styles-and-layout/appearance-styling#using-the-less-theme-builder

Hope the above helps and if there is anything else we could help with, please contact us back.

Regards,
Nikolay
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Chart
Asked by
Chris
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or