Hello, I want to make a Stacked Bar/Column Chart in ASP MVC.
I can't reproduce the example: http://demos.kendoui.com/dataviz/bar-charts/grouped-stacked-bar.html with Binding.
Then I modified the example in: http://demos.kendoui.com/dataviz/bar-charts/grouped-data.html adding Stack(true) in the series definition.
The model is:
Everything is working, but that is the correct approach?
I have a issue with the color of the Legend Item, maybe because the Item is a Group.
The result is:
http://s8.postimage.org/4udwdfixh/Legend_Item_Color.png
I can't reproduce the example: http://demos.kendoui.com/dataviz/bar-charts/grouped-stacked-bar.html with Binding.
Then I modified the example in: http://demos.kendoui.com/dataviz/bar-charts/grouped-data.html adding Stack(true) in the series definition.
@model IEnumerable<
SampleProject.GraphValueModel
>
@(Html.Kendo().Chart(Model)
.Name("chart")
.Title(title => title.Position(ChartTitlePosition.Top).Text("Some Customers"))
.DataSource(dataSource => dataSource
.Read(read => read.Action("ChartForAnything", "Home"))
.Group(group => group.Add(model => model.ColumnOrGroupName))
.Sort(sort => sort.Add(model => model.AxisXValue).Ascending())
)
.Series(series => {
series.Column(model => model.IndexValue, model => model.Color)
.Name("close")
.GroupNameTemplate("#= group.value #").Stack(true).Labels(label => { label.Position(ChartBarLabelsPosition.Center).Visible(true).Background("Transparent").Format("p1").Color("#FFFFFF"); });
})
.Legend(legend => legend
.Position(ChartLegendPosition.Top)
)
.ValueAxis(axis => axis.Numeric()
.Labels(labels => labels.Format("p2").Skip(1))
.Axis.Max = 1.0f)
.CategoryAxis(axis => axis
.Categories(model => model.AxisXValue)
.Labels(labels => labels.Format("MMM"))
))
public
class
GraphValueModel
{
public
DateTime AxisXValue {
get
;
set
; }
public
string
SerieName {
get
;
set
; }
public
object
IndexValue {
get
;
set
; }
public
string
Color {
get
;
set
; }
public
string
ColumnOrGroupName {
get
;
set
; }
}
I have a issue with the color of the Legend Item, maybe because the Item is a Group.
The result is:
http://s8.postimage.org/4udwdfixh/Legend_Item_Color.png