C # do control - generate a histogram with VML

xiaoxiao2021-03-06  42

using System; using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Collections; using System.Collections.Specialized Namespace Controls.custom {///

/// chartvolumeReport's summary description. /// [DefaultProperty ("text"), ToolboxData ("<{0}: ChartVoluMereport Runat = Server> ")] public class chartvoluMereport: control {int bx = 1000; INT BY = 4700; // The minimum of the coordinates int yH = 80; // Vertical shadow height int xw = 80; // horizontal shadow width int count = 0; Double Step; Double Max; double min; int deci = 2; double ystep; string str_Volume = string.Empty; string str_Group3 = string.Empty; string str_TempA = string.Empty; string str_info = string.Empty; string str_dinfo = string.Empty; string temp = string.Empty; private string data; private String DataInfor; private string [] color;

String [] tmpdata; // transmitted value string [] TmpDataInfor; // Passage Correspondence #Region property [Bindable (TRUE), Category ("Data"), DefaultValue ("")] public string data {get {Return Data;} set {data = value;}} [bindable (true), category ("data"), defaultValue ("")] public string datainter {get {return datainfor;} set {datainfor = value;}} [bindable (TRUE), Category ("DATA"), DefaultValue ("")] Public String Colorarr {Get {Return Colorarr;} set {colorR = value;}} #ndregion public chartvolumeReport () {str_volume = ""; str_volume = ">>>>>>>> "; STR_VOLUME =" "; str_volume = "";

STR_GROUP3 = "; str_group3 =" "; str_group3 =" "; str_group3 =" "; str_group3 =" "; str_group3 =" "; str_group3 = " "; str_group3 =" " ;

STR_INFO = "

"

} Protected Override Void Render (HTMLTEXTWRITER OUTPUT) {color = colorRr.Split (new char [] {','}; tmpdata = data.split (new char [] {','}; // biography Numeric TMPDataInfor = DataInfor.Split (new char [] {','}); // pass the corresponding content count = tmpdata.length; step = 8000 / count; max = convert.todouble (TmpData [0]); min = conver. TODOUBLE (TmpData [0]); for (int i = 0; i max) max = convert.todouble (tmpdata [i] ); If (convertata [i]) / 1 "; str_tempa = temp

'" (BX i * Step) ", " " " (BX (I / 1 1) * Step) ", " " " (BX (I / 1 1) * Step) "," "" (BX I * Step) "," (BX I * Step) "," BY "'/>" str_tempa;}} // str_volume = STR_TEMPA;

// Painting horizontal horizontal line and Y side horizontal string lineColor = ""; for (int i = 1; i <11; i ) {double ynum; if (Deci> 0) {ynum = math.Round (Math.Pow (10, DECI) * i * max * 0.1) * Math.Pow (10, DECI 1) / (Math.Pow (10, Deci Deci 1);} else {ynum = math.Round (i * MAX * 0.1);} if (i% 3 == 0) linecolor = "# b5e3b5"; else linecolor = "# E7e3e7"; temp = ""; Str_tempa = STR_TEMPA TEMP ;; Temp = ""; str_tempa = STR_TEMPA TEMP; TEMP = " " ; Str_tempa = STR_TEMPA TEMP; Double Top = 0 i * 12.5; IF (Deci>

0) {YNUM = Math.Round (Math.Pow (10, Deci) * (11-i) * max * 0.1) * Math.Pow (10, Deci 1) / (Math.Pow (10, Deci Deci) 1));} else {ynum = math.Round ((11-i) * max * 0.1);} String ninfo = "

YNUM ""; str_dinfo = ninfo;} // draw X-side horizontal painting string infostr = " "; for (int i = 0; i " TMPDATAINFOR [i] .tostring () " " ; If (convertata [i]) / 1! = 0) CreateColumn (i);} infostr = " "; str_info = infostr; // Complete, integrated statement str_Volume = str_TempA; str_Volume = str_Group3; str_Volume = str_info; str_Volume = ""; str_Volume = str_dinfo; str_Volume = ""; str_Volume = " " ;

} Private void createcolumn (int index) {double sx = bx index * step / 1 step / 4; double h = communication.todouble (tmpdata [index]) * YSTEP; Double Sy = 4700-h; string showmsg = tmpdatainfor [index] ": tmpdata [index]; str_group3 =" ";}}} // The following is the example of using the example private void page_load (Object sender, system.eventargs e) {chat1.data =" 12.5, 25, 19.5, 17.5, 12.5, 16, 9, 21, 3, 7, 8, 6.2, 9 "; chat1.datainfor =" Yangpu District, Zhabei District, Putuo District, Hongkou District, Baoshan District, Jiading District, Huangpu District, Minhang District, Pudong District, Jing'an, Xuhui District, other districts, other District "; chat1.colorar =" # ff2222, # d0b83a, # ffdf00, green, # ff9e00, # 799 AE1, # 99c741, # d0b83a, # 319a00, # c27f34, # 2222ff, # ff2222, # 99c741 ";} // guarantee that the program is running Normal Please do it below, you need to add it, pay attention to HTML> Mark, and the