I am not sure how to word this, so I'll describe what I would like to do and hopefully someone can lead me in the right direction.
I have a list of Top Sellers for a shop. These top sellers are categorized by department types (i.e. Fuel, Shop, etc.). When displayed in a bar chart without the grouping, the Fuel group rather skews the results on the chart as seen in the screenshot (topsellers.png). All bars are the same color and there is no legend.
What I would like to do is to is have the chart appear like the screenshot, but with the fuel group having its own color and the shop having its own color. The legend should appear at the top and clicking on the legend will hide/show the associated items in the chart. When I added the Group to the kendo bar chart, I got the colors and the legend, but the groups overlap in the chart creating two columns as shown in the second screenshot (topsellergroup.png) and the shop entries lost their descriptions. So I'd like the grouped items to show up in the chart along with their descriptive text (as in the first screenshot), but with the colors and legend of the second screenshot.
Here is my current chart code. I am setting the group to the DeptType value (i.e. Fuel, Shop) and the series based on the Quantity.
<
div
class
=
"panel panel-default"
>
<
div
class
=
"demo-section k-content wide"
>
@(Html.Kendo().Chart<
CBECloudBO2.ViewModels.ChartTopSellers
>()
.Name("chartTopSellers")
.Title("Top Sellers by Quantity")
.DataSource(datasource => datasource
.Read(read => read.Action("Chart_TopSellers", "Home"))
.Group(group => group.Add(model => model.DeptType))
.Sort(sort => sort.Add(model => model.Quantity).Descending())
)
.Legend(legend => legend.Visible(true).Position(ChartLegendPosition.Top))
.ChartArea(chartArea => chartArea
.Background("transparent"))
.Series(series =>
{
series.Bar(d => d.Quantity).Name("");
})
.CategoryAxis(axis => axis
.Categories(d => d.PLUDesc).Visible(true)
.Title("Product")
.MajorGridLines(lines => lines.Visible(false)))
.ValueAxis(axis => axis
.Numeric()
.Title("Quantity Total")
.Line(line => line.Visible(false))
.MajorGridLines(lines => lines.Visible(true)))
.Tooltip(tooltip => tooltip
.Visible(true)
.Template("#= category #: #= value #"))
)
</
div
>
</
div
>
Is it possible to group items, but not have the chart create the group columns next to each other? I tried adding the .CategoryField to the series and supplying the item description, but this only listed the fuel items and not the shop items.
Thank you for any help.
Regards,
Shawn