My need is relatively straight forward, but I am not normally a report person, nor a charting kind of person, so my knowledge of different charting types and values is practically nil.
I have a List<ClientBreakdown>, which is just a collection of a very simple class:
public
class
ClientBreakdown
{
public
string
State {
get
;
set
; }
public
int
Count {
get
;
set
; }
}
What I'd like is a Bar Chart, with the States alphabetically along the bottom, and the number of Clients in each state as the value of the bar.
I've done this:
@(Html.Kendo().Chart<ClientBreakdown>()
.Name(
"chart"
)
.Title(
"Breakdon of Client States"
)
.Legend(l => l.Position(ChartLegendPosition.Bottom))
.Series(s => s
// pie chart is too busy, let's try it as a bar chart
// .Pie(m => m.Count, m => m.State).Padding(5).Labels(l => l.Visible(false).Template("#= category # - #= value #"))
.Column(m => m.Count, m => m.State).Labels(l => l.Visible(
false
).Template(
"#= category # - #= value #"
))
)
.DataSource(ds =>
{
ds.Read(r => r.Action(
"ClientsByState"
,
"Clients"
).Type(HttpVerbs.Get));
})
.Tooltip(tp => tp.Visible(
true
).Template(
"#= category # - #= value #"
))
)
It gives me a bar chart ok, but each column is black, and there are no labels. (See attached image)
Could someone give me a few tips on how to best accomplish this?