MS Chart for ASP.NET in modern projects using .netCHARTING
History: The Microsoft Chart Controls were introduced in 2010 with Microsoft’s .NET Framework 3.5 based on an old chart codebase developed in 2007. The MS Chart controls have since been deprecated including Microsoft.Chart.Controls, System.Web.UI.DataVisualization.Charting and System.Windows.Forms.DataVisualization.Charting.For the past 20 years, .netCHARTING has continued to be updated regularly and now includes the latest resolution independent charts, a complete set of modern chart types and fresh modern visuals. Designed to work seamlessly with your old code using the deprecated MS Chart Controls and APIs simply change the assembly and namespace to dotnetCHARTING and your project's charts will be upgraded automatically and seamlessly:
<%@
Register
Assembly
="System.Web.DataVisualization"
Namespace
="System.Web.UI.DataVisualization.Charting">
TagPrefix
="asp"%>
To:
<%@
Register
Assembly
="dotnetCHARTING"
Namespace
="dotnetCHARTING">
TagPrefix
="asp"%>
CandleStick
The first chart shows output with MS Chart and the 2nd using the same code with .netCHARTING; no custom code or settings required. Before using MS Chart:Code Sample:
Candlestick.aspx
<%@
Page
Language
="C#" %>
<%@
Register
Assembly
="dotnetCHARTING"
Namespace
="dotnetCHARTING">
TagPrefix
="asp"%>
<html
xmlns
="http://www.w3.org/1999/xhtml">
<head><title>.netCHARTING Sample</title>
<script
runat
="server">
voidPage_Load(Object sender,EventArgs e)
{
chart1.ImageLocation =
"temp/Candlestick";
chart1.ImageStorageMode = ImageStorageMode.UseImageLocation;
chart1.ImageType = ChartImageType.Png;
chart1.ChartAreas.Add(new ChartArea("Stock"));
chart1.ChartAreas.Add(new ChartArea("Volume"));
chart1.ChartAreas[0].AxisY.Title ="Stock";
chart1.ChartAreas[1].AxisY.Title ="Year 2021";
chart1.ChartAreas[1].AxisY.Title ="Volume";
generateRandomData();
}
</script>
</head>
<body>
<asp:Chart
ID
="chart1"
runat
="server"
Width
="600px"
Height
="400px"/>
</body>
</html>
In the above code, by changing the register line, all the MS Chart codes work correctly with .netCHARTING. Now you can take it one step further by enabling .netCHARTING's JavaScript charts with: Chart.JS.Enabled = true; and get a resolution independent vector output with interactive tooltips and much more.
If you have any questions, please contact support@dotnetcharting.com for assistance.