Some time ago, the project was developed using a histogram, pie chart, because there is no good control on the side of the Internet, search on the web, and found that the evaluation of the chart control is quite high, first of all, the installation step, first have to install. NET Framework 3.5sp1, the MSChart.exe is installed mschart_visualstudioaddon.exe,vs2010 the corresponding VS2008 installation. After installing the VS software, you can see the chart control in the data class Control library and drag it over.
Mainly accept the meaning of some properties, lest not to learn again, time wasted
Front desk:
<asp: Chart id = "Chrcount" = "Server" background color = "Light Steel"
Backgradientstyle = "Topbottom" Backsecondarycolor = "white" enabletheming = "false"
EnableViewState = "true" HEIGHT = "303px" WIDTH = "1015PX" Imagestoragemode = "Useimagelocation" >
< legends >
<asp: Lenovo Alignment = "center" docking = "Left" NAME = "Legend1" title = "Legend" >
</ASP: Legends >
</Legends >
< title >
<asp: Title Font = "Microsoft Jas Black, 16PT" NAME = "Title 1" Text = "Credit Center information entry post completion number of statistics" >
</ASP: title >
</title >
< series >
</Series >
<ChartAreas>
<asp:chartarea NAME = "CHARTAREA1" >
<AxisX> <majorgrid enabled = "FALSE"/> </axisx>
<AxisY> <majorgrid enabled = "false"/> </axisy>
</asp:chartarea>
</chartareas>
</ASP: Charts >
Imagestoragemode This property to save the produced picture to the server.
Background:
Data Set dt = Cstatsreportv3.commitcountybystaffid (dtdkffrq,n type, actid,gdzxdept, property objdb);
Chrcount.datasource = DT;
ArrayList arrdc_staff = Cstatsreportv3.f_ostaffnamelistbyactid (dtdkffrq,actid,n type, gdzxdept, property objdb); Binding Data sources
ChrCount.Series.Clear (); Example of a bar chart
, if (arrdc_staff! = NULL)//Add bar chart legend According to People's dynamic
{
The foreach (Cdc_staff objstaff in Arrdc_staff)
{
CHRCOUNT.SERIES.ADD (Objstaff.m_nStaffid.ToString ());
Chrcount.series [Objstaff.m_nStaffid.ToString ()] = legendary "Legend1".
Chrcount.series [Objstaff.m_nStaffid.ToString ()] LegendText = Objstaff.m_szstaffname.
。 Chrcount.series [Objstaff.m_nStaffid.ToString ()] Xvaluemember = "strdate"; Point ¯x axis is date
Chrcount.series [Objstaff.m_nStaffid.ToString ()] = Yvaluemembers objstaff.m_szstaffname. Y axis for user
if (Arrdc_staff. Count <= 5)
Chrcount.series [Objstaff.m_nStaffid.ToString ()] Isvalueshownaslabel = TRUE; Whether to show bar chart no column values
}
}
Chrcount.chartareas ["ChartArea1"] = axisy.title "Number of pens (unit: pen)"; Y axis Units
Chrcount.chartareas ["ChartArea1"] = Axisy.titlealignment Stringalignment.far; Set the name of the axis title where the position is located far
Chrcount.chartareas ["ChartArea1"] Axisx.interval = 1.
。 Txtdateend.text = ToString () of ChrCount.Series.LongCount ();
string file = Use Server.MapPath (@ "〜/tmpfiles/2.jpeg");
Chrcount.saveimage (File,chartimageformat.jpeg);
chrcount.chartareas["ChartArea1"]. AxisX.MajorGrid.Enabled = FALSE; Whether to show the block behind the bar chart
chrcount.chartareas["ChartArea1"]. AxisY.MajorGrid.Enabled = FALSE;
Http://fancility.taobao.com's wife opened the shop, you are free to visit
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.