I’m trying to use the MVC 3 Chart helper to create a bar chart that might have more than 9 xValues. The following code will produce a chart that only has labels for “two, four, six, eight and ten”. I’d like the chart to diplay all labels, one through ten.
var companies = new[] { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten" };
var quantities = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
Chart chart = new Chart(960, 600, theme: ChartTheme.Blue)
.AddTitle("Quantity Shipped by Company")
.AddSeries(chartType: "bar", xValue: companies, yValues: quantities);
I’ve seen a few references to setting the interval, but I don’t think they pertain to the MVC 3 Chart helper?
I’ve found the chart helper lacking in a few areas and a little buggy. When I encountered problems, I created the chart manually. Take a look at the code I posted here:
ASP.NET MVC 3 MSChart Error: Only 1 Y values can be set for this data series