OWC11 generates a curve chart class, the interface is DataSet.

xiaoxiao2021-03-06  50

Using system;

Using system.collections;

Using system.componentmodel;

Using system.data;

Using system.drawing;

Using system.Web;

Using system.Web.ui;

Using OWC11;

Namespace licchart

{

///

A summary description of /// Line.

///

Public class chartline3: System.Web.ui.page

{

Public String TochartLine3 (Dataset MyDataSet, String Yvalue, String Series, String Xtitle, String Ytitle, String Charttitle)

{

/ / Place the user code here to initialize the page

// Create a ChartSpace object to place the chart

Owc11.chartspace objcspace = new wc1.chartspaceClass ();

/ / Add a chart in the ChartSpace object, the add method returns a Chart object

Owc11.chchart objchart = objcspace.Charts.Add (0);

/ / Specify the type of the chart. The type is worth it by owc11.ChartchartTyPeenum

Objchart.type = OWC11.CHARTCHARTTYPEENUM.CHCHARTTYPELINE

/ / Given the title

Objchart.haastitle = true;

//objchart.title.caption= chartnmae;

/ / A given illustration of a given X, Y axis

Objchart.title.caption = charttitle;

/ / A given illustration of a given X, Y axis

Objchart.axes [0] .hastitle = true;

ObjChart.axes [0] .title.caption = xi x;

ObjChart.axes [1] .haastitle = true;

Objchart.axes [1] .title.caption = ytitle;

//calculate data

//objcspace.datasource=DataSt;

IF (SERIES! = "")

{

/ / Specify whether the chart needs the legend

Objchart.haslegegend = true;

String [] Ser = series.toTOString (). split (',');

String [] Ser1 = series.tostring (). split (',');

STRING [] YVALUE_TEMP = Yvalue.toString (). Split (',');

String [] stritalue = new string [yvalue_temp.length];

String [] strcategory = new string [yvalue_temp.length];

// The cyclic data set gets no repeated sequence name

For (int i = 0; i <= ser.length-1; i )

{

// put the first line of Ser [i] column into the string

String series1 = mydataset.tables [0] .rows [0] [Ser [i]]. Tostring ();

// The cycle data set is drawn from the SER [I] value different from the string, placed in a string

For (int J = 1; j <= mydataset.tables [0] .Rows.count-1; j ) {

// Separate strings into array

String [] series11 = series1.split (',');

INT K = 0;

// Compare the Ser [i] value of each line of the data set with each value in the divided array, plus different words, plus the string

For (int w = 0; w <= series11.length-1; w )

{

/ / If you are equal to a certain value in a string 1

IF (MyDataSet.Tables [0] .ROWS [J] [SER [I]]. Tostring () == Series11 [W]) K ;

}

// k 不 等 0 Description Nothing to repeat, add this item to the string

IF (k == 0) Series1 = "," mydataset.tables [0] .ROWS [J] [SER [I]]. TOSTRING ();

}

// Store the final resulting sequence of unreasting

SER [I] = series;

}

INT V_NUM = 1;

/ / Depending on the product of the number of sequence values ​​of the dynamic array

For (int i = 0; i <= ser.length-1; i )

{

String [] v_str = ser [i] .split (',');

v_num = v_num * v_str.length;

}

String [] v_str_all = new string [v_num]; // Defines an array of storage sequences.

String temp = "";

INT V_J = 0;

IF (ser.length == 1)

{

For (int i = 0; i <= ser.length-1; i )

{

String [] v_str = ser [i] .split (',');

For (int J = 0; j <= v_str.length-1; j )

{

For (int K = v_num-1; k> = 0; k -)

{

INT V_STEP = V_NUM / V_STR.LENGTH;

IF ((k> = j * (v_step)) && (k <(j 1) * v_step)))

// if (k% v_str.length == 0)

{

v_str_all [k] = v_str_all [k] v_str [j] "-";

}

}

}

}

}

Else

{

For (int i = 1; i <= ser.length-1; i )

{

IF (i! = 1) Ser [0] = Ser [0] .substring (0, ser [0] .length-1);

String [] Ser1 = Ser [0] .split (',');

SER [0] = "";

For (int J = 0; j <= ser1.Length-1; J )

{

String [] Ser2 = Ser [i] .split (',');

For (int K = 0; k <= ser2.length-1; k )

{

Ser [0] = ser1 [j] "-" ser2 [k] ",";

}

}

}

SER [0] = Ser [0] .substring (0, ser [0] .length-1);

v_str_all = ser [0] .split (',');

IF (ser.length == 1)

{

For (int K = 0; k

{

V_STR_ALL [K] = v_str_all [k] .substring (0, v_str_all [k] .length-1);

}

}

String seriestemp = ""

For (int J = 0; j <= mydataset.tables [0] .rows.count-1; j )

{

Seriestemp = "";

For (int w = 0; w <= ser1.length-1; w )

{

Seriestemp = mydataset.tables [0] .rows [j] [ser1 [w]]. TOSTRING () "-";

}

Seriestemp = seriestemp.substring (0, seriestemp.length-1);

For (int i = 0; i <= v_str_all.length-1; i )

{

IF (Seriestemp == V_STR_ALL [I])

{

For (int q = 0; q <= yvalue_temp.length-1; q )

{

Strvalue [q] = mydataset.tables [0] .ROWS [J]]. TOSTRING () '/ t';

STRCATEGORY [q] = v_str_all [i] '/ t';

}

}

}

}

// Add a series

STRING [] yvalue1 = yvalue.tostring (). split (',');

For (int i = 0; i <= strcategory.length-1; i )

{

Objchart.seriescollection.Add (i);

/ / Given the name of Series

Objchart.seriescollection [i] .SetData (Owc11.Chartdimensionsenum.chdimseriesnames,

(int) OWC11.CHARTSPECIALDATASOSNUM.CHDATALITERAL, YVALUE1 [I]);

/ / A given classification

Objchart.seriescollection [i] .Setdata (Owc11.Chartdimensions,

(int) OWC11.CHARTSPECIALDATASOSNUM.CHDATALITERAL, STRCATEGORY [I]);

//Desired point

Objchart.seriescollection [i] .SetData

(Owc11.ChartDimensionSenum.chdimvalues,

(int) OWC11.CHARTSPECIALDATASOSNUM.CHDATALITERAL, STRVALUE [I]);

}

}

// Output as a GIF file.

// String strabSolutePath = (Server.mAppath (")) " //test1.gif ";

Random vrandom = new random ();

INT vrandomint = vrandom.next (10000, 30000); string vrandomstr = vrandomint.tostring ();

vrandomint = vrandom.next (10000, 30000);

Vrandomstr = vrandomstr vrandomint.toString ();

String strabsolutePath = (Server.mAppath ("//")) "Temp //" vrandomstr ".gif";

Objcspace.exportPictPicture (StrapSolutePath, "GIF", 640, 480);

// Create a relative path to the GIF file.

String strongPath = "/ temp /" vrandomstr ".gif";

// Add the picture to the PlaceHolder.

String strimagetag = "";

Return StrimageTag;

}

}

}

The corresponding histogram only needs to turn objChart.Type = OWC11.CHARTCHARTTYPEENUM.CHCHARTTYPELINE; change it. CHARTCHARTTYPEENUM in OWC11 enumerated a lot of style, 3D, 2D, free choice.

转载请注明原文地址:https://www.9cbs.com/read-57513.html

New Post(0)