I attemtping to use Charts in MVC 3 and asside from the default ChartThemes provided it seems way harder to specify themes. There is no longer a way to edit ChartAreas or access many strongly typed properties (the argument type for chart area is just a string).
Previously you could do something like this:
Old Way
ChartArea area = new ChartArea {
BackColor = Color.Transparent,
AxisX = new Axis {
Interval = 7,
IntervalType = DateTimeIntervalType.Days,
IsMarginVisible = false,
LabelStyle = new LabelStyle { ForeColor = Color.FromArgb(255, 128, 128, 128), Font = new Font("Arial", 10, FontStyle.Regular), Format = "MMM dd" },
LineColor = Color.FromArgb(255, 208, 208, 208),
MajorGrid = new Grid { LineColor = Color.FromArgb(255, 242, 242, 242), LineDashStyle = ChartDashStyle.Solid },
MajorTickMark = new TickMark { LineColor = Color.Transparent, Size = 4.8f }
},
AxisY = new Axis {
IntervalAutoMode = IntervalAutoMode.VariableCount,
LabelStyle = new LabelStyle { ForeColor = Color.FromArgb(255, 128, 128, 128), Font = new Font("Arial", 10, FontStyle.Regular) },
LineColor = Color.Transparent,
MajorGrid = new Grid { LineColor = Color.FromArgb(255, 242, 242, 242), LineDashStyle = ChartDashStyle.Solid },
MajorTickMark = new TickMark { LineColor = Color.Transparent, Size = 0.8f }
},
Position = new ElementPosition { Height = 90, Width = 99, X = 0, Y = 10 }
};
New Way
Chart chart = new Chart(width: 400, height: 200, theme: ChartTheme.Yellow)
.AddSeries(
chartType: "line",
xValue: dates.ToArray(),
yValues: data.ToArray(),
chartArea: someString)
The chart area data is now just a string and you have chart themes are a string and there are a few defaults.
This seems like a massive step backwards? Am I missing something fundamental?
I agree the Charts helpers is very basic.
Dundas charts provided a better way of doing things.
Microsoft acquired Dundas Data Visualization Intellectual Property in April 2007 and is integrating this technology in different Microsoft products since then.
These still sends images
a better alternative is HighCharts which is build on javascript.