Code
// Create a chartspace object to place charts
Chartspace = New Chartspaceclass ();
//Show legend
Chartspace. haschartspacelegend= True;
//Add a chart to the chartspace object. The add method returns the chart object.
Chchart=Chartspace. charts. Add (0);
// given title
chchart. hastitle = true ;
chchart. title. caption = " material not required " ;
// given X,
chchart. axes [ 0 ]. hastitle = true ;
chchart. axes [ 0 ]. title. caption = " X: date " ;
Chchart. Axes [1]. Hastitle= True;
Chchart. Axes [1]. Title. Caption= "Y: No.";
/*Column stacked chart*/
// set the chart type
chchart. seriescollection. add ( 0 );
chchart. seriescollection [ 0 ]. type = chartcharttypeenum. chcharttypecolumnstacked;
// series PG1
// name of a Series
chchart. seriescollection [ 0 ]. setdata (chartdimensionsenum. chdimseriesnames,
( int ) chartspecialperformancesenum. chdataliteral, " PG1 " );
// given classification
chchart. seriescollection [ 0 ]. setdata (chartdimensionsenum. chdimcategories,
( int ) chartspecialdatasourcesenum. chdataliteral, " material a \ t material B \ t Material C \ t material d \ t " );
//Value of a given series
Chchart. seriescollection [0]. Setdata
(Chartdimensionsenum. chdimvalues,
(Int) Chartspecialdatasourcesenum. chdataliteral,"1 \ t0 \ T2 \ T2 \ t");
// Series pd1
// Name of the specified Series
Chchart. seriescollection. Add ( 1 );
Chchart. seriescollection [ 1 ]. Setdata (chartdimensionsenum. chdimseriesnames,
+ ( Int ) Chartspecialdatasourcesenum. chdataliteral, " Pd1 " );
// given classification
chchart. seriescollection [ 1 ]. setdata (chartdimensionsenum. chdimcategories,
+ ( int ) chartspecialperformancesenum. chdataliteral, " material a \ t material B \ t Material C \ t material d \ t " );
//Value of a given series
Chchart. seriescollection [1]. Setdata
(Chartdimensionsenum. chdimvalues,
(Int) Chartspecialdatasourcesenum. chdataliteral,"0 \ T3 \ T2 \ T3 \ t");
// Series PB1
// Name of the specified Series
Chchart. seriescollection. Add ( 2 );
Chchart. seriescollection [ 0 ]. Setdata (chartdimensionsenum. chdimseriesnames,
+ ( Int ) Chartspecialdatasourcesenum. chdataliteral, " PB1 " );
// given classification
chchart. seriescollection [ 2 ]. setdata (chartdimensionsenum. chdimcategories,
+ ( int ) chartspecialperformancesenum. chdataliteral, " material a \ t material B \ t Material C \ t material d \ t " );
// value of a given series
chchart. seriescollection [ 2 ]. setdata
(chartdimensionsenum. chdimvalues,
( int ) chartspecialperformancesenum. chdataliteral, " 1 \ t1 \ t1 \ T2 \ t " );
/* line chart */
// Add another series
chseries = chchart. seriescollection. add ( 0 );
//Specify chart type
Chseries. Type=Chartcharttypeenum. chcharttypelinemarkers;
Chseries. ungroup (True);
Chaxis=Chchart. Axes. Add (chseries. get_scalings (chartdimensionsenum. chdimvalues ));
Chaxis. Position=Chartaxispositionenum. chaxispositionright;
Chaxis. hasminorgridlines = False ;
Chaxis. hastitle = True ;
Chaxis. Title. Caption = " Quantity Used " ;
// Name of the specified Series
Chseries. setdata (chartdimensionsenum. chdimseriesnames,
+ ( Int ) Chartspecialdatasourcesenum. chdataliteral, " Quantity Used " );
//Value of a given series
Chseries. setdata
(Chartdimensionsenum. chdimvalues,
(Int) Chartspecialdatasourcesenum. chdataliteral,"200 \ t120 \ T90 \ t150 \ t");
// Output as a GIF file.
String Strabsolutepath = (Server. mappath ( " . " )) + " \ Temp \ test.gif " ;
Chartspace. exportpicture (strabsolutepath, " GIF " , 600 , 350 );
// Create the relative path of the GIF file.
string strrelativepath = " . /temp/test.gif " ;
//Show Image
Image1.imageurl=Strrelativepath. tostring ();