C # compile the source code of the owc11 component

Source: Internet
Author: User
Tags crosstab

Many components written using owc are already available on the Internet. However, it is quite easy to modify them with your own skills,CodeIt is not very powerful and is only available for everyone to learn :)
Using system;
Using system. collections;
Using system. componentmodel;
Using system. Data;
Using system. drawing;
Using system. Web;
Using system. Web. sessionstate;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. htmlcontrols;
Using Microsoft. Office. InterOP;

Namespace fishpro
{
/// <Summary>
/// Use the owc component to generate a bar chart example
/// </Summary>
Public class testowc: system. Web. UI. Page
{
Private void page_load (Object sender, system. eventargs E)
{

String strcategory = "1" + '\ t' + "2" +' \ t' + "3" + '\ t' + "4" +' \ t' +" 5 "+ '\ t' +" 6 "+' \ t' +" 7 "+ '\ t' +" 8 "+' \ t' +" 9 "+' \ t' + "10" + '\ t' + "11" +' \ t' + "12" + '\ T ';
String strvalue = "9000" + '\ t' + "8000" +' \ t' + "4007" + '\ t' + "10" +' \ t' +" 12760 "+ '\ t' +" 6678 "+' \ t' +" 10000 "+ '\ t' +" 20999 "+' \ t' +" 3567 "+' \ t' + "456" + '\ t' + "125" +' \ t' + "66765" + '\ T ';
String mtitle = "Monthly Report Analysis Chart ";
String xtitle = "month ";
String ytitle = "workload ";
Int imgwidth = 780;
Int imgheight = 600;
Int charttype = 0;
// This. createchartsmoothline (strcategory, strvalue, mtitle, xtitle, ytitle, imgwidth, imgheight, charttype );
Fishpro. owcchart11 chart = new owcchart11 (server. mappath ("."), "fee", mtitle, 1, xtitle, ytitle, imgwidth, imgheight );
Chart. ocategory = strcategory;
Chart. ovalue = strvalue;
If (chart. Create ())
{
Response. Write (" ");
}
Else
{
Response. Write ("shibai ");
}

/// Place user code here to initialize the page
// String strcategory = "1" + '\ t' + "2" +' \ t' + "3" + '\ t' + "4" +' \ t' + "5" + '\ t' + "6" +' \ t' + "7" + '\ t' + "8" +' \ t' + "9" + '\ t' + "10" +' \ t' + "11" + '\ t' + "12" +' \ T ';
// String strvalue = "9" + '\ t' + "8" +' \ t' + "4" + '\ t' + "10" +' \ t' + "12" + '\ t' + "6" +' \ t' + "1" + '\ t' + "2" +' \ t' + "3" + '\ t' + "4" +' \ t' + "12" + '\ t' + "6" +' \ T ';
//
/// Declare an object
// Microsoft. Office. InterOP. owc11.chartspace thischart = new Microsoft. Office. InterOP. owc11.chartspaceclass ();
// Microsoft. Office. InterOP. owc11.chchart thischchart = thischart. charts. Add (0 );
// Microsoft. Office. InterOP. owc11.chseries thischseries = thischchart. seriescollection. Add (0 );
//
//
//// Display legend
// Thischchart. haslegend = true;
//// Title
// Thischchart. hastitle = true;
// Thischchart. Title. Caption = "Statistical Chart ";
/// Specifies the X and Y axes
// Thischchart. Axes [0]. hastitle = true;
// Thischchart. Axes [1]. hastitle = true;
// Thischchart. Axes [0]. Title. Caption = "month ";
// Thischchart. Axes [1]. Title. Caption = "quantity ";
//
/// Chart type
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypecolumnclustered3d; // 3D bar chart
// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypesmoothline; // smooth Graph
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypearea; // line Area Chart
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypearea3d; // line 3D Area Chart
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypeareaoverlapped3d; // line 3D Area Chart
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypeareastacked; // Add a border to the line Area Chart
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypeareastacked100; // line area chart and border percentage chart
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypeareastacked1003d; // line 3D Area Chart and border percentage chart
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypeareastacked3d; // line 3D Area Chart and border
//// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypebar3d; // crosstab chart 3D
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypebarclustered; // crosstab chart
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypebarclustered3d; // crosstab chart 3D
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypebarstacked; // crosstab chart 3D
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypebarstacked100; // 3D percentage chart of the crosstab chart
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypebarstacked1003d; // 3D percentage chart of the crosstab chart
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypebubble; // The test fails.
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypebubbleline; // The test fails.
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypecolumn3d; // bar chart 3D
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypecolumnclustered; // bar chart 3D
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypecolumnclustered3d; // bar chart 3D
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypecolumnstacked; // bar chart
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypecolumnstacked100; // bar chart 3D percentage chart
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypecolumnstacked1003d; // bar chart 3D percentage chart
/// Thischchart. type = Microsoft. Office. InterOP. owc11.chartlegendpositionenum. chlegendpositionbottom;
/// Rotate
// Thischchart. Rotation = 360;
// Thischchart. Inclination = 10;
/// Background color
// Thischchart. plotarea. Interior. color = "red ";
// Thischchart. plotarea. Floor. Interior. color = "green ";
//
// Thischchart. Overlap = 50;
//
/// // Specify the name of a series.
// Thischseries. setdata (Microsoft. Office. InterOP. owc11.chartdimensionsenum. chdimseriesnames, Microsoft. Office. InterOP. Exceptions. chdataliteral. gethashcode (), "date ");
/// Specify a category
// Thischseries. setdata (Microsoft. Office. InterOP. owc11.chartdimensionsenum. chdimcategories, Microsoft. Office. InterOP. Exceptions. chdataliteral. gethashcode (), strcategory );
/// Specify the value
// Thischseries. setdata (Microsoft. Office. InterOP. owc11.chartdimensionsenum. chdimvalues, Microsoft. Office. InterOP. owc11.chartspecialperformancesenum. chdataliteral. gethashcode (), strvalue );
//
//// Export the image file
// Try
//{
//
// Thischart. exportpicture (server. mappath ("chart.gif"), "GIF", 600,350 );
// Response. Write (" ");
//}
//
// Catch (exception ee)
//
//{
//
//}

}

// smoothing curve
// charttype 0 default Bar Chart 1 Horizontal Chart 2 smoothing curve
Public void createchartsmoothline (string strcategory, string strvalue, string mtitle, string xtitle, string ytitle, int imgwidth, int imgheight, int charttype)
{< br> // declares an object
Microsoft. office. interOP. owc11.chartspace thischart = new Microsoft. office. interOP. owc11.chartspaceclass ();
Microsoft. office. interOP. owc11.chchart thischchart = thischart. charts. add (0);
Microsoft. office. interOP. owc11.chseries thischseries = thischchart. seriescollection. add (0);
// display legend
thischchart. haslegend = true;

// Display title options
Thischchart. hastitle = true;
Thischchart. Title. Font. Name = "";
Thischchart. Title. Font. size = 14;
Thischchart. Title. Caption = mtitle; // from

// Description of the X and Y axes
// X
Thischchart. Axes [0]. hastitle = true;
Thischchart. Axes [0]. Title. Font. Name = "";
Thischchart. Axes [0]. Title. Font. size = 12;
Thischchart. Axes [0]. Title. Caption = xtitle;

Thischchart. Axes [1]. hastitle = true;
Thischchart. Axes [1]. Title. Font. Name = "";
Thischchart. Axes [1]. Title. Font. size = 12;
Thischchart. Axes [1]. Title. Caption = ytitle;

// Chart type
Switch (charttype)
{
Case 0:
Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypecolumn3d; // bar chart 3D
Break;
Case 1:
Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypebar3d; // crosstab chart 3D
Break;
Case 2:
Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypesmoothline; // smooth Graph
Break;
Case 3:
Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypepie; // pie chart
Break;
}
// Thischchart. type = Microsoft. Office. InterOP. owc11.chartcharttypeenum. chcharttypesmoothline; // smooth Graph
// Rotate
Thischchart. Rotation = 360;
Thischchart. Inclination = 10;
// Background color
Thischchart. plotarea. Interior. color = "red ";
Thischchart. plotarea. Floor. Interior. color = "green ";

// Thischchart. Overlap = 50;

//// Specify the name of a series.
Thischseries. setdata (Microsoft. Office. InterOP. owc11.chartdimensionsenum. chdimseriesnames, Microsoft. Office. InterOP. Exceptions. chdataliteral. gethashcode (), "date ");
// Specify a category
Thischseries. setdata (Microsoft. Office. InterOP. owc11.chartdimensionsenum. chdimcategories, Microsoft. Office. InterOP. Exceptions. chdataliteral. gethashcode (), strcategory );
// Specify the value
Thischseries. setdata (Microsoft. Office. InterOP. owc11.chartdimensionsenum. chdimvalues, Microsoft. Office. InterOP. owc11.chartspecialperformancesenum. chdataliteral. gethashcode (), strvalue );

// Export an image file
Try
{

Thischart. exportpicture (server. mappath ("chart.gif"), "GIF", imgwidth, imgheight );
Response. Write (" ");
}

Catch (exception ee)

{

}


}

# code generated by region web forms designer
override protected void oninit (eventargs e)
{< br> //
// codegen: this call is ASP.. NET web form designer.
//
initializecomponent ();
base. oninit (E );
}< br>
///


// The method required by the designer. Do not use the code editor to modify the method.
/// the content of this method.
//
private void initializecomponent ()
{< br> This. load + = new system. eventhandler (this. page_load);
}< BR ># endregion
}< BR >}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.