ChartDirector 7.1 (.NET Edition)

The First ASP.NET MVC / Razor Pages Project




This section introduces using ChartDirector in ASP.NET MVC / Razor Pages. For ASP.NET Web Forms, please refer to The First ASP.NET Web Forms Project. For Windows Forms, please refer to The First Windows Forms Project. For WPF, please refer to The First WPF Project.

To get a feeling of using ChartDirector, and to verify the ChartDirector development environment is set up properly, we will begin by building a very simple bar chart.

The following is based on one of the charts in the sample project "NetMvcCharts". If you have not yet tried the sample project, it is highly recommended you try them now. Please refer to the Installation section for details. They are very useful for exploring and testing the features of ChartDirector.

The sample project "NetMvcCharts" is for ASP.NET MVC. The code for ASP.NET Core MVC and ASP.NET Core Razor Pages are very similar. Please refer to the code in the sample projects "NetCoreMvcCharts" and "NetCoreRazorCharts" for details.

To create a chart in ASP.NET MVC, the basic method is to create the chart in the controller and assign it to a RazorChartViewer. The RazorChartViewer can then be used in the view to generate the HTML for the chart. The step by step instructions are as follows:

Note: The trial version of ChartDirector will include small yellow banners at the bottom of the charts it produces. These banners will disappear in the licensed version of ChartDirector.