How to write the code of calling Office in asp.net to make 3D statistical chart
This article mainly explains "how to write ASP.NET call Office to make 3D statistical chart code", the explanation content in the article is simple and clear, easy to learn and understand, please follow the idea of Xiaobian slowly in-depth, together to study and learn "how to write ASP.NET call Office to make 3D statistical chart code"!
1. Download owc11 COM components first
http://www.microsoft.com/downloads/details.aspx? FamilyID=7287252c-402e-4f72-97a5-e0fd290d4b76&displaylang=en
2. Registration owc11
Add owc11.dll reference under C:/Program Files/Common Files/Microsoft Shared/Web Components/11 file to project
3. Add in the project
using OWC11;
4. Examples of starting coding are as follows:
The copy code is as follows:
public class ChartFactory
{
public ChartFactory()
{
InitTypeMap();
//
// TODO: Add constructor logic here
//
}
protected System.Web.UI.WebControls.Image imgHondaLineup;
private string[] chartCategoriesArr;
private string[] chartValuesArr;
private OWC11.ChartChartTypeEnum chartType = OWC11.ChartTypeEnum.chChartTypeColumn3D;//Default
private static Hashtable chartMap = new Hashtable();
private static string chartTypeCh = "Vertical histogram" ;
private static string chartTitle = "";
private void InitTypeMap()
{
chartMap.Clear();
OWC11.ChartChartTypeEnum[] chartTypes = new OWC11.ChartChartTypeEnum[]{ ChartChartTypeEnum.chChartTypeColumnClustered,
ChartChartTypeEnum.chChartTypeColumn3D,
ChartChartTypeEnum.chChartTypeBarClustered,
ChartChartTypeEnum.chChartTypeBar3D,
ChartChartTypeEnum.chChartTypeArea,
ChartChartTypeEnum.chChartTypeArea3D,
ChartChartTypeEnum.chChartTypeDoughnut,
ChartChartTypeEnum.chChartTypeLineStacked,
ChartChartTypeEnum.chChartTypeLine3D,
ChartChartTypeEnum.chChartTypeLineMarkers,
ChartChartTypeEnum.chChartTypePie,
ChartChartTypeEnum.chChartTypePie3D,
ChartChartTypeEnum.chChartTypeRadarSmoothLine,
ChartChartTypeEnum.chChartTypeSmoothLine};
string[] chartTypesCh = new string [] {"Vertical Bar Chart,""3D Vertical Bar Chart,""Horizontal Bar Chart,""3D Horizontal Bar Chart,""Area Chart,""3D Area Chart,""Hollow Pie Chart,""Line Chart,""3D Line Chart,""Line Chart with Points,""Pie Chart,""3D Pie Chart,""Network Chart,""Arc Chart"};
for(int i=0;i