Yesterday, I played a league of legends. When I saw this chart, I used it as an example to create a demo of chart statistics.
Select chart controls:
The first thing that comes to mind is the Chartlet chart control, which is a free chart control designed for ASP. NET. It is used to dynamically convert database data into statistical charts on the ASP. NET page.
Open the dll that VS references the control, and then follow the steps to introduce the control.
After the introduction, a chart item is added to the toolbox and the control is directly dragged into the page.
It automatically registers the control:
<% @ Register assembly = "Chartlet" namespace = "FanG" tagprefix = "PC3" %>
Database Design:
The table fields are as follows:
Then add the corresponding data
Page design:
Add several simple buttons
<Input id = "a" type = "checkbox" value = ", struck as kill" runat = "server"/> kill a hero <br/>
<Input id = "B" type = "checkbox" value = ", dead as death" runat = "server"/> death <br/>
<Input id = "c" type = "checkbox" value = ", assists as assists" runat = "server"/> assists <br/>
Set control properties and bind data:
Private void BindChartlet ()
{
Bool flag = true;
Chartlet1.ChartTitle. Text = "";
Chartlet1.MaxValueY = 25;
Chartlet1.MinValueY = 0;
Chartlet1.ChartType = FanG. Chartlet. ChartTypes. HBar; // convert the image to a horizontal layout.
Chartlet1.Tips. Show = true;
Chartlet1.AppearanceStyle = FanG. Chartlet. AppearanceStyles. HBar_2D_Breeze_FlatCrystal_NoGlow_NoBorder;
Chartlet1.Crystal. Contraction = 2;
StringBuilder SQL = new StringBuilder ();
SQL. Append ("select Player as Hero ");
Foreach (Control c in this. form1.Controls)
{
If (c. GetType (). ToString () = "System. Web. UI. HtmlControls. HtmlInputCheckBox ")
{
If (HtmlInputCheckBox) FindControl (c. ID). Checked = true ){
SQL. Append (HtmlInputCheckBox) FindControl (c. ID). Value );
Flag = false;
}
}
}
If (flag)
{
SQL. Append (", struck as kill, dead as death, assists as assists from dbo. PlayerData ");
}
Else
{
SQL. Append ("from dbo. PlayerData ");
}
Chartlet1.BindChartData (DAL. DbHelperSQL. Query (SQL. ToString ()));
}
Final effect: