- Context:
I am currently building a dashboard which will display multiple separate line graphs. I am using the Sass ThemeBuilder, and this is where the colors will be set (Under Chart > Series A-F) and regularly changed. The colors for these lines must match the colors of our SASS theme so they cannot be hard coded.
- Problem:
Currently every chart is drawn using the colors for Series A, which makes sense since there is only a single series per chart. What I would like to do is have each chart use a different series color.
Is there a way to do this without directly passing a hard coded hex value?
Currently I am achieving this by adding a few empty series inside each chart, but would like to know if there is a tidy way of doing it.
01.
<div
class
=
"col-xs-6"
>
02.
@(Html.Kendo().Chart().Theme(
"sass"
)
03.
.Name(
"lines1"
)
04.
.Title(
"g1"
)
05.
.Series(s =>
06.
{
07.
s.Line(
new
List<
double
>());
08.
s.Line(
new
List<
double
> {1.7, 1.63, 1.72, 1.87, 2.1, 1.2, 1, 0.9}).Name(
"g1"
);
09.
})
10.
.HtmlAttributes(
new
{ style =
"height:200px;"
})
11.
)
12.
</div>
13.
<div
class
=
"col-xs-6"
>
14.
@(Html.Kendo().Chart().Theme(
"sass"
)
15.
.Name(
"lines2"
)
16.
.Title(
"g2"
)
17.
.Series(s =>
18.
{
19.
s.Line(
new
List<
double
>());
20.
s.Line(
new
List<
double
>());
21.
s.Line(
new
List<
double
> {1.7, 1.63, 1.72, 1.87, 2.1, 1.2, 1, 0.9}).Name(
"g2"
);
22.
})
23.
.HtmlAttributes(
new
{ style =
"height:200px;"
})
24.
)
25.
</div>
26.
<div
class
=
"col-xs-6"
>
27.
@(Html.Kendo().Chart().Theme(
"sass"
)
28.
.Name(
"lines3"
)
29.
.Title(
"g3"
)
30.
.Series(s =>
31.
{
32.
s.Line(
new
List<
double
>());
33.
s.Line(
new
List<
double
>());
34.
s.Line(
new
List<
double
>());
35.
s.Line(
new
List<
double
> {1.7, 1.63, 1.72, 1.87, 2.1, 1.2, 1, 0.9}).Name(
"g3"
);
36.
})
37.
.HtmlAttributes(
new
{style =
"height:200px;"
})
38.
)
39.
</div>
40.
<div
class
=
"col-xs-6"
>
41.
@(Html.Kendo().Chart().Theme(
"sass"
)
42.
.Name(
"lines4"
)
43.
.Title(
"g4"
)
44.
.Series(s =>
45.
{
46.
s.Line(
new
List<
double
>());
47.
s.Line(
new
List<
double
>());
48.
s.Line(
new
List<
double
>());
49.
s.Line(
new
List<
double
>());
50.
s.Line(
new
List<
double
> {1.7, 1.63, 1.72, 1.87, 2.1, 1.2, 1, 0.9}).Name(
"g4"
);
51.
} )
52.
.HtmlAttributes(
new
{ style =
"height:200px;"
})
53.
)
54.
</div>