Hello ,
i am working on a chartingtool with variable datasources and more than one chart.
in my model i have a object[] which contains the chartdata for the charts.
this model has an array of List<ChartDataSerie>[] which contains the data for every series.
ChartDataSerieModel:
01.
public class ChartDataSerie
02.
{
03.
public ChartDataSerie(string description, double value)
04.
{
05.
Description = description;
06.
Value = value;
07.
}
08.
public ChartDataSerie(string description, double value, string color, double opacity)
09.
{
10.
Description = description;
11.
Value = value;
12.
Color = color;
13.
Opacity = opacity;
14.
}
15.
16.
public string Description { get; set; }
17.
public Double Value { get; set; }
18.
public string Color { get; set; }
19.
public double Opacity { get; set; }
20.
}
Now i want to bind a serie to a List<ChartSeriesData>, Value contains the Data, Description contains the Category
- each object contains an chart in Model.Kennzahlen, for to create a chart for every object in Model.Kennzahlen
- want to create an serie for every object in Model.Kennzahlen[i].Series
- Value are always a double, and Description (Category) the same at every Series ( Date in string)
01.
@
for
(int i = 0; i < Model.Kennzahlen.Count; i++)
02.
{
03.
<div class=
"col-lg-3"
>
04.
<div class=
"ibox float-e-margins"
>
05.
<div class=
"ibox-title"
>
06.
<h5>Chart 1</h5>
07.
</div>
08.
<div class=
"ibox-content"
>
09.
<div>
10.
@(Html.Kendo().Chart(Model.Kennzahlen[i].Series)
11.
.Name(
"chart"
+ i)
12.
.Legend(legend => legend
13.
.Visible(
false
)
14.
.Position(ChartLegendPosition.Bottom)
15.
)
16.
.ChartArea(chartArea => chartArea
17.
.Background(
"transparent"
)
18.
.Height(200)
19.
)
20.
.Series(series =>
21.
{
22.
for
(int x = 0; x < Model.Kennzahlen[i].Series.Length; x++)
23.
{
24.
series.Column(Model.Kennzahlen[i].Series[x]);
25.
}
26.
})
27.
.CategoryAxis(axis => axis
28.
.Categories(model => model[0].Description)
29.
.MajorGridLines(lines => lines.Visible(
false
))
30.
.Line(line => line.Visible(
false
))
31.
)
32.
.ValueAxis(axis => axis.Numeric()
33.
.Max(28)
34.
.MajorGridLines(lines => lines.Visible(
false
))
35.
.Visible(
false
)
36.
)
37.
.Tooltip(tooltip => tooltip
38.
.Visible(
true
)
39.
.Format(
"{0}%"
)
40.
.Template(
"#= series.name #: #= value #"
)
41.
)
42.
)
43.
44.
</div>
45.
</div>
46.
</div>
47.
</div>
48.
}
How can i solve this ?
Thank you in advance and hope it is understandable for you :)