Declined
Last Updated: 05 Apr 2021 11:31 by ADMIN
Created by: Paul
Comments: 3
Category: Chart
Type: Bug Report
0

Using Kendo through MVC creation. Create any chart with @(Html.Kendo().Chart()) code. Plug in a color into any property: Font.Color, MajorGridLines.Color, Series.Color (line, area, column), ValueAxis.Color etc. The color should be a hex string in the format of #102030. The pound character in here messes up the ToClientTemplate() method or alternatively the parsing of that finished template back on the Kendo scripts.

A workaround is to instead use rgb(16, 32, 48) since the # character is not there.

For now I added this extension method if it helps anyone who stumbles along to this.

public static string ToRgbColor(this string hexColor) {
   var color = ColorTranslator.FromHtml(hexColor);
   if (color.A == 255) {
      return $"rgb({color.R},{color.G},{color.B})";
   }
   else {
      return $"rgba({color.A},{color.R},{color.G},{color.B})";
   }
}