Some time ago, bar charts and pie charts were used for development in the project. Because vs does not have a good control on this side, I searched the internet and found that the chart control was still very high. I would like to start the installation step first, first install. net framework 3.5sp1,install mschart_visualstudioaddon.exeat vs2008. mschart.exe is installed at vs2010. After installation, open the vs software, and you can see the chart control in the data control library. You can drag it to use it.
It mainly accepts the meaning of some attributes, so as not to learn them again, wasting time.
Front-end:
<Asp: Chart ID = "chrCount" runat = "server" BackColor = "LightSteelBlue"
BackGradientStyle = "TopBottom" BackSecondaryColor = "White" EnableTheming = "False"
EnableViewState = "True" Height = "303px" Width = "1015px" ImageStorageMode = "UseImageLocation">
<Legends>
<Asp: Legend Alignment = "Center" Docking = "Left" Name = "Legend1" Title = "Legend">
</Asp: Legend>
</Legends>
<Titles>
<Asp: Title Font = ", 16pt" Name = "Title1" Text = "entry of information in the personal loan center to collect statistics">
</Asp: Title>
</Titles>
<Series>
</Series>
<ChartAreas>
<Asp: ChartArea Name = "ChartArea1">
<AxisX> <MajorGrid Enabled = "false"/> </AxisX>
<AxisY> <MajorGrid Enabled = "false"/> </AxisY>
</Asp: ChartArea>
</ChartAreas>
</Asp: Chart>
Whether the ImageStorageMode attribute saves the produced image to the server.
Background:
DataSet dt = CStatsReportV3.CommitCountyByStaffid (dtDKFFRQ, nType, actid, gdzxdept, ref objDB );
ChrCount. DataSource = dt;
ArrayList arrdc_staff = CStatsReportV3.F _ OstaffnameListByActid (dtDKFFRQ, actid, nType, gdzxdept, ref objDB); // bind the data source www.2cto.com
ChrCount. Series. Clear ();
If (arrdc_staff! = Null) // Add a bar chart legend dynamically based on the Personnel
{
Foreach (Cdc_staff objstaff in arrdc_staff)
{
ChrCount. Series. Add (objstaff. m_nStaffid.ToString ());
ChrCount. Series [objstaff. m_nStaffid.ToString ()]. Legend = "Legend1 ";
ChrCount. Series [objstaff. m_nStaffid.ToString ()]. LegendText = objstaff. m_szStaffname;
ChrCount. Series [objstaff. m_nStaffid.ToString ()]. XValueMember = "strDate"; // the X axis is the date
ChrCount. Series [objstaff. m_nStaffid.ToString ()]. YValueMembers = objstaff. m_szStaffname; // y axis is user
// If (arrdc_staff.Count <= 5)
ChrCount. Series [objstaff. m_nStaffid.ToString ()]. IsValueShownAsLabel = true; // whether the column chart has no column Value
}
}
ChrCount. ChartAreas ["ChartArea1"]. AxisY. Title = "pen count (unit: pen)"; // y axis Unit
ChrCount. ChartAreas ["ChartArea1"]. AxisY. TitleAlignment = StringAlignment. Far; // you can specify the location of the title of the Y axis.
ChrCount. ChartAreas ["ChartArea1"]. AxisX. Interval = 1;
// TxtDateEnd. Text = chrCount. Series. LongCount (). ToString ();
// String file = Server. MapPath (@"~ /TmpFiles/2.jpeg ");
// ChrCount. SaveImage (file, ChartImageFormat. Jpeg );
// ChrCount. ChartAreas ["ChartArea1"]. AxisX. MajorGrid. Enabled = false; // whether to display the square behind the bar chart
// ChrCount. ChartAreas ["ChartArea1"]. AxisY. MajorGrid. Enabled = false;
From fancility